public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin KaFai Lau <martin.lau@linux.dev>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	ameryhung@gmail.com, andrii@kernel.org, ast@kernel.org,
	bpf@vger.kernel.org, daniel@iogearbox.net, eddyz87@gmail.com,
	grbell@redhat.com, haoluo@google.com, john.fastabend@gmail.com,
	jolsa@kernel.org, kpsingh@kernel.org, sdf@fomichev.me,
	song@kernel.org, yonghong.song@linux.dev
Subject: Re: [PATCH] bpf: Release module BTF IDR before module unload
Date: Wed, 11 Mar 2026 12:55:03 -0700	[thread overview]
Message-ID: <2309925c-97dd-4298-bbe3-304a0d35670f@linux.dev> (raw)
In-Reply-To: <CAEf4BzaHWs1hhkhcFJRoza98R+zB8LnhSi4_00SXNgan+rAB0Q@mail.gmail.com>

On 3/11/26 12:17 PM, Andrii Nakryiko wrote:
>> For struct_ops prog, the module refcount is not held in prog->aux->mod.
>> I don't think it has to since it is not directly attached to the module.
> 
> If we have something referencing a module, we should probably get and
> keep refcnt on it, no? Why would we have a pointer to a module we
> cannot be sure is still alive when we access it, sounds too
> error-prone to me.

> 
>> For struct_ops map, it attaches the struct_ops prog to the module, so
>> the module refcount is held. It should be fine.

The module count is held but it is held by the struct_ops map. The 
struct_ops prog doesn't use the module and doesn't have a pointer to a 
module after it is loaded.

  reply	other threads:[~2026-03-11 19:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10 20:21 [PATCH bpf-next 0/1] Fix BPF struct_ops BTF cleanup race condition Gregory Bell
2026-03-10 20:21 ` [PATCH bpf-next 1/1] bpf: Fix BTF module cleanup race condition in struct_ops Gregory Bell
2026-03-10 20:58   ` bot+bpf-ci
2026-03-10 21:39   ` Kumar Kartikeya Dwivedi
2026-03-10 22:38     ` Amery Hung
2026-03-10 22:47       ` Kumar Kartikeya Dwivedi
2026-03-10 23:17         ` Amery Hung
2026-03-10 23:35           ` Kumar Kartikeya Dwivedi
2026-03-11  0:20             ` Martin KaFai Lau
2026-03-11  9:30               ` Kumar Kartikeya Dwivedi
2026-03-11  9:34                 ` Kumar Kartikeya Dwivedi
2026-03-11 12:21                 ` Alan Maguire
2026-03-11 13:05                   ` Kumar Kartikeya Dwivedi
2026-03-11 13:03               ` [PATCH] bpf: Release module BTF IDR before module unload Kumar Kartikeya Dwivedi
2026-03-11 13:26                 ` Kumar Kartikeya Dwivedi
2026-03-11 16:48                   ` Greg Bell
2026-03-11 13:40                 ` bot+bpf-ci
2026-03-11 19:10                 ` Martin KaFai Lau
2026-03-11 19:17                   ` Andrii Nakryiko
2026-03-11 19:55                     ` Martin KaFai Lau [this message]
2026-03-12  3:08                 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2309925c-97dd-4298-bbe3-304a0d35670f@linux.dev \
    --to=martin.lau@linux.dev \
    --cc=ameryhung@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=grbell@redhat.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=memxor@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox