[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240102143220.3068951d@kernel.org>
Date: Tue, 2 Jan 2024 14:32:20 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Laight <David.Laight@...LAB.COM>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "David S . Miller"
<davem@...emloft.net>, "eric.dumazet@...il.com" <eric.dumazet@...il.com>,
"martin.lau@...ux.dev" <martin.lau@...ux.dev>, Alexei Starovoitov
<ast@...nel.org>, "Stephen Hemminger" <stephen@...workplumber.org>, Jens
Axboe <axboe@...nel.dk>, "Daniel Borkmann" <daniel@...earbox.net>, Andrii
Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH net-next 0/4] sockptr: Change sockptr_t to be a struct
On Mon, 25 Dec 2023 09:46:23 +0000 David Laight wrote:
> The original commit for sockptr_t tried to use the pointer value
> to determine whether a pointer was user or kernel.
> This can't work on some architectures and was buggy on x86.
> So the is_kernel discriminator was added after the union of pointers.
>
> However this is still open to misuse and accidents.
> Replace the union with a struct and remove the is_kernel member.
> The user and kernel values are now in different places.
> The structure size doesn't change - it was always padded out to 'two pointers'.
>
> The only functional difference is that NULL pointers are always 'user'.
> So dereferencing will (usually) fault in copy_from_user() rather than
> panic if supplied as a kernel address.
>
> Simple driver code that uses kernel sockets still works.
> I've not tested bpf - but that should work unless it is breaking
> the rules.
LGTM, but we either need acks from bpf folks or route this via
bpf-next. So please repost and CC bpf@ on the whole series.
Powered by blists - more mailing lists