diff --git a/kernel/src/sync.c b/kernel/src/sync.c index 14dd98c2..4d1868ca 100644 --- a/kernel/src/sync.c +++ b/kernel/src/sync.c @@ -171,7 +171,8 @@ int eos_mutex_lock(eos_mutex_handle_t h, uint32_t timeout_ms) } /* Refuse rather than block: a task that is not enqueued is never granted - * the mutex, so with EOS_WAIT_FOREVER it would sleep forever. */ + * the mutex, so with EOS_WAIT_FOREVER it would sleep forever. Refusing + * also avoids boosting the owner on behalf of a caller that never waits. */ if (g_mtx[h].waiter_count >= MTX_MAX_WAITERS) { eos_port_exit_critical(crit); return EOS_KERN_NO_MEMORY; @@ -197,7 +198,8 @@ int eos_mutex_lock(eos_mutex_handle_t h, uint32_t timeout_ms) return EOS_KERN_OK; } - /* Timeout — leave the queue and drop the boost we were causing. */ + /* Timeout — leave the queue and drop the boost we were causing, so a + * waiter that gave up no longer keeps the owner running elevated. */ uint8_t owner = g_mtx[h].owner; mtx_remove_waiter(&g_mtx[h], caller); pi_propagate(owner); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e82ff348..0207944c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -56,39 +56,21 @@ add_executable(test_crypto test_crypto.c) target_link_libraries(test_crypto PRIVATE eos_crypto) add_test(NAME test_crypto COMMAND test_crypto) -# --- test_crc: CRC-32 / CRC-64 known answers and file error paths --- -add_executable(test_crc test_crc.c) -target_link_libraries(test_crc PRIVATE eos_crypto) -add_test(NAME test_crc COMMAND test_crc) - -# --- test_crypto_aes / _ecc / _rsa / _sha512: were sitting in tests/ unused --- +# --- test_crypto_aes: AES-128/192/256 ECB + CBC, NIST FIPS-197 / SP 800-38A --- add_executable(test_crypto_aes test_crypto_aes.c) target_link_libraries(test_crypto_aes PRIVATE eos_crypto) add_test(NAME test_crypto_aes COMMAND test_crypto_aes) +# --- test_crypto_ecc: ECC point arithmetic and ECDSA --- add_executable(test_crypto_ecc test_crypto_ecc.c) target_link_libraries(test_crypto_ecc PRIVATE eos_crypto) add_test(NAME test_crypto_ecc COMMAND test_crypto_ecc) +# --- test_crypto_rsa: RSA modular exponentiation and verify --- add_executable(test_crypto_rsa test_crypto_rsa.c) target_link_libraries(test_crypto_rsa PRIVATE eos_crypto) add_test(NAME test_crypto_rsa COMMAND test_crypto_rsa) -add_executable(test_crypto_sha512 test_crypto_sha512.c) -target_link_libraries(test_crypto_sha512 PRIVATE eos_crypto) -add_test(NAME test_crypto_sha512 COMMAND test_crypto_sha512) - -# --- test_crypto_failclosed: unimplemented RSA/ECC stubs refuse to run --- -# Must NOT define EOS_ALLOW_STUB_CRYPTO; this is the production fail-closed path. -add_executable(test_crypto_failclosed test_crypto_failclosed.c) -target_link_libraries(test_crypto_failclosed PRIVATE eos_crypto) -add_test(NAME test_crypto_failclosed COMMAND test_crypto_failclosed) - -# --- test_crypto_aes: AES-128/192/256 ECB + CBC, NIST FIPS-197 / SP 800-38A --- -add_executable(test_crypto_aes test_crypto_aes.c) -target_link_libraries(test_crypto_aes PRIVATE eos_crypto) -add_test(NAME test_crypto_aes COMMAND test_crypto_aes) - # --- test_crypto_sha512: SHA-512 against NIST vectors --- add_executable(test_crypto_sha512 test_crypto_sha512.c) target_link_libraries(test_crypto_sha512 PRIVATE eos_crypto)