From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C82F2F28F6 for ; Tue, 17 Feb 2026 11:29:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771327789; cv=none; b=GGZTmmoN65aDaZexQNrbN80zmB1HpLzKft6dM8sMgFKv5JTgpXbti3uQQYWyFcNgdzsS/RD+ZJ6kEwdtkAeFuXsvGSRe6X8RPLPY6bUMpmwlSdRAAEfnT+qci2tqjEtbFWurqhbLyWR3lC/MLkXN/rlDUnpXp38olhlCXD5PuP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771327789; c=relaxed/simple; bh=cMuSWvxYR5eb7V3y4b4uzhhpMV1mgsYv1SOkM72p9tY=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Oipjff5KsQagzCqpcl4vD77HSQoaXO/eDJqT9iUZX7UTdK9uvSuDr41GcOHnAIEu3+YHLIGQKFru7AVw3iuRGDAbtF3+ocxUcsg090hzbTl/+iZUbH7fCa6QKhC8DTwWUb3IGGeozo9fowbfYTlhLyvaFdtoG1EXyvfpPrUm3SY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fyWyEd8q; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fyWyEd8q" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-436263e31abso3962168f8f.1 for ; Tue, 17 Feb 2026 03:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771327787; x=1771932587; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=7QTNpRHxHGxeoSqckXDTYVg2ZKwL+NMU+Mba7FsgZ2g=; b=fyWyEd8qZ83xItAZlaWMohAPCbg0n7E2FS+SCzkMnWD6he3s4zZMIxcIf+LCKKitW8 QK2bu5ak4Xavel2Iwu4M/S/UuwMutPagKQ9yfzrcRCdP9Ba3jbXRxdWgeQ+Em2180pmM MtMQiXyY2PecDg8FNc01SCZ2obyOt/tCkU78kik1US8I0UVgTEzvAqzNQ4kxjUCSK+jT CATviNwIM4BWJouzoCQuGia6SJJxMZ3r90E94S2YZGwCpJHshtRAc/pPMi9ALB8Fxtmg qD8yvQkjSBiGvRdlDoYVSsbcTtxVQBSb80ZV3sB7DNi3JPNLR6cjDvu/0WfTjstFKng0 8lKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771327787; x=1771932587; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=7QTNpRHxHGxeoSqckXDTYVg2ZKwL+NMU+Mba7FsgZ2g=; b=lT+TG/L0P+2BDE9XYHr45344aFm7+kz/GBSMx/EIhcTxcf/AdvSYtCfDR4w+OoeDW0 z3tXLvHFZ0pPtuL4jokjAKAQcO3HBXBHanmhIObTJ1ooQ3RReJQr2IXuWxYGJ0BPLsop 1r8FAPZVKsnTaS7XgZzVihZTMiOctrgHSc8OsNM871haG5TSQOMsfAt81lCDfQdrl84m SnvfdaQxsWQNEvahUIFsf5EJNpuz6JY510pJml5Qjf+uRejDHvZ2mMjvNynxvvecGsX7 3n/s4Nm6GKIn1VTmqxF4aDskuANzEo42iyXDHBVUydpkNN52WhE/zG5gCcGeegUDu1MC u6VQ== X-Forwarded-Encrypted: i=1; AJvYcCU5/0yg8Ytw9WDtGDkWth4L25xuDy3biPSuYTZ6Afs3eZDp4okmRhaU9q65dNYDG2CGoL7nahFplhRrOXk=@vger.kernel.org X-Gm-Message-State: AOJu0YxjEArpDALfBMzn8sVtd9wAPIVnyv1mLlYGfnJFJ2Oqri1F/U/7 GLvFJOmzWBuwyLaRGahGxg6sWDmvr+dFfe/hFDxHSNv7KDhPy/5uK5t+ X-Gm-Gg: AZuq6aL9KCPxpG7l6Hjq/bGMmSDeVXtYVQanb5XeUPpc2VncJ3m7g81efB53LN+W+Ci 3yrrtB4aEjstlRbCUd36FCFZtBNC/IAme5GHSywdp+vqiLWqUnejQes0zDpFZQaQhs+BVdD68fY OCrh/c8vtoIIdNnLY2wWQIiL2sSlezTR0uAArDkQqXX3dRNVAcokyu0ryvujW8TdyzvrkUeqKX8 SbSv94JQEc7MjzZ7JMs6qyJykQz6dsQlezlVaCmTfPSyd3NxW3aXEcHSBuKLS2aeiJqQyWXHui+ kWaD6gSCFsQZx72FcRgemZrBMTE6BwQu0pMbG9kqO8lCBMwAIc2RUHL2k7cu1jPMuIXfAJhnhdh o1MpJxCAlBefFu55Kno7SSZot7+TjtOEynJRTb7ImLaPnMCGWiZCTPuUMmPEW0J5WP0hHXZjh/5 jZbijtZ/L2qhOzVmS1Th7VuyOuhY3bOJb4+ulX1souZM34TCyz7Rqi1/lx6k8hZ0aO X-Received: by 2002:a05:600c:8b2f:b0:46f:c55a:5a8d with SMTP id 5b1f17b1804b1-483739ff865mr193668865e9.4.1771327786470; Tue, 17 Feb 2026 03:29:46 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48371a29982sm104891805e9.15.2026.02.17.03.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Feb 2026 03:29:46 -0800 (PST) Date: Tue, 17 Feb 2026 11:29:44 +0000 From: David Laight To: "Matthieu Baerts (NGI0)" Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Mykyta Yatsenko , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf] selftests/bpf: Remove hexdump dependency Message-ID: <20260217112944.75610d2b@pumpkin> In-Reply-To: <20260216-bpf-sft-hexdump-od-v1-1-f8cebd8eb9d0@kernel.org> References: <20260216-bpf-sft-hexdump-od-v1-1-f8cebd8eb9d0@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 16 Feb 2026 17:30:34 +0100 "Matthieu Baerts (NGI0)" wrote: > The verification signature header generation requires converting a > binary certificate to a C array. Previously this only worked with xxd, > and a switch to hexdump has been done in commit b640d556a2b3 > ("selftests/bpf: Remove xxd util dependency"). > > hexdump is a more common utility program, yet it might not be installed > by default. When it is not installed, BPF selftests build without > errors, but tests_progs is unusable: it exits with the 255 code and > without any error messages. When manually reproducing the issue, it is > not too hard to find out that the generated verification_cert.h file is > incorrect, but that's time consuming. When digging the BPF selftests > build logs, this line can be seen amongst thousands others, but ignored: > > /bin/sh: 2: hexdump: not found > > Here, od is used with awk, instead of hexdump with sed. od is coming > from the core utils package, and this new od command produces the same > output when using od from GNU coreutils, uutils, and even busybox. This > is more portable, and it produces the same results as what was done > before with hexdump (without trailing whitespaces as a bonus). > > Fixes: b640d556a2b3 ("selftests/bpf: Remove xxd util dependency") > Signed-off-by: Matthieu Baerts (NGI0) > --- > Originally, I was going to add a check to stop the build if hexdump was > not available, but switching to 'od' seems to be a better solution while > not adding a new dependency. > > Because test_progs was not reporting why it became unusable, I added a > Fixes tag to have this backported, to help others. Feel free to remove > it, or even drop the patch if you prefer to stick with hexdump. > --- > tools/testing/selftests/bpf/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index c6bf4dfb1495..5a618d14243e 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -723,7 +723,7 @@ $(VERIFICATION_CERT) $(PRIVATE_KEY): $(VERIFY_SIG_SETUP) > # Generates a header with C array declaration, containing test_progs_verification_cert bytes > $(VERIFY_SIG_HDR): $(VERIFICATION_CERT) > $(Q)(echo "unsigned char test_progs_verification_cert[] = {"; \ > - hexdump -v -e '12/1 " 0x%02x," "\n"' $< | sed 's/0x ,//g; $$s/,$$//'; \ > + od -v -t 'xC' -w12 $< | awk 'NF > 1 {for (i=2; i<=NF; i++) { printf " 0x%s,", $$i }; printf "\n"}'; \ That is subtly different. The hexdump version deletes the final ',' from the last full line. But not a partial line because there are trailing spaces (from before the '0x ,' that get removed). That may not matter, it is valid C, but not C++ (unless they've changed the rules recently). od could be used with: sed -e 's/ /, 0x/g; s/$/,/; s/^[0-7]*,//' which outputs an empty line as well as the trailing ','. Both removable with a more complex command line. David > echo "};"; \ > echo "unsigned int test_progs_verification_cert_len = $$(wc -c < $<);") > $@ > > > --- > base-commit: 886bf921ecfc30f8f31341bc26560d8bf08b937b > change-id: 20260216-bpf-sft-hexdump-od-abd07a3bf026 > > Best regards,