BPF List
 help / color / mirror / Atom feed
From: Quentin Monnet <qmo@kernel.org>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com,
	jolsa@kernel.org, terrelln@fb.com, dsterba@suse.com,
	acme@redhat.com, irogers@google.com, leo.yan@arm.com,
	namhyung@kernel.org, tglozar@redhat.com, blakejones@google.com,
	charlie@rivosinc.com, ebiggers@kernel.org, bpf@vger.kernel.org,
	linux-crypto@vger.kernel.org
Subject: Re: [RFC bpf-next 2/2] bpftool: Use libcrypto feature test to optionally support signing
Date: Thu, 30 Oct 2025 14:58:30 +0100	[thread overview]
Message-ID: <fc3a12bf-8b79-4ba9-8129-a4ad11c4852e@kernel.org> (raw)
In-Reply-To: <4ad07c65-1d4e-40ad-97e1-a7594a4d0d2c@oracle.com>

2025-10-29 11:22 UTC+0000 ~ Alan Maguire <alan.maguire@oracle.com>
> On 29/10/2025 10:40, Quentin Monnet wrote:
>> 2025-10-29 09:46 UTC+0000 ~ Alan Maguire <alan.maguire@oracle.com>
>>> New libcrypto test verifies presence of openssl3 needed for BPF
>>> signing; use that feature to conditionally compile signing-related
>>> code so bpftool build will not break in the absence of libcrypto v3.
>>
>>
>> Hi Alan, thanks for this work!
>>
>>
>>>
>>> Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
>>> Suggested-by: Quentin Monnet <qmo@kernel.org>
>>
>>
>> This is not exactly what I suggested, I mentioned adding such a feature
>> check and printing a more user-friendly error message at build time if
>> the dependency is missing, not leaving out the program signing feature.
>>
>> I've got reservations about the current approach: my concern is that
>> people packaging bpftool may prefer to compile and ship it without
>> program signing, if their build environment does not include the OpenSSL
>> dependency. But it seems to me that it will be an important feature
>> going forward, and that bpftool should ship with it.
>>
>> Regarding the OpenSSL v3 vs. older version concern (from the build
>> failure report thread):
>>
>>> One issue here is that some distros package openssl v3 such that the
>>> #include files are in /usr/include/openssl3 and libraries in
>>> /usr/lib64/openssl3 so that older versions can co-exist. Maybe we could
>>> figure out a feature test that handles that too?
>>
>> In that case, we should have a feature probe that gives us the right
>> build parameters to ensure that v3, and not some older version, is
>> picked when building bpftool? (We could imagine falling back to an older
>> version, but I see v3.0 is now the oldest OpenSSL supported version so
>> it's probably not worth it?)
>>
> 
> Actually there may be a simpler solution here; compilation at least
> succeeds for openssl < 3 with the following change
> 
> diff --git a/tools/bpf/bpftool/sign.c b/tools/bpf/bpftool/sign.c
> index b34f74d210e9..f9b742f4bb10 100644
> --- a/tools/bpf/bpftool/sign.c
> +++ b/tools/bpf/bpftool/sign.c
> @@ -28,6 +28,12 @@
> 
>  #define OPEN_SSL_ERR_BUF_LEN 256
> 
> +/* Use deprecated in 3.0 ERR_get_error_line_data for openssl < 3 */
> +#if !defined(OPENSSL_VERSION_MAJOR) || (OPENSSL_VERSION_MAJOR < 3)
> +#define ERR_get_error_all(file, line, func, data, flags) \
> +       ERR_get_error_line_data(file, line, data, flags)
> +#endif
> +
>  static void display_openssl_errors(int l)
>  {
>         char buf[OPEN_SSL_ERR_BUF_LEN];
> 
> 
> Given that openssl is already a build requirement for the kernel, that
> may well be enough to resolve this issue without feature tests etc.
> However I can't speak to whether there are other issues with using
> openssl v1 aside from compile-time problem this solves.


I'm equally unfamiliar with the risks associated with older OpenSSL
versions. Other than that, it sounds like a good solution to me. As
Namhyung pointed out, bpftool's build affects other things like perf, or
kernel build itself (for preloaded BPF iterators), so aligning
requirements with the ones from the kernel would make sense. From
Documentation/process/changes.rst I see that the minimal requirement for
OpenSSL is v1.0.0, so your suggestion is probably acceptable?

Quentin

  reply	other threads:[~2025-10-30 13:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29  9:46 [RFC bpf-next 0/2] bpftool signing feature check Alan Maguire
2025-10-29  9:46 ` [RFC bpf-next 1/2] tools-build: Add feature test for openssl3 Alan Maguire
2025-10-29  9:46 ` [RFC bpf-next 2/2] bpftool: Use libcrypto feature test to optionally support signing Alan Maguire
2025-10-29 10:15   ` bot+bpf-ci
2025-10-29 10:40   ` Quentin Monnet
2025-10-29 11:22     ` Alan Maguire
2025-10-30 13:58       ` Quentin Monnet [this message]
2025-10-31 10:11         ` bpftool BPF signing supported using openssl v1? (Was Re: [RFC bpf-next 2/2] bpftool: Use libcrypto feature test to optionally support signing) Alan Maguire

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=fc3a12bf-8b79-4ba9-8129-a4ad11c4852e@kernel.org \
    --to=qmo@kernel.org \
    --cc=acme@redhat.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=blakejones@google.com \
    --cc=bpf@vger.kernel.org \
    --cc=charlie@rivosinc.com \
    --cc=daniel@iogearbox.net \
    --cc=dsterba@suse.com \
    --cc=ebiggers@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=irogers@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=namhyung@kernel.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=terrelln@fb.com \
    --cc=tglozar@redhat.com \
    --cc=yonghong.song@linux.dev \
    /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