BPF List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Song Liu <song@kernel.org>
Cc: <bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<live-patching@vger.kernel.org>, <daniel@iogearbox.net>,
	<kernel-team@fb.com>, <jolsa@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH bpf-next] bpf: fix test_progs -j error with fentry/fexit tests
Date: Fri, 29 Jul 2022 15:43:57 -0400	[thread overview]
Message-ID: <20220729154357.12cfea5f@rorschach.local.home> (raw)
In-Reply-To: <20220729194106.1207472-1-song@kernel.org>

On Fri, 29 Jul 2022 12:41:06 -0700
Song Liu <song@kernel.org> wrote:

> Then multiple threads are attaching/detaching fentry/fexit programs to

 "When multiple threads"?

-- Steve

> the same trampoline, we may call register_fentry on the same trampoline
> twice: register_fentry(), unregister_fentry(), then register_fentry again.
> This causes ftrace_set_filter_ip() for the same ip on tr->fops twice,
> which leaves duplicated ip in tr->fops. The extra ip is not cleaned up
> properly on unregister and thus causes failures with further register in
> register_ftrace_direct_multi():
> 
> register_ftrace_direct_multi()
> {
>         ...
>         for (i = 0; i < size; i++) {
>                 hlist_for_each_entry(entry, &hash->buckets[i], hlist) {
>                         if (ftrace_find_rec_direct(entry->ip))
>                                 goto out_unlock;
>                 }
>         }
>         ...
> }
> 
> This can be triggered with parallel fentry/fexit tests with test_progs:
> 
>   ./test_progs -t fentry,fexit -j
> 
> Fix this by resetting tr->fops in ftrace_set_filter_ip(), so that there
> will never be duplicated entries in tr->fops.
> 

  reply	other threads:[~2022-07-29 19:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 19:41 [PATCH bpf-next] bpf: fix test_progs -j error with fentry/fexit tests Song Liu
2022-07-29 19:43 ` Steven Rostedt [this message]
2022-07-29 21:40 ` patchwork-bot+netdevbpf

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=20220729154357.12cfea5f@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=song@kernel.org \
    /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