linux-user/syscall.c: Enforce pselect6 sigset size restrictions
PATCH 1/1 linux-user/syscall.c: Enforce pselect6 sigset size restrictions
Enforce the same restriction on the size of the sigset passed to pselect6 as the Linux kernel does. This is both correct and silences a gcc 4.6 warning about a write-only variable.
---
This really is the last gcc 4.6 warning fix!
linux-user/syscall.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
linux-user/syscall.c +5 -0
@@ -5684,6 +5684,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,if (arg_sigset) { sig.set = &set; +if (arg_sigsize !=sizeof (*target_sigset)) { +/* Like the kernel, we enforce correct size sigsets */ + ret = -TARGET_EINVAL ; + goto fail; + } target_sigset =lock_user (VERIFY_READ , arg_sigset,sizeof (*target_sigset),1 );if (!target_sigset) {
Signature · 1 line
1.7.5.3
Quoted 3 lines · Peter Maydell
Enforce the same restriction on the size of the sigset passed to pselect6 as the Linux kernel does. This is both correct and silences a gcc 4.6 warning about a write-only variable.
Odd but true, after all the trouble of passing the size as packed variable, even the kernel bothers nothing but check that it matches with sizeof(sigset_t)...
I'll include this and your other two patches for the next round.
Riku
Quoted 25 lines
Signed-off-by Peter Maydell <[email protected]>---
This really is the last gcc 4.6 warning fix!linux-user/syscall.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)linux-user/syscall.c +5
-0@@ -5684,6 +5684,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,if (arg_sigset) { sig.set = &set; +if (arg_sigsize !=sizeof (*target_sigset)) { +/* Like the kernel, we enforce correct size sigsets */ + ret = -TARGET_EINVAL ; + goto fail; + } target_sigset =lock_user (VERIFY_READ , arg_sigset,sizeof (*target_sigset),1 );if (!target_sigset) {Signature · 1 line
1.7.5.3
Quoted 8 lines · Riku Voipio
Quoted 3 lines · Peter Maydell
Enforce the same restriction on the size of the sigset passed to pselect6 as the Linux kernel does. This is both correct and silences a gcc 4.6 warning about a write-only variable.
Odd but true, after all the trouble of passing the size as packed variable, even the kernel bothers nothing but check that it matches with
sizeof(sigset_t)...
I assume they're leaving the door open for implementing that properly at some later date.
Incidentally, if the qemu target's sigset_t and the host's sigset_t are different sizes then not just this syscall but I suspect all the others that use sigset_t will have trouble. Luckily only one flavour of MIPS has a non-standard sigset_t size :-)
-- PMM
-mike