mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sanghyun Park <sanghyun.park.cnu@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Sanghyun Park <sanghyun.park.cnu@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Sun Jian <sun.jian.kdev@gmail.com>,
	Puranjay Mohan <puranjay@kernel.org>,
	Ihor Solodrai <ihor.solodrai@linux.dev>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+cdd6c0925e12b0af60cc@syzkaller.appspotmail.com,
	sashiko-bot@kernel.org
Subject: Re: [PATCH bpf-next v2] bpf: Fix mmap_lock leak in irq_work path
Date: Mon,  3 Aug 2026 18:44:34 +0900	[thread overview]
Message-ID: <20260803094434.2763945-2-sanghyun.park.cnu@gmail.com> (raw)
In-Reply-To: <CAEf4BzZ3TN4b0OFOV62YG=W3pAKD4x2eK=_mrmBCci7=fNQE0g@mail.gmail.com>

> maybe we should make bpf_mmap_unlock_get_irq_work() return `struct
> mmap_unlock_irq_work *` which would be ERR_PTR(), and return
> ERR_PTR(-EBUSY) if (active || irq_work_is_busy) (see below)? I'd
> probably call it bpf_mmap_unlock_guard_get(), though. And then we will
> have bpf_mmap_unlock_guard_put() (instead of
> bpf_mmap_unlock_put_irq_work) with the same logic.

Yes, I think this would make the code a bit more straightforward.

> we drop active to zero here, but irq_work_is_busy() can still return
> true, I think we do need to check both

Yes, BUSY can still be set after active is cleared. However, since the work can
be queued again while the callback is still running, I thought active alone was
enough. I also tested it in a widened window, and didn't see a lock leak.

But I may be missing something. Could requeueing the work here cause a problem,
or is this mainly to keep the original -EBUSY behavior?

  reply	other threads:[~2026-08-03  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  5:48 Sanghyun Park
2026-07-30  7:19 ` bot+bpf-ci
2026-07-30 23:50 ` Andrii Nakryiko
2026-08-03  9:44   ` Sanghyun Park [this message]
2026-08-03 17:44     ` Andrii Nakryiko
2026-08-04  1:08       ` Sanghyun Park

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=20260803094434.2763945-2-sanghyun.park.cnu@gmail.com \
    --to=sanghyun.park.cnu@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=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=puranjay@kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=song@kernel.org \
    --cc=sun.jian.kdev@gmail.com \
    --cc=syzbot+cdd6c0925e12b0af60cc@syzkaller.appspotmail.com \
    --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

all inboxes | Powered by JetHome®