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: <CAADnVQLFLSwrnHKZUtUpwQ1tst71AfYCcbbtK2haxF=R9StpSw@mail.gmail.com>
Date: Fri, 1 Aug 2025 08:12:08 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, 
	Linux Trace Kernel <linux-trace-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>, 
	Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, 
	Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, 
	Andrii Nakryiko <andrii@...nel.org>, Jiri Olsa <jolsa@...nel.org>, 
	Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>, 
	KP Singh <kpsingh@...nel.org>
Subject: Re: [PATCH] btf: Simplify BTF logic with use of __free(btf_put)

On Fri, Aug 1, 2025 at 8:06 AM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Fri, 1 Aug 2025 08:02:24 -0700
> Alexei Starovoitov <alexei.starovoitov@...il.com> wrote:
>
> > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> > > index 1d2cf898e21e..480657912c96 100644
> > > --- a/kernel/bpf/btf.c
> > > +++ b/kernel/bpf/btf.c
> > > @@ -3788,7 +3788,7 @@ static int btf_parse_kptr(const struct btf *btf, struct btf_field *field,
> > >         /* If a matching btf type is found in kernel or module BTFs, kptr_ref
> > >          * is that BTF, otherwise it's program BTF
> > >          */
> > > -       struct btf *kptr_btf;
> > > +       struct btf *kptr_btf __free(btf_put) = NULL;
> >
> > Sorry I hate this __free() style.
> > It's not a simplification, but an obfuscation of code and logic.
>
> Well, it's becoming more common. But you are in control of this, so it's
> your decision. I wanted this just to get rid of the gotos in my code.

You can use it in kernel/trace/trace_output.c, of course,
but I really think it's a step back in maintainability.
All this cleanup.h is not a silver bullet. It needs to be used sparingly.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ