[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230731225959.GE51835@hirez.programming.kicks-ass.net>
Date: Tue, 1 Aug 2023 00:59:59 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: axboe@...nel.dk, linux-kernel@...r.kernel.org, mingo@...hat.com,
dvhart@...radead.org, dave@...olabs.net, andrealmeid@...lia.com,
Andrew Morton <akpm@...ux-foundation.org>, urezki@...il.com,
hch@...radead.org, lstoakes@...il.com,
Arnd Bergmann <arnd@...db.de>, linux-api@...r.kernel.org,
linux-mm@...ck.org, linux-arch@...r.kernel.org,
malteskarupke@....de
Subject: Re: [PATCH v1 02/14] futex: Extend the FUTEX2 flags
On Tue, Aug 01, 2023 at 12:43:24AM +0200, Thomas Gleixner wrote:
> > Also, sys_futex_{wake,wait}() have this thing as a syscall argument,
> > surely you don't want to put this union there as well?
>
> Why not? The anon union does not break the ABI unless I'm missing
> something. Existing user space can still use 'flags' and people who care
> about readability can use the bitfield, no?
>
> Its inside struct futex_waitv and not an explicit syscall argument, right?
Nope, see patches 5 and 6, they introduce:
sys_futex_wake(void __user *uaddr, unsigned long mask, int nr, unsigned int flags);
sys_futex_wait(void __user *uaddr, unsigned long val,
unsigned long mask, unsigned int flags,
struct __kernel_timespec __user *timeout, clockid_t clockid);
Using a union, would turn that into:
sys_futex_wake(void __user *uaddr, unsigned long mask, int nr, union futex_flags flags);
sys_futex_wait(void __user *uaddr, unsigned long val,
unsigned long mask, union futex_flags flags,
struct __kernel_timespec __user *timeout, clockid_t clockid);
Which then gets people to write garbage like:
futex_wake(add, 0xFFFF, 1, (union futex_flags){ .flags = FUTEX2_SIZE_U16 | FUTEX2_PRIVATE));
or
futex_wake(add, 0xFFFF, 1, (union futex_flags){ .size = FUTEX2_SIZE_U16, private = true, ));
You really want that ?
Powered by blists - more mailing lists