]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
security: add user_range_ok validation for futex uaddr (Fase 2)
authorTulio A M Mendes <[email protected]>
Tue, 26 May 2026 05:11:26 +0000 (02:11 -0300)
committerTulio A M Mendes <[email protected]>
Wed, 3 Jun 2026 05:52:27 +0000 (02:52 -0300)
src/kernel/syscall.c

index 9afb2fc08ac2434a2e829df882b92c809e6c245b..ed85615b06355b910250f6c2b3a99b18b70e2484 100644 (file)
@@ -4622,6 +4622,11 @@ static void posix_ext_syscall_dispatch(struct registers* regs, uint32_t syscall_
 
         if (!uaddr) { sc_ret(regs) = (uint32_t)-EFAULT; return; }
 
+        /* Validate uaddr is in user space */
+        if (user_range_ok(uaddr, sizeof(uint32_t)) == 0) {
+            sc_ret(regs) = (uint32_t)-EFAULT; return;
+        }
+
         if (op == FUTEX_WAIT) {
             uint32_t cur = 0;
             if (copy_from_user(&cur, uaddr, sizeof(cur)) < 0) {