[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230721121638.GH3630545@hirez.programming.kicks-ass.net>
Date: Fri, 21 Jul 2023 14:16:38 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: tglx@...utronix.de, axboe@...nel.dk
Cc: 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 11/14] futex: Implement FUTEX2_NUMA
On Fri, Jul 21, 2023 at 12:22:48PM +0200, Peter Zijlstra wrote:
> @@ -217,32 +259,55 @@ static u64 get_inode_sequence_number(str
> *
> * lock_page() might sleep, the caller should not hold a spinlock.
> */
> -int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
> +int get_futex_key(void __user *uaddr, unsigned int flags, union futex_key *key,
> enum futex_access rw)
> {
> unsigned long address = (unsigned long)uaddr;
> struct mm_struct *mm = current->mm;
> struct page *page, *tail;
> struct address_space *mapping;
> + int node, err, size, ro = 0;
> bool fshared;
>
> fshared = flags & FLAGS_SHARED;
> + size = futex_size(flags);
>
> /*
> * The futex address must be "naturally" aligned.
> */
> key->both.offset = address % PAGE_SIZE;
> + if (unlikely((address % size) != 0))
> return -EINVAL;
This enforces u32 alignment for:
struct futex_numa_32 {
u32 val;
u32 node;
};
Or do we want to enfore u64 alignment for that?
> address -= key->both.offset;
>
> + if (flags & FLAGS_NUMA)
> + size *= 2;
> +
> + if (unlikely(!access_ok(uaddr, size)))
> return -EFAULT;
Powered by blists - more mailing lists