]> Git Repo - qemu.git/commitdiff
linux-user: sigprocmask check read perms first
authorPatrick Venture <[email protected]>
Wed, 26 Jan 2022 21:25:59 +0000 (13:25 -0800)
committerLaurent Vivier <[email protected]>
Thu, 27 Jan 2022 15:58:33 +0000 (16:58 +0100)
Linux kernel now checks the read permissions before validating `how`

Suggested-by: Laurent Vivier <[email protected]>
Signed-off-by: Patrick Venture <[email protected]>
Reviewed-by: Laurent Vivier <[email protected]>
Message-Id: <20220126212559.1936290[email protected]>
[lv: remove unneeded ")"]
Signed-off-by: Laurent Vivier <[email protected]>
linux-user/syscall.c

index 9f8b497fa35367d7d5fca0651d8af12d74a2e13d..84cfa223df4e3b72184018794afe099ea8f1ac24 100644 (file)
@@ -9435,6 +9435,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
             int how;
 
             if (arg2) {
+                p = lock_user(VERIFY_READ, arg2, sizeof(target_sigset_t), 1);
+                if (!p) {
+                    return -TARGET_EFAULT;
+                }
+                target_to_host_old_sigset(&set, p);
+                unlock_user(p, arg2, 0);
+                set_ptr = &set;
                 switch (arg1) {
                 case TARGET_SIG_BLOCK:
                     how = SIG_BLOCK;
@@ -9448,11 +9455,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
                 default:
                     return -TARGET_EINVAL;
                 }
-                if (!(p = lock_user(VERIFY_READ, arg2, sizeof(target_sigset_t), 1)))
-                    return -TARGET_EFAULT;
-                target_to_host_old_sigset(&set, p);
-                unlock_user(p, arg2, 0);
-                set_ptr = &set;
             } else {
                 how = 0;
                 set_ptr = NULL;
This page took 0.038324 seconds and 4 git commands to generate.