[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/8] linux-user: sigprocmask check read perms first
From: |
Laurent Vivier |
Subject: |
[PULL 5/8] linux-user: sigprocmask check read perms first |
Date: |
Mon, 7 Feb 2022 09:27:56 +0100 |
From: Patrick Venture <venture@google.com>
Linux kernel now checks the read permissions before validating `how`
Suggested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Patrick Venture <venture@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220126212559.1936290-3-venture@google.com>
[lv: remove unneeded ")"]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/syscall.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9f8b497fa353..84cfa223df4e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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;
--
2.34.1
- [PULL 0/8] Linux user for 7.0 patches, Laurent Vivier, 2022/02/07
- [PULL 5/8] linux-user: sigprocmask check read perms first,
Laurent Vivier <=
- [PULL 2/8] linux-user/alpha: Fix target rlimits for alpha and rearrange for clarity, Laurent Vivier, 2022/02/07
- [PULL 4/8] linux-user: rt_sigprocmask, check read perms first, Laurent Vivier, 2022/02/07
- [PULL 6/8] linux-user: Implement starttime field in self stat emulation, Laurent Vivier, 2022/02/07
- [PULL 7/8] linux-user: Move generic TARGET_RLIMIT* definitions to generic/target_resource.h, Laurent Vivier, 2022/02/07
- [PULL 1/8] linux-user: Remove unnecessary 'aligned' attribute from TaskState, Laurent Vivier, 2022/02/07
- [PULL 3/8] linux-user: Fix inotify on aarch64, Laurent Vivier, 2022/02/07
- [PULL 8/8] linux-user/syscall: Translate TARGET_RLIMIT_RTTIME, Laurent Vivier, 2022/02/07
- Re: [PULL 0/8] Linux user for 7.0 patches, Peter Maydell, 2022/02/07