mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hao Sun <sunhao.th@gmail.com>
To: Yonghong Song <yhs@meta.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	John Fastabend <john.fastabend@gmail.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, David Miller <davem@davemloft.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: WARNING in debug_mutex_unlock
Date: Mon, 16 Jan 2023 10:24:09 +0800	[thread overview]
Message-ID: <C4BBA1C3-C704-49D3-8E13-18875B27FB47@gmail.com> (raw)
In-Reply-To: <be494ee3-864d-1a33-e14d-d27712ab6248@meta.com>



> On 13 Jan 2023, at 2:45 PM, Yonghong Song <yhs@meta.com> wrote:
> 
> 
> 
> On 1/8/23 11:44 PM, Hao Sun wrote:
>> Hi,
>> The following warning can be triggered with the C reproducer in
>> the link. The repro starts 32 threads, each attaches a tracepoint
>> into `ext4_mark_inode_dirty`. The prog loads the following insns
>> that simply sends signal to current proc, and then wait.
>> Seems issues in queued irq_work with `do_bpf_send_signal`, also
>> I'm wondering what if the task in `send_signal_irq_work` exited,
>> at the time the callback invoked.
> 
> Somehow, I cannot reproduce the issue in my qemu environment
> with below kernel config and C reproducer.
> 
> But could you try the following patch to see whether it
> fixed the issue in your environment?

Tested the below patch on my local machine, seems fixed the issue.

Before applying the patch, the reproducer can still trigger the
reported issue on a latest bpf-next build; After applying the
patch, the warning no longer appears.

The test is conducted on: dfff86f8eb6a (“Merge branch 'samples/bpf:
modernize BPF functionality test programs'")


> 
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index 23ce498bca97..1b26d51caf31 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -831,6 +831,7 @@ static void do_bpf_send_signal(struct irq_work *entry)
> 
>        work = container_of(entry, struct send_signal_irq_work, irq_work);
>        group_send_sig_info(work->sig, SEND_SIG_PRIV, work->task, work->type);
> +       put_task_struct(work->task);
> }
> 
> static int bpf_send_signal_common(u32 sig, enum pid_type type)
> @@ -862,7 +863,7 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type)
>                 * to the irq_work. The current task may change when queued
>                 * irq works get executed.
>                 */
> -               work->task = current;
> +               work->task = get_task_struct(current);
>                work->sig = sig;
>                work->type = type;
>                irq_work_queue(&work->irq_work);
> 


  reply	other threads:[~2023-01-16  2:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09  7:44 Hao Sun
2023-01-13  6:45 ` Yonghong Song
2023-01-16  2:24   ` Hao Sun [this message]
2023-01-17  6:02     ` Yonghong Song

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=C4BBA1C3-C704-49D3-8E13-18875B27FB47@gmail.com \
    --to=sunhao.th@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.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=yhs@fb.com \
    --cc=yhs@meta.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

all inboxes | Powered by JetHome®