linux-user: rt_sigprocmask, check read perms first
Linux kernel does it this way (checks read permission before validating `how`)
and the latest version of ABSL's `AddressIsReadable()` depends on this
behavior.
c.f. 9539ba4308/kernel/signal.c (L3147)
Reviewed-by: Patrick Venture <venture@google.com>
Signed-off-by: Shu-Chun Weng <scw@google.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Patrick Venture <venture@google.com>
Message-Id: <20220126212559.1936290-2-venture@google.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
33f53ac52a
commit
d3ced2a59a
@ -9478,6 +9478,13 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arg2) {
|
if (arg2) {
|
||||||
|
p = lock_user(VERIFY_READ, arg2, sizeof(target_sigset_t), 1);
|
||||||
|
if (!p) {
|
||||||
|
return -TARGET_EFAULT;
|
||||||
|
}
|
||||||
|
target_to_host_sigset(&set, p);
|
||||||
|
unlock_user(p, arg2, 0);
|
||||||
|
set_ptr = &set;
|
||||||
switch(how) {
|
switch(how) {
|
||||||
case TARGET_SIG_BLOCK:
|
case TARGET_SIG_BLOCK:
|
||||||
how = SIG_BLOCK;
|
how = SIG_BLOCK;
|
||||||
@ -9491,11 +9498,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
|||||||
default:
|
default:
|
||||||
return -TARGET_EINVAL;
|
return -TARGET_EINVAL;
|
||||||
}
|
}
|
||||||
if (!(p = lock_user(VERIFY_READ, arg2, sizeof(target_sigset_t), 1)))
|
|
||||||
return -TARGET_EFAULT;
|
|
||||||
target_to_host_sigset(&set, p);
|
|
||||||
unlock_user(p, arg2, 0);
|
|
||||||
set_ptr = &set;
|
|
||||||
} else {
|
} else {
|
||||||
how = 0;
|
how = 0;
|
||||||
set_ptr = NULL;
|
set_ptr = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user