]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: deep code audit + testing infrastructure (sparse, expect, host unit tests)
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 11:07:09 +0000 (08:07 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:20:50 +0000 (23:20 -0300)
commitcbfb2149709ba7646d2a9b3b0b998de3e122b9e4
tree7c015802c4acd4e9b5d611a20ef3fc0322f9badf
parent237463d3063093fdd07fbaa61ed76ac041a40f6a
feat: deep code audit + testing infrastructure (sparse, expect, host unit tests)

Deep Code Audit (docs/AUDIT_REPORT.md):
- 18 findings across 4 categories: layer violations, logic/race
  conditions, security vulnerabilities, memory management
- CRITICAL: user_range_ok weak default allows kernel addr access
- CRITICAL: sigreturn allows IOPL escalation via eflags
- CRITICAL: PMM bitmap has no locking (SMP race)
- CRITICAL: file refcount manipulation not atomic
- HIGH: slab allocator hal_mm_phys_to_virt can hit heap VA
- HIGH: execve writes to user stack bypassing copy_to_user
- Full summary table with severity, category, location

Testing Infrastructure:
- make check    — cppcheck + sparse (kernel-oriented semantic checker)
- make analyzer — gcc -fanalyzer (interprocedural analysis)
- make test     — QEMU + expect automated smoke test (19 checks)
- make test-1cpu — single-CPU regression (50s timeout)
- make test-host — 28 host-side unit tests for pure functions
                   (itoa, itoa_hex, atoi, path_normalize, align)
- make test-all — all of the above

Testing Plan (docs/TESTING_PLAN.md):
- Layer 1: Static analysis (cppcheck + sparse + gcc -fanalyzer)
- Layer 2: QEMU + expect automated regression
- Layer 3: QEMU + GDB scripted debugging (future)
- Layer 4: Host-side unit tests for pure functions

All tests passing: 19/19 smoke, 28/28 unit, cppcheck clean.
Makefile
docs/AUDIT_REPORT.md [new file with mode: 0644]
docs/TESTING_PLAN.md [new file with mode: 0644]
tests/smoke_test.exp [new file with mode: 0755]
tests/test_utils.c [new file with mode: 0644]