linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Puranjay Mohan <puranjay@kernel.org>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: syzbot <syzbot+97da3d7e0112d59971de@syzkaller.appspotmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>, bpf <bpf@vger.kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Eddy Z <eddyz87@gmail.com>, Hao Luo <haoluo@google.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Jiri Olsa <jolsa@kernel.org>, KP Singh <kpsingh@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-trace-kernel <linux-trace-kernel@vger.kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Matt Bobrowski <mattbobrowski@google.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Song Liu <song@kernel.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Yonghong Song <yonghong.song@linux.dev>
Subject: Re: [syzbot] [bpf?] [trace?] WARNING: locking bug in __lock_task_sighand
Date: Wed, 15 Jan 2025 10:38:56 +0000	[thread overview]
Message-ID: <mb61p5xmgicov.fsf@kernel.org> (raw)
In-Reply-To: <CAADnVQL=_6n+yJfs+TPxtBEVcpYV6nPEgjfRmacCdm7qLCSj0g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]

Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:

> On Tue, Dec 17, 2024 at 3:49 PM Alexei Starovoitov
> <alexei.starovoitov@gmail.com> wrote:
>>
>> On Mon, Dec 2, 2024 at 4:42 AM Puranjay Mohan <puranjay@kernel.org> wrote:
>> >
>> > Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:
>> >
>> > > Puranjay, Andrii and All,
>> > >
>> > > looks like if (irqs_disabled()) is not enough.
>> > > Should we change it to preemptible() ?
>> > >
>> > > It will likely make it async all the time,
>> > > but in this it's an ok trade off?
>> > >
>> >
>> > Yes, as BPF programs can run in all kinds of contexts.
>> >
>> > We should replace 'if (irqs_disabled())' with 'if (!preemptible())'
>> >
>> > because the definition is:
>> >
>> > #define preemptible()   (preempt_count() == 0 && !irqs_disabled())
>> >
>> > and we need if ((preempt_count() != 0) || irqs_disabled()), in both
>> > these cases we want to make it async.
>> >
>> > I will try to test the fix as Syzbot has now found a reproducer.
>>
>> Puranjay,
>>
>> Any progress on a patch ?
>
> ping.

Hi Alexei,
Sorry for being AWOL. I was on a long vacation in India and just got
back.

Here is the patch to fix this: https://lore.kernel.org/all/20250115103647.38487-1-puranjay@kernel.org/

Thanks,
Puranjay

#syz test: https://github.com/puranjaymohan/bpf.git bpf_preemt_fix

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

  reply	other threads:[~2025-01-15 10:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-28 13:07 [syzbot] [bpf?] [trace?] WARNING: locking bug in __lock_task_sighand syzbot
2024-11-29 16:47 ` Alexei Starovoitov
2024-12-02 12:41   ` Puranjay Mohan
2024-12-17 23:49     ` Alexei Starovoitov
2024-12-20 17:30       ` Alexei Starovoitov
2025-01-15 10:38         ` Puranjay Mohan [this message]
2025-01-15 11:47           ` syzbot
2024-12-02 10:14 ` syzbot

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=mb61p5xmgicov.fsf@kernel.org \
    --to=puranjay@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mattbobrowski@google.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=syzbot+97da3d7e0112d59971de@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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;
as well as URLs for NNTP newsgroup(s).