* [PATCH] Pass nr_wake2 to futex_wake_op
@ 2007-07-17 11:31 Andreas Schwab
2007-07-18 1:06 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2007-07-17 11:31 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Ingo Molnar, Ulrich Drepper
The fourth argument of sys_futex is ignored when op == FUTEX_WAKE_OP,
but futex_wake_op expects it as its nr_wake2 parameter.
The only user of this operation in glibc is always passing 1, so this
bug had no consequences so far.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
kernel/futex.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- linux-2.6.22.orig/kernel/futex.c 2007-07-02 00:40:44.000000000 +0200
+++ linux-2.6.22/kernel/futex.c 2007-07-07 15:56:42.000000000 +0200
@@ -2061,8 +2061,10 @@ asmlinkage long sys_futex(u32 __user *ua
}
/*
* requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
+ * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
*/
- if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
+ if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
+ cmd == FUTEX_WAKE_OP)
val2 = (u32) (unsigned long) utime;
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Pass nr_wake2 to futex_wake_op
2007-07-17 11:31 [PATCH] Pass nr_wake2 to futex_wake_op Andreas Schwab
@ 2007-07-18 1:06 ` Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2007-07-18 1:06 UTC (permalink / raw)
To: Andreas Schwab; +Cc: linux-kernel, Ingo Molnar, Ulrich Drepper, stable
On Tue, 17 Jul 2007 13:31:29 +0200
Andreas Schwab <schwab@suse.de> wrote:
> The fourth argument of sys_futex is ignored when op == FUTEX_WAKE_OP,
> but futex_wake_op expects it as its nr_wake2 parameter.
>
> The only user of this operation in glibc is always passing 1, so this
> bug had no consequences so far.
>
> Signed-off-by: Andreas Schwab <schwab@suse.de>
>
> ---
> kernel/futex.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> --- linux-2.6.22.orig/kernel/futex.c 2007-07-02 00:40:44.000000000 +0200
> +++ linux-2.6.22/kernel/futex.c 2007-07-07 15:56:42.000000000 +0200
> @@ -2061,8 +2061,10 @@ asmlinkage long sys_futex(u32 __user *ua
> }
> /*
> * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
> + * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
> */
> - if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
> + if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
> + cmd == FUTEX_WAKE_OP)
> val2 = (u32) (unsigned long) utime;
>
> return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
>
So if an application or glibc _does_ start passing in non-1 values, it
will malfunction on earlier kernels?
So that userspace code would need to have a test for the kernel version, I
assume?
All a bit of a hassle. Still, I'd propose that this change (if the
thus-far-silent cc'ees agree with it?) go into 2.6.22.x at least. If it
gets accepted into 2.6.22.x then applications (or glibc) will need to test
for kernels as far back as 2.6.22. Really they would need to test for the
correct value of x in 2.6.22.x, but I don't know if glibc is set up for
that.
Thoughts?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Pass nr_wake2 to futex_wake_op
@ 2007-07-07 15:02 Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2007-07-07 15:02 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
The fourth argument of sys_futex is ignored when op == FUTEX_WAKE_OP,
but futex_wake_op expects it as its nr_wake2 parameter.
The only user of this operation in glibc is always passing 1, so this
bug had no consequences so far.
Signed-off-by: Andreas Schwab <schwab@suse.de>
---
kernel/futex.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- linux-2.6.22-rc7.orig/kernel/futex.c 2007-07-02 00:40:44.000000000 +0200
+++ linux-2.6.22-rc7/kernel/futex.c 2007-07-07 15:56:42.000000000 +0200
@@ -2061,8 +2061,10 @@ asmlinkage long sys_futex(u32 __user *ua
}
/*
* requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
+ * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
*/
- if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
+ if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
+ cmd == FUTEX_WAKE_OP)
val2 = (u32) (unsigned long) utime;
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-18 1:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-17 11:31 [PATCH] Pass nr_wake2 to futex_wake_op Andreas Schwab
2007-07-18 1:06 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2007-07-07 15:02 Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome