lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQJARz-9XgpCPvjwXCgyYkvZBbHez=wR5OcmA1TpSyYSKA@mail.gmail.com>
Date: Mon, 13 Nov 2023 05:36:48 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jakub Sitnicki <jakub@...udflare.com>
Cc: Pengcheng Yang <yangpc@...gsu.com>, John Fastabend <john.fastabend@...il.com>, 
	bpf <bpf@...r.kernel.org>, Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] bpf, sockmap: Bundle psock->sk_redir and
 redir_ingress into a tagged pointer

On Mon, Nov 13, 2023 at 1:14 AM Jakub Sitnicki <jakub@...udflare.com> wrote:
>
> On Fri, Nov 10, 2023 at 07:42 AM -08, Alexei Starovoitov wrote:
> > On Fri, Nov 10, 2023 at 1:44 AM Pengcheng Yang <yangpc@...gsu.com> wrote:
> >>
> >> Like skb->_sk_redir, we bundle the sock redirect pointer and
> >> the ingress bit to manage them together.
> >>
> >> Suggested-by: Jakub Sitnicki <jakub@...udflare.com>
> >> Link: https://lore.kernel.org/bpf/87cz97cnz8.fsf@cloudflare.com
> >> Signed-off-by: Pengcheng Yang <yangpc@...gsu.com>
> >> ---
> >>  include/linux/skmsg.h | 30 ++++++++++++++++++++++++++++--
> >>  net/core/skmsg.c      | 18 ++++++++++--------
> >>  net/ipv4/tcp_bpf.c    | 13 +++++++------
> >>  net/tls/tls_sw.c      | 11 ++++++-----
> >>  4 files changed, 51 insertions(+), 21 deletions(-)
> >>
> >> diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h
> >> index c1637515a8a4..ae021f511f46 100644
> >> --- a/include/linux/skmsg.h
> >> +++ b/include/linux/skmsg.h
> >> @@ -78,11 +78,10 @@ struct sk_psock_work_state {
> >>
> >>  struct sk_psock {
> >>         struct sock                     *sk;
> >> -       struct sock                     *sk_redir;
> >> +       unsigned long                   _sk_redir;
> >
> > Please don't.
> > There is no need to bundle them together.
>
> Seeing how the code turned out, I agree - it didn't work out.
> Code is not any simpler. My gut feeling was wrong here.
>
> I gotta ask for, for the future, though -
> this is not a "no" to tagged pointers in general, right?

In 99% cases there is no need to mix pointers with flags.
When you need to set/unset both pls use a lock.
A lot more obvious to humans and tools.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ