From: Quentin Monnet <qmo@kernel.org>
To: Ian Rogers <irogers@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Miguel Ojeda <ojeda@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>
Cc: "Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Nick Desaulniers" <ndesaulniers@google.com>,
"Bill Wendling" <morbo@google.com>,
"Justin Stitt" <justinstitt@google.com>,
linux-perf-users@vger.kernel.org, bpf@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-kbuild@vger.kernel.org,
llvm@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 3/3] bpftool: Prefer zlib-rs over zlib when available
Date: Mon, 2 Nov 2026 17:20:40 +0100 [thread overview]
Message-ID: <25216bda-7e36-4bad-ba7c-1984dbb9dfda@kernel.org> (raw)
In-Reply-To: <20261030202710.3863806-4-irogers@google.com>
Hi Ian, thanks for the v2,
2026-10-30 13:27 UTC-0700 ~ Ian Rogers <irogers@google.com>
> Add zlib-rs and zlib to FEATURE_TESTS and FEATURE_DISPLAY in
> tools/bpf/bpftool/Makefile and use feature_rust_lib to configure
> ZLIB_CFLAGS and ZLIB_LIBS when zlib-rs is detected (unless disabled with
> NO_ZLIB_RS=1), falling back to -lz.
>
> Decompression of kernel configuration (/proc/config.gz) and compressed
> ELF/BTF sections (via libbpf, libelf, and libbfd) processes data that
Is there any mechanism in place that prevents libbpf, libelf, and libbfd
to link to different versions of zlib (zlib vs zlib-rs, I mean)? I
imagine you could have bpftool linking against zlib-rs, but the libs
installed on the system linking against zlib? Also I think the static
build with the LLVM disassembler [0] passes -lz -lzstd in LIBS and I'm
not sure how it would combine with the change, I need to take a closer look.
> benefits from a memory-safe implementation. Preferring zlib-rs over C
> zlib provides memory safety and improved decompression performance while
> keeping bpftool aligned with tools/perf (including sharing libz_rs.a
> when building bootstrap bpftool for perf BPF skeletons).
>
> Signed-off-by: Ian Rogers <irogers@google.com>
Recalling our discussion from v1:
>> Hi Ian, bpftool doesn't make an intensive use of zlib (mostly, it's a
>> requirement from other dependencies; we may also use it to unzip the
>> kernel config on the host if necessary for probing BPF features on the
>> system, but only on some distributions). So I'm struggling to understand
>> the motivation for your proposal, what do we gain by switching to
>> zlib-rs when available? I understand this implementation is in Rust, but
>> I'm not sure the added complexity and feature probing in the build
>> system is worth it.
>
> Hi Quentin,
>
> At my workplace, we are transitioning from zlib to zlib-rs for both
> security and performance reasons. I'd like to keep upstream tools
> aligned but they don't have to be, it just seems nice. I agree zlib is
> of a lower priority to users than, say, zstd. For attackers, like with
> brotli, it is probably an area of interest. Knowing the implementation
> is memory safe is at least something in favor of zlib-rs. I sent this
> series out as an RFC because I obviously have no way to mandate what
> upstream should or shouldn't be doing. There are things that can make
> life a little nicer and easier, and this patch series, for me, is one
> of them.
I understand you're transitioning to zlib-rs, but the current patch is
not a full transition, in the sense that it doesn't replace zlib with
zlib-rs but allows any of the two options; and I don't see support for
the standard zlib being removed from bpftool anytime soon, which means
that in practice, we've got to maintain compatibility with the two
versions going forward. Others may want to chime in, but I'm still not
convinced this is worth the burden.
You also mention zstd, do you plan to add support for a zstd alternative
as well in perf and bpftool in the future?
(By the way, if you allow me a short digression, you had a patch related
to the zstd probing for perf and bpftool [0] and I don't see in the
tree, do you know if it was ever merged?)
Best regards,
Quentin
[0]
https://github.com/libbpf/bpftool/blob/main/.github/workflows/static-build.yaml
[1] https://lore.kernel.org/all/20260909204122.1993010-4-irogers@google.com/
prev parent reply other threads:[~2026-11-02 16:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 20:27 [RFC PATCH v2 0/3] tools: Add Rust library build infrastructure and prefer zlib-rs Ian Rogers
2026-10-30 20:27 ` [RFC PATCH v2 1/3] tools build: Add Rust library build infrastructure and zlib-rs feature test Ian Rogers
2026-10-30 20:27 ` [RFC PATCH v2 2/3] perf build: Prefer zlib-rs over zlib when available Ian Rogers
2026-10-30 20:46 ` sashiko-bot
2026-10-30 20:27 ` [RFC PATCH v2 3/3] bpftool: " Ian Rogers
2026-11-02 16:20 ` Quentin Monnet [this message]
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=25216bda-7e36-4bad-ba7c-1984dbb9dfda@kernel.org \
--to=qmo@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=justinstitt@google.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=lossin@kernel.org \
--cc=mingo@redhat.com \
--cc=morbo@google.com \
--cc=namhyung@kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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