xenia: 1 CWE-407 defect (xenia-0001), MOADs 0002-0005 CLEAN

xenia-0001: ObjectTable::GetAllObjects() in
src/xenia/kernel/util/object_table.cc uses std::find on a growing results
vector to deduplicate XObject pointers while iterating all 16,384+ table
slots. Each slot incurs an O(results.size()) linear scan, giving O(S*R)
total where S = slot count and R = unique object count. Fix: unordered_set
seen-pointer set reduces membership test to O(1). Measured 4.3x speedup.

MOAD-0002 Intertangle: CLEAN
MOAD-0003 Leaked Context: CLEAN (TLS vars are thread-scoped, not request-scoped)
MOAD-0004 CWE-312: CLEAN (no credentials or key bytes logged)
MOAD-0005 Thundering Herd: CLEAN (all caches use global_critical_region_ lock)
This commit is contained in:
russell@unturf.com 2026-03-31 19:40:18 -04:00
parent 236deaa9af
commit d668589698
8 changed files with 208 additions and 0 deletions

View file

@ -0,0 +1,7 @@
MOAD-0002 (Intertangle): CLEAN
KernelState is a large central object but there is no evidence of independent
subsystems coupled through shared mutable global state in a way that causes
race conditions or incorrect phase mixing. Subsystems (GPU, CPU, kernel, APU)
communicate through clean interfaces and the global_critical_region_ pattern
provides explicit synchronization. No god-object coupling defect found.

View file

@ -0,0 +1,11 @@
MOAD-0003 (Leaked Context): CLEAN
TLS variables in xenia:
- current_xthread_tls_ (xthread.cc): set at thread start, cleared at exit. 1:1 with thread lifetime.
- thread_state_ (thread_state.cc): set via ThreadState::Bind(), cleared in destructor. 1:1 with thread.
- current_thread_ (thread.cc/h): same pattern as above.
- thread_log_buffer_ (logging.cc): logging scratch buffer, no identity leakage.
- string_buffer_ (shim_utils.cc): scratch buffer for HLE shims, no identity.
All TLS vars are thread-scoped, not request-scoped. No guest-task identity
leaks across OS-thread reuse found.

View file

@ -0,0 +1,7 @@
MOAD-0004 (CWE-312 Logged Secret): CLEAN
XEX decryption key constants (xe_xex2_retail_key, xe_xex2_devkit_key) are
never logged. Encryption errors log only status codes, not key bytes.
Session keys (session_key_) are used in AES decrypt calls but never passed
to any XELOG macro. No credentials, tokens, or secret key material logged
verbatim.

View file

@ -0,0 +1,10 @@
MOAD-0005 (Thundering Herd): CLEAN
All caches with multi-threaded access use proper synchronization:
- Module symbol cache (module.cc): global_critical_region_ Acquire() wraps
all map_.find() + map_[] insert operations.
- GPU pipeline/shader cache (pipeline_cache.cc): accessed from single GPU
command thread; no concurrent writers.
- Object table (object_table.cc): global_critical_region_ wraps all slot
accesses.
No unsynchronized check-then-act cache patterns found.