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] [thread-next>] [day] [month] [year] [list]
Message-ID: <e60b4acd2780eed0a0f89ee40df32cf518545cc4@linux.dev>
Date: Tue, 15 Apr 2025 11:04:36 +0000
From: "Jiayuan Chen" <jiayuan.chen@...ux.dev>
To: "Cong Wang" <xiyou.wangcong@...il.com>
Cc: bpf@...r.kernel.org, mrpre@....com, "Jakub Sitnicki"
 <jakub@...udflare.com>, "Steven Rostedt" <rostedt@...dmis.org>, "Alexei
 Starovoitov" <ast@...nel.org>, "Daniel Borkmann" <daniel@...earbox.net>,
 "John Fastabend" <john.fastabend@...il.com>, "Andrii Nakryiko"
 <andrii@...nel.org>, "Martin KaFai Lau" <martin.lau@...ux.dev>, "Eduard
 Zingerman" <eddyz87@...il.com>, "Song Liu" <song@...nel.org>, "Yonghong
 Song" <yonghong.song@...ux.dev>, "KP Singh" <kpsingh@...nel.org>,
 "Stanislav Fomichev" <sdf@...ichev.me>, "Hao Luo" <haoluo@...gle.com>,
 "Jiri Olsa" <jolsa@...nel.org>, "Masami Hiramatsu" <mhiramat@...nel.org>,
 "Mathieu Desnoyers" <mathieu.desnoyers@...icios.com>, "David S. Miller"
 <davem@...emloft.net>, "Eric Dumazet" <edumazet@...gle.com>, "Jakub
 Kicinski" <kuba@...nel.org>, "Paolo Abeni" <pabeni@...hat.com>, "Simon
 Horman" <horms@...nel.org>, "Jesper Dangaard Brouer" <hawk@...nel.org>,
 linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v3 1/2] bpf, sockmap: Introduce tracing
 capability for sockmap

April 15, 2025 at 05:25, "Cong Wang" <xiyou.wangcong@...il.com> wrote:

> 
> On Tue, Apr 15, 2025 at 12:11:45AM +0800, Jiayuan Chen wrote:
> 
> > 
> > +#ifndef __TRACE_SOCKMAP_HELPER_ONCE_ONLY
> >  +#define __TRACE_SOCKMAP_HELPER_ONCE_ONLY
> >  +
> >  +enum sockmap_direct_type {
> >  + SOCKMAP_REDIR_NONE = 0,
> >  + SOCKMAP_REDIR_INGRESS,
> >  + SOCKMAP_REDIR_EGRESS,
> >  +};
> > 
> 
> I am curious why you need to define them here since you already pass
> 'ingress' as a parameter? Is it possible to reuse the BPF_F_INGRESS bit?
> Thanks!
>

The lowest bit of skb->_redir being 0 indicates EGRESS, so we cannot use
the built-in __print_flag for output in this case, since it requires the
corresponding bit to be set to 1.

We could certainly do this instead:
'''
if (act != REDIRECT)
    redir = "none"
else if (flag & BPF_F_INGRESS)
    redir = "ingress"
else
    redir = "egress"
'''
However, as Steven mentioned earlier, using an enum instead would be better
here for trace_event.

Of course, we could directly print the hexadecimal value of _redir, but
that would result in poor readability.

Thanks~

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ