[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALOAHbBFcn9fDr_OuT=_JU6ojMz-Rac0CPMYpPfUpF87EWy0kg@mail.gmail.com>
Date: Thu, 16 Oct 2025 14:42:43 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: akpm@...ux-foundation.org, david@...hat.com, ziy@...dia.com,
baolin.wang@...ux.alibaba.com, lorenzo.stoakes@...cle.com,
Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com,
dev.jain@....com, hannes@...xchg.org, usamaarif642@...il.com,
gutierrez.asier@...wei-partners.com, willy@...radead.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org, ameryhung@...il.com,
rientjes@...gle.com, corbet@....net, 21cnbao@...il.com,
shakeel.butt@...ux.dev, tj@...nel.org, lance.yang@...ux.dev,
rdunlap@...radead.org, bpf@...r.kernel.org, linux-mm@...ck.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v10 mm-new 6/9] bpf: mark mm->owner as __safe_rcu_or_null
On Thu, Oct 16, 2025 at 12:36 AM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Wed, Oct 15, 2025 at 7:18 AM Yafang Shao <laoar.shao@...il.com> wrote:
> >
> > When CONFIG_MEMCG is enabled, we can access mm->owner under RCU. The
> > owner can be NULL. With this change, BPF helpers can safely access
> > mm->owner to retrieve the associated task from the mm. We can then make
> > policy decision based on the task attribute.
> >
> > The typical use case is as follows,
> >
> > bpf_rcu_read_lock(); // rcu lock must be held for rcu trusted field
> > @owner = @mm->owner; // mm_struct::owner is rcu trusted or null
> > if (!@...er)
> > goto out;
> >
> > /* Do something based on the task attribute */
> >
> > out:
> > bpf_rcu_read_unlock();
> >
> > Suggested-by: Andrii Nakryiko <andrii@...nel.org>
> > Signed-off-by: Yafang Shao <laoar.shao@...il.com>
> > Acked-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> > ---
> > kernel/bpf/verifier.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
>
> I thought you were going to send this and next patches outside of your
> thp patch set to land them sooner, as they don't have dependency on
> the rest of the patches and are useful on their own?
Thanks for your reminder.
They have been sent separately:
https://lore.kernel.org/bpf/20251016063929.13830-1-laoar.shao@gmail.com/
--
Regards
Yafang
Powered by blists - more mailing lists