qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions
@ 2011-06-28 11:21 Peter Maydell
  2011-06-28 11:51 ` Riku Voipio
  2011-06-28 16:14 ` Mike Frysinger
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2011-06-28 11:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Riku Voipio, Mike Frysinger, patches

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This really is the last gcc 4.6 warning fix!

 linux-user/syscall.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fed7a8f..feb2501 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -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) {
-- 
1.7.5.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions
  2011-06-28 11:21 [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions Peter Maydell
@ 2011-06-28 11:51 ` Riku Voipio
  2011-06-28 11:54   ` Peter Maydell
  2011-06-28 16:14 ` Mike Frysinger
  1 sibling, 1 reply; 4+ messages in thread
From: Riku Voipio @ 2011-06-28 11:51 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Mike Frysinger, qemu-devel

On Tue, Jun 28, 2011 at 12:21:57PM +0100, Peter Maydell wrote:
> 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
 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> This really is the last gcc 4.6 warning fix!
> 
>  linux-user/syscall.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index fed7a8f..feb2501 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -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) {
> -- 
> 1.7.5.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions
  2011-06-28 11:51 ` Riku Voipio
@ 2011-06-28 11:54   ` Peter Maydell
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2011-06-28 11:54 UTC (permalink / raw)
  To: Riku Voipio; +Cc: Mike Frysinger, qemu-devel

On 28 June 2011 12:51, Riku Voipio <riku.voipio@iki.fi> wrote:
> On Tue, Jun 28, 2011 at 12:21:57PM +0100, Peter Maydell wrote:
>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions
  2011-06-28 11:21 [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions Peter Maydell
  2011-06-28 11:51 ` Riku Voipio
@ 2011-06-28 16:14 ` Mike Frysinger
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2011-06-28 16:14 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Riku Voipio, qemu-devel, patches

[-- Attachment #1: Type: Text/Plain, Size: 51 bytes --]

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-28 16:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-28 11:21 [Qemu-devel] [PATCH] linux-user/syscall.c: Enforce pselect6 sigset size restrictions Peter Maydell
2011-06-28 11:51 ` Riku Voipio
2011-06-28 11:54   ` Peter Maydell
2011-06-28 16:14 ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).