From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
bpf <bpf@vger.kernel.org>, Alexey Dobriyan <adobriyan@gmail.com>,
shakeel.butt@linux.dev, Johannes Weiner <hannes@cmpxchg.org>,
Andi Kleen <ak@linux.intel.com>,
Omar Sandoval <osandov@osandov.com>, Song Liu <song@kernel.org>,
Jann Horn <jannh@google.com>,
Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH v7 bpf-next 00/10] Harden and extend ELF build ID parsing logic
Date: Tue, 10 Sep 2024 17:27:45 -0700 [thread overview]
Message-ID: <CAADnVQLCh=D5vFTPQfYai3pW9EFGGjYwG9s+T-r-5a2-rj7kBw@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzYdP_6L1bT5bEwp5GAwM-rKOA36C-Cwv4i8h-3pKp-nkQ@mail.gmail.com>
On Tue, Sep 3, 2024 at 3:39 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Thu, Aug 29, 2024 at 10:42 AM Andrii Nakryiko <andrii@kernel.org> wrote:
> >
> > The goal of this patch set is to extend existing ELF build ID parsing logic,
> > currently mostly used by BPF subsystem, with support for working in sleepable
> > mode in which memory faults are allowed and can be relied upon to fetch
> > relevant parts of ELF file to find and fetch .note.gnu.build-id information.
> >
> > This is useful and important for BPF subsystem itself, but also for
> > PROCMAP_QUERY ioctl(), built atop of /proc/<pid>/maps functionality (see [0]),
> > which makes use of the same build_id_parse() functionality. PROCMAP_QUERY is
> > always called from sleepable user process context, so it doesn't have to
> > suffer from current restrictions of build_id_parse() which are due to the NMI
> > context assumption.
> >
> > Along the way, we harden the logic to avoid TOCTOU, overflow, out-of-bounds
> > access problems. This is the very first patch, which can be backported to
> > older releases, if necessary.
> >
> > We also lift existing limitations of only working as long as ELF program
> > headers and build ID note section is contained strictly within the very first
> > page of ELF file.
> >
> > We achieve all of the above without duplication of logic between sleepable and
> > non-sleepable modes through freader abstraction that manages underlying folio
> > from page cache (on demand) and gives a simple to use direct memory access
> > interface. With that, single page restrictions and adding sleepable mode
> > support is rather straightforward.
> >
> > We also extend existing set of BPF selftests with a few tests targeting build
> > ID logic across sleepable and non-sleepabe contexts (we utilize sleepable and
> > non-sleepable uprobes for that).
> >
> > [0] https://lore.kernel.org/linux-mm/20240627170900.1672542-4-andrii@kernel.org/
> >
> > v6->v7:
> > - added filemap_invalidate_{lock,unlock}_shared() around read_cache_folio
> > and kept Eduard's Reviewed-by (Eduard);
> > v5->v6:
> > - use local phnum variable in get_build_id_32() (Jann);
> > - switch memcmp() instead of strcmp() in parse_build_id() (Jann);
> > v4->v5:
> > - pass proper file reference to read_cache_folio() (Shakeel);
> > - fix another potential overflow due to two u32 additions (Andi);
> > - add PageUptodate() check to patch #1 (Jann);
> > v3->v4:
> > - fix few more potential overflow and out-of-bounds access issues (Andi);
> > - use purely folio-based implementation for freader (Matthew);
>
> Ok, so I'm not sure what one needs to do to get Matthew's attention
> nowadays, but hopefully yet another ping might do the trick.
>
> Matthew,
>
> Can you please take another look and provide your ack or nack? I did
> the conversion to folio as you requested. It would be nice if you can
> give me a courtesy of acking my patch set, if there is nothing wrong
> with it, so it can finally go in.
Looks like no further comments from Matthew or anyone else.
I'll take another look through the set before applying to bpf-next.
next prev parent reply other threads:[~2024-09-11 0:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 17:42 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
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 [this message]
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='CAADnVQLCh=D5vFTPQfYai3pW9EFGGjYwG9s+T-r-5a2-rj7kBw@mail.gmail.com' \
--to=alexei.starovoitov@gmail.com \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox