]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
FIX security audit: 9 vulnerabilities across kernel and userland
authorTulio A M Mendes <[email protected]>
Tue, 28 Apr 2026 02:49:18 +0000 (23:49 -0300)
committerTulio A M Mendes <[email protected]>
Mon, 4 May 2026 23:52:08 +0000 (20:52 -0300)
commit38e7aa5baddbc84ba23bd96ed3427085f53f788e
treefef8cd03a9bd3ca31d2cf577ab7afa2e909bc113
parent0310a1541c66276ae91efd10ea7e921b616c8aa8
FIX security audit: 9 vulnerabilities across kernel and userland

CRITICAL:
- C3: heap.c corruption handlers — replace for(;;) infinite loop with
  schedule()+return, marking process ZOMBIE (exit_status=128)

HIGH:
- H1: syscall.c FCNTL_F_DUPFD_CLOEXEC — replace plain refcount++ with
  __sync_fetch_and_add for SMP atomicity
- H2: ulibc stdlib.c free() — add iteration limit (1024) and null-ptr
  guard to backward coalescing search to prevent infinite loop on
  corrupted next_free chain
- H3: ulibc stdio.c vfprintf — increase buffer 1024→4096, write full
  buffer on truncation instead of silently capping

MEDIUM:
- M1: sed.c parse_cmd — add regfree cleanup for addr1/addr2 regexes
  when parse_cmd fails after compilation
- M2: grep.c — fix -e option to extract pattern from same arg
  (-ePATTERN) or next arg (-e PATTERN)
- M4: syscall.c FUTEX_WAIT — accept timespec* timeout via arg3 instead
  of fixed 5000-tick (~100s); supports zero-timeout poll; update
  futex.h/futex.c/pthread.c/fulltest.c ABI

LOW:
- L1: dd.c parse_size — use long/strtol to prevent integer overflow on
  large values (e.g. bs=2048M)
- L2: init.c parse_inittab — warn when /etc/inittab exceeds 2047-byte
  buffer (truncation detection)

cppcheck:
- fulltest.c: initialize oldact struct to silence uninitvar warning

Tests: 120/120 QEMU, 152/152 battery, 111/111 host — zero regressions
12 files changed:
src/kernel/syscall.c
src/mm/heap.c
user/cmds/dd/dd.c
user/cmds/fulltest/fulltest.c
user/cmds/grep/grep.c
user/cmds/init/init.c
user/cmds/sed/sed.c
user/ulibc/include/linux/futex.h
user/ulibc/src/futex.c
user/ulibc/src/pthread.c
user/ulibc/src/stdio.c
user/ulibc/src/stdlib.c