[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-api
Subject: Re: [PATCH v1 02/14] futex: Extend the FUTEX2 flags
From: Peter Zijlstra <peterz () infradead ! org>
Date: 2023-07-31 22:59:59
Message-ID: 20230731225959.GE51835 () hirez ! programming ! kicks-ass ! net
[Download RAW message or body]
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 ?
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic