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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP01T75ATFb_gjy5_fSwt6=QMxt7kGSS+12SJN9rz9SfJQ7Qyg@mail.gmail.com>
Date: Tue, 6 Jan 2026 16:13:24 +0100
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: Matt Bobrowski <mattbobrowski@...gle.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>, Tejun Heo <tj@...nel.org>, 
	Roman Gushchin <roman.gushchin@...ux.dev>, bpf <bpf@...r.kernel.org>, 
	linux-mm <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>, 
	JP Kobryn <inwardvessel@...il.com>, Alexei Starovoitov <ast@...nel.org>, 
	Daniel Borkmann <daniel@...earbox.net>, Shakeel Butt <shakeel.butt@...ux.dev>, 
	Michal Hocko <mhocko@...nel.org>, Johannes Weiner <hannes@...xchg.org>
Subject: Re: [PATCH bpf-next v4 3/6] mm: introduce bpf_get_root_mem_cgroup()
 BPF kfunc

On Mon, 5 Jan 2026 at 22:04, Matt Bobrowski <mattbobrowski@...gle.com> wrote:
>
> On Mon, Jan 05, 2026 at 08:05:54AM -0800, Alexei Starovoitov wrote:
> > On Sun, Jan 4, 2026 at 11:49 PM Matt Bobrowski <mattbobrowski@...gle.com> wrote:
> > >
> > > >
> > > > No need for a new KF flag. Any struct returned by kfunc should be
> > > > trusted or trusted_or_null if KF_RET_NULL was specified.
> > > > I don't remember off the top of my head, but this behavior
> > > > is already implemented or we discussed making it this way.
> > >
> > > Hm, I do not see any evidence of this kind of semantic currently
> > > implemented, so perhaps it was only discussed at some point. Would you
> > > like me to put forward a patch that introduces this kind of implicit
> > > trust semantic for BPF kfuncs returning pointer to struct types?
> >
> > Hmm. What about these:
> > BTF_ID_FLAGS(func, scx_bpf_cpu_rq)
> > BTF_ID_FLAGS(func, scx_bpf_locked_rq, KF_RET_NULL)
> > BTF_ID_FLAGS(func, scx_bpf_cpu_curr, KF_RET_NULL | KF_RCU_PROTECTED)
> >
> > I thought they're returning a trusted pointer without acquiring it.
> > iirc the last one returns trusted in RCU CS,
> > but the first two return just a legacy ptr_to_btf_id ?
> > This is something to fix asap then.
>
> No, AFAIU they do not. These simply return a regular pointer to BTF ID
> (PTR_TO_BTF_ID), rather than a formally "trusted" pointer (which would
> carry the PTR_TRUSTED flag or a ref_obj_id). scx_bpf_cpu_curr returns
> a MEM_RCU pointer (via KF_RCU_PROTECTED), which is somewhat considered
> to be trusted within a RCU read-side critical section *ONLY*.
>
> Kumar/Tejun,

Yeah, they don't return a trusted pointer. I think it would make sense
to change the behavior here by default.
A non-trusted pointer cannot be passed to kfuncs taking trusted
arguments, so hopefully it will only make things more permissive and
doesn't break anything.

>
> Please keep me honest here.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ