public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	starmiku1207184332@gmail.com
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, song@kernel.org, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	haoluo@google.com, jolsa@kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, baijiaju1990@outlook.com
Subject: Re: [PATCH v2] kernel: bpf: stackmap: fix a possible sleep-in-atomic bug in bpf_mmap_unlock_get_irq_work()
Date: Fri, 17 Mar 2023 11:14:37 -0700	[thread overview]
Message-ID: <6414ae0db3f69_984f8208cb@john.notmuch> (raw)
In-Reply-To: <20230317171636.ftelyp6ty7mgo4rt@dhcp-172-26-102-232.dhcp.thefacebook.com>

Alexei Starovoitov wrote:
> On Fri, Mar 17, 2023 at 03:52:27AM +0000, starmiku1207184332@gmail.com wrote:
> > context because of its possible sleep operation. However, mmap_read_unlock()
> > is unsafely called in a preempt disabled context when spin_lock() or
> > rcu_read_lock() has been called.
> 
> Why is that unsafe?
> See __up_read(). It's doing preempt_disable().

Yep I didn't see the issue either that is why I asked for the stack trace. If
its a bug we would want a reproducer as well seems like it should be trivially
tested in selftests.

> 
> 
> > -	if (irqs_disabled()) {
> > +	if (in_atomic() || irqs_disabled()) {
> 
> We cannot do this. It will significantly hurt stack traces with build_id.



  reply	other threads:[~2023-03-17 18:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  3:52 [PATCH v2] kernel: bpf: stackmap: fix a possible sleep-in-atomic bug in bpf_mmap_unlock_get_irq_work() starmiku1207184332
2023-03-17 17:16 ` Alexei Starovoitov
2023-03-17 18:14   ` John Fastabend [this message]
     [not found]   ` <CALyQVayJaZ_s9yuL07ReZRmTT52ua7B+92CdYnLi9GiegpOKNw@mail.gmail.com>
2023-03-19 16:47     ` Alexei Starovoitov
     [not found]       ` <CALyQVazN_KTOhNVowuOV4FSr_zd5htCaBJ+xKgCDaL1LgVG50Q@mail.gmail.com>
2023-03-20 15:20         ` Alexei Starovoitov
     [not found]           ` <CALyQVawAZQ=K5RCnq0yz+g3fUT6vd5h15wMAeGXnDwdrZi87Qg@mail.gmail.com>
2023-03-22 22:30             ` Alexei Starovoitov

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=6414ae0db3f69_984f8208cb@john.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=baijiaju1990@outlook.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=starmiku1207184332@gmail.com \
    --cc=yhs@fb.com \
    /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