[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=wjGYtJOrgrjXF6zceePOp5G_F7VTfikjdGOsJ3eqsyfJg@mail.gmail.com>
Date: Sun, 9 Feb 2025 13:38:20 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: David Laight <david.laight.linux@...il.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Arnd Bergmann <arnd@...db.de>, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH 1/2] uaccess: Simplify code pattern for masked user copies
On Sun, 9 Feb 2025 at 13:18, David Laight <david.laight.linux@...il.com> wrote:
>
> Except for the ppc? case which needs the size to open a bounded window.
It passes the size down, but I didn't actually see it *use* the size
anywhere outside of the actual range check.
So it has code like
static __always_inline void allow_user_access(void __user *to, const
void __user *from,
u32 size, unsigned long dir)
{
BUILD_BUG_ON(!__builtin_constant_p(dir));
if (!(dir & KUAP_WRITE))
return;
current->thread.kuap = (__force u32)to;
uaccess_begin_32s((__force u32)to);
}
but notice how the size is basically not an issue. Same for the 8xx case:
static __always_inline void allow_user_access(void __user *to, const
void __user *from,
unsigned long size,
unsigned long dir)
{
uaccess_begin_8xx(MD_APG_INIT);
}
or the booke case:
static __always_inline void allow_user_access(void __user *to, const
void __user *from,
unsigned long size,
unsigned long dir)
{
uaccess_begin_booke(current->thread.pid);
}
but admittedly this is all a maze of small helper functions calling
each other, so I might have missed some path.
Linus
Powered by blists - more mailing lists