From: sashiko-bot@kernel.org
To: "Blaise Boscaccy" <bboscaccy@linux.microsoft.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v7 08/10] hornet: Add a light skeleton data extractor scripts
Date: Fri, 08 May 2026 02:35:34 +0000 [thread overview]
Message-ID: <20260508023534.E00F4C2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260507191416.2984054-9-bboscaccy@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 8 potential issue(s) to consider:
- [High] extract-skel.sh and extract-map.sh fail with a usage error when extracting empty payloads.
- [High] The scripts strictly forbid passing include paths (-I) to the C preprocessor.
- [Medium] Unquoted variables in the scripts allow command injection and fail on filenames with spaces.
- [Medium] Improper use of printf with unquoted command substitution pollutes stderr and relies on undocumented behavior.
- [Medium] Trailing whitespace in the header file bypasses semicolon stripping, corrupting the payload.
- [Low] The usage function exits with a success status (0) on invalid arguments.
- [Low] Usage text in extract-map.sh incorrectly describes its functionality.
- [Low] Grammar mistakes in the commit message.
--
commit 4a15a4a590708cdca529a456f67bfad392cfd02a
Author: Blaise Boscaccy <bboscaccy@linux.microsoft.com>
hornet: Add a light skeleton data extractor scripts
These script eases light skeleton development against Hornet by
generating a data payloads which can be used for signing a light
skeleton binary using gen_sig.
> hornet: Add a light skeleton data extractor scripts
>
> These script eases light skeleton development against Hornet by
> generating a data payloads which can be used for signing a light
> skeleton binary using gen_sig.
This isn't a bug, but there is a grammar mistake in the commit message.
"These script eases" and "a data payloads" mix singular and plural forms.
> diff --git a/scripts/hornet/extract-insn.sh b/scripts/hornet/extract-insn.sh
> new file mode 100755
> index 0000000000000..52338f057ff6b
> --- /dev/null
> +++ b/scripts/hornet/extract-insn.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
[ ... ]
> +function usage() {
> + echo "Sample script for extracting instructions"
> + echo "autogenerated eBPF lskel headers"
> + echo ""
> + echo "USAGE: header_file"
> + exit
> +}
Could this cause build scripts to silently continue even when arguments are
missing? Calling exit without an argument defaults to the exit status of
the last command, which is echo in this case, returning a success status
of 0 instead of an error code.
> +ARGC=$#
> +
> +EXPECTED_ARGS=1
> +
> +if [ $ARGC -ne $EXPECTED_ARGS ] ; then
> + usage
> +else
Will this strict argument limit break in standard kernel build environments?
BPF light skeletons include <bpf/skel_internal.h>, which typically requires
passing include paths like -Itools/include to gcc -E. Enforcing exactly one
argument prevents passing any such flags to the preprocessor.
> + printf $(gcc -E $1 | grep "opts_insn" | \
Could the unquoted $1 cause gcc to fail if the header file path contains
spaces?
Is there a risk of printf throwing a usage error and failing the build if a
BPF object has no maps? If bpftool completely skips generating the data
array, the grep command returns nothing, and the unquoted command
substitution evaluates to zero arguments. A call to printf with no arguments
will throw a bash usage error to stderr and exit with a non-zero status.
Also, since grep might match multiple lines such as the array declaration
and opts.insns_sz = sizeof(...), the unquoted substitution will split them
into multiple words. Does this cause printf to use the first word as a
format string and issue warnings to stderr about ignoring excess arguments?
> + awk -F"=" '{print $2}' | sed 's/;\+$//' | sed 's/\"//g')
> +fi
Does the sed 's/;\+$//' command safely handle carriage returns or trailing
spaces?
If the generated C header contains whitespace after the semicolon, the line
ending anchor $ will fail to match, leaving the semicolon in the string
and potentially corrupting the extracted binary payload.
> diff --git a/scripts/hornet/extract-map.sh b/scripts/hornet/extract-map.sh
> new file mode 100755
> index 0000000000000..c309f505c6238
> --- /dev/null
> +++ b/scripts/hornet/extract-map.sh
> @@ -0,0 +1,27 @@
> +#!/bin/bash
[ ... ]
> +function usage() {
> + echo "Sample script for extracting instructions"
> + echo "autogenerated eBPF lskel headers"
This isn't a bug, but should this usage text mention that it extracts map
data instead of instructions?
> diff --git a/scripts/hornet/extract-skel.sh b/scripts/hornet/extract-skel.sh
> new file mode 100755
> index 0000000000000..6550a86b89917
> --- /dev/null
> +++ b/scripts/hornet/extract-skel.sh
[ ... ]
> +if [ $ARGC -ne $EXPECTED_ARGS ] ; then
> + usage
> +else
> + printf $(gcc -E $1 | grep "static const char opts_$2" | \
> + awk -F"=" '{print $2}' | sed 's/;\+$//' | sed 's/\"//g')
> +fi
Is it safe to pass $2 directly into the unquoted grep command here? If the
field argument contains spaces or shell characters like quotation marks or
pipes, it could result in command injection.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260507191416.2984054-1-bboscaccy@linux.microsoft.com?part=8
next prev parent reply other threads:[~2026-05-08 2:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 19:13 [PATCH v7 00/10] Reintroduce Hornet LSM Blaise Boscaccy
2026-05-07 19:13 ` [PATCH v7 01/10] crypto: pkcs7: add flag for validated trust on a signed info block Blaise Boscaccy
2026-05-07 23:51 ` sashiko-bot
2026-05-07 19:13 ` [PATCH v7 02/10] crypto: pkcs7: add ability to extract signed attributes by OID Blaise Boscaccy
2026-05-08 0:14 ` sashiko-bot
2026-05-07 19:13 ` [PATCH v7 03/10] crypto: pkcs7: add tests for pkcs7_get_authattr Blaise Boscaccy
2026-05-08 0:35 ` sashiko-bot
2026-05-07 19:13 ` [PATCH v7 04/10] lsm: framework for BPF integrity verification Blaise Boscaccy
2026-05-08 1:09 ` sashiko-bot
2026-05-07 19:13 ` [PATCH v7 05/10] lsm: security: Add additional enum values for bpf integrity checks Blaise Boscaccy
2026-05-07 19:14 ` [PATCH v7 06/10] security: Hornet LSM Blaise Boscaccy
2026-05-08 2:07 ` sashiko-bot
2026-05-07 19:14 ` [PATCH v7 07/10] hornet: Introduce gen_sig Blaise Boscaccy
2026-05-08 2:22 ` sashiko-bot
2026-05-07 19:14 ` [PATCH v7 08/10] hornet: Add a light skeleton data extractor scripts Blaise Boscaccy
2026-05-08 2:35 ` sashiko-bot [this message]
2026-05-07 19:14 ` [PATCH v7 09/10] selftests/hornet: Add a selftest for the Hornet LSM Blaise Boscaccy
2026-05-08 2:58 ` sashiko-bot
2026-05-07 19:14 ` [PATCH v7 10/10] ipe: Add BPF program load policy enforcement via Hornet integration Blaise Boscaccy
2026-05-08 4:21 ` sashiko-bot
2026-05-08 18:40 ` Fan Wu
2026-05-07 20:57 ` [PATCH v7 00/10] Reintroduce Hornet LSM Paul Moore
2026-05-07 21:58 ` Eric Biggers
2026-05-07 22:22 ` Paul Moore
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=20260508023534.E00F4C2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bboscaccy@linux.microsoft.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko@lists.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