From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, adobriyan@gmail.com,
shakeel.butt@linux.dev, hannes@cmpxchg.org, ak@linux.intel.com,
osandov@osandov.com, song@kernel.org, jannh@google.com,
linux-fsdevel@vger.kernel.org, willy@infradead.org,
Eduard Zingerman <eddyz87@gmail.com>
Subject: Re: [PATCH v7 bpf-next 09/10] bpf: wire up sleepable bpf_get_stack() and bpf_get_task_stack() helpers
Date: Tue, 12 Nov 2024 10:29:41 +0900 [thread overview]
Message-ID: <20241112012941.GC1458936@google.com> (raw)
In-Reply-To: <CAEf4BzZz_L5yc8OE21x93zb2RU+bujNsyQJTmvOvpm3Y--Uwpw@mail.gmail.com>
On (24/11/11 09:49), Andrii Nakryiko wrote:
> > On (24/08/29 10:42), Andrii Nakryiko wrote:
> > > Now that build ID related internals in kernel/bpf/stackmap.c can be used
> > > both in sleepable and non-sleepable contexts, we need to add additional
> > > rcu_read_lock()/rcu_read_unlock() protection around fetching
> > > perf_callchain_entry, but with the refactoring in previous commit it's
> > > now pretty straightforward. We make sure to do rcu_read_unlock (in
> > > sleepable mode only) right before stack_map_get_build_id_offset() call
> > > which can sleep. By that time we don't have any more use of
> > > perf_callchain_entry.
> >
> > Shouldn't this be backported to stable kernels? It seems that those still
> > do suspicious-RCU deference:
> >
> > __bpf_get_stack()
> > get_perf_callchain()
> > perf_callchain_user()
> > perf_get_guest_cbs()
>
> Do you see this issue in practice or have some repro?
> __bpf_get_stack() shouldn't be callable from sleepable BPF programs
> until my patch set, so I don't think there is anything to be
> backported. But maybe I'm missing something, which is why I'm asking
> whether this is a conclusion drawn from source code analysis, or there
> was actually a report somewhere.
I see a syzkaller report (internal) which triggers this call chain
and RCU-usage error. Not sure how practical that is, but syzkaller
was able to hit it (the report I'm looking at is against 5.15, but
__bpf_get_stack()-wise I don't see any differences between 5.15,
6.1 and 6.6)
next prev parent reply other threads:[~2024-11-12 1:29 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 17:42 [PATCH v7 bpf-next 00/10] Harden and extend ELF build ID parsing logic Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 01/10] lib/buildid: harden " Andrii Nakryiko
2024-11-01 13:54 ` Jiri Olsa
2024-11-01 18:12 ` Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 02/10] lib/buildid: add single folio-based file reader abstraction Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 03/10] lib/buildid: take into account e_phoff when fetching program headers Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 04/10] lib/buildid: remove single-page limit for PHDR search Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 05/10] lib/buildid: rename build_id_parse() into build_id_parse_nofault() Andrii Nakryiko
2024-10-14 2:50 ` Lai, Yi
2024-10-14 23:41 ` Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 06/10] lib/buildid: implement sleepable build_id_parse() API Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 07/10] lib/buildid: don't limit .note.gnu.build-id to the first page in ELF Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 08/10] bpf: decouple stack_map_get_build_id_offset() from perf_callchain_entry Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 09/10] bpf: wire up sleepable bpf_get_stack() and bpf_get_task_stack() helpers Andrii Nakryiko
2024-11-11 5:51 ` Sergey Senozhatsky
2024-11-11 17:49 ` Andrii Nakryiko
2024-11-12 1:29 ` Sergey Senozhatsky [this message]
2024-11-13 20:40 ` Andrii Nakryiko
2024-08-29 17:42 ` [PATCH v7 bpf-next 10/10] selftests/bpf: add build ID tests Andrii Nakryiko
2024-09-03 22:38 ` [PATCH v7 bpf-next 00/10] Harden and extend ELF build ID parsing logic Andrii Nakryiko
2024-09-11 0:27 ` Alexei Starovoitov
2024-09-11 17:10 ` 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=20241112012941.GC1458936@google.com \
--to=senozhatsky@chromium.org \
--cc=adobriyan@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=jannh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osandov@osandov.com \
--cc=shakeel.butt@linux.dev \
--cc=song@kernel.org \
--cc=willy@infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.