]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
security: fix inverted user_range_ok checks in socket syscalls (M5)
authorTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 00:46:26 +0000 (21:46 -0300)
committerTulio A M Mendes <[email protected]>
Thu, 11 Jun 2026 00:46:26 +0000 (21:46 -0300)
commitdb10ce138535236eb21df8c1bf60583c30a909c3
tree636d6b93c0b9999ae0176b350e74476d99ce3fea
parent7c5b50913b28b7c456210176ca340c0dfa0b3819
security: fix inverted user_range_ok checks in socket syscalls (M5)

- Fix SYSCALL_GETPEERNAME: user_range_ok == 0 means failure, not success
- Fix SYSCALL_GETSOCKNAME: user_range_ok == 0 means failure, not success
- Previously, the code incorrectly nested copy_to_user inside the
  user_range_ok == 0 check, which would only execute copy_to_user
  when the range check FAILED
- Now properly returns -EFAULT when user_range_ok fails, then
  calls copy_to_user when the range check succeeds

Validation:
- make -j12: PASS
- make test-host: PASS (111/111)
- make test SMOKE_SMP=4: PASS (127/127)
- make test-battery: PASS (153/153)
- make analyzer: PASS

Addresses M5 from docs/URGENT_SECURITY_STATUS_2026-06-09.md
src/kernel/syscall.c