From: sashiko-bot@kernel.org
To: "Blaise Boscaccy" <bboscaccy@linux.microsoft.com>
Cc: bpf@vger.kernel.org
Subject: Re: [v6 09/10] selftests/hornet: Add a selftest for the Hornet LSM
Date: Wed, 29 Apr 2026 23:57:33 +0000 [thread overview]
Message-ID: <20260429235734.65395C19425@smtp.kernel.org> (raw)
In-Reply-To: <20260429191431.2345448-10-bboscaccy@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [Medium] Makefile targets lack `$(OUTPUT)/` prefix, breaking out-of-tree builds.
- [Medium] Makefile hardcodes host architecture and kernel paths, breaking cross-compilation.
- [Medium] Makefile has an unconditional build dependency on kernel cryptographic signing keys.
- [Medium] BPF program uses `bpf_probe_read_str()` for a user-space pointer.
- [Medium] BPF program uses `BPF_CORE_READ()` to access tracepoint context fields.
--
commit 1e13c1e9492cd70a4a039a9763aae8236928bf0c
Author: Blaise Boscaccy <bboscaccy@linux.microsoft.com>
selftests/hornet: Add a selftest for the Hornet LSM
This selftest contains a testcase that utilizes light skeleton eBPF
loaders and exercises hornet's map validation.
> diff --git a/tools/testing/selftests/hornet/Makefile b/tools/testing/selftests/hornet/Makefile
> new file mode 100644
> index 000000000000..432bce59f54e
> --- /dev/null
> +++ b/tools/testing/selftests/hornet/Makefile
[ ... ]
> +BPF_CFLAGS := -target bpf \
> + -D__TARGET_ARCH_$(ARCH) \
> + -I/usr/include/$(shell uname -m)-linux-gnu \
Does this hardcoded include path break cross-compilation? If building for
arm64 on an x86 host, it looks like this will pull in x86 headers instead
of the target architecture headers.
> + $(KHDR_INCLUDES)
> +
> +vmlinux.h:
> + $(BPFTOOL) btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h
Does this hardcode the host kernel's BTF? This will fail in build
environments where the host kernel lacks BTF, or when cross-compiling
where the target kernel's built BTF ($(objtree)/vmlinux) should be used.
Also, shouldn't custom build rules like this use the $(OUTPUT)/ prefix?
Since this Makefile includes ../lib.mk, items in TEST_GEN_PROGS and
TEST_GEN_FILES are prefixed with $(OUTPUT)/. When building out-of-tree
(make O=dir), make might fail to match the expected $(OUTPUT)/ targets
for vmlinux.h, trivial.bpf.o, loader.h, and the other explicit rules.
> +
> +trivial.bpf.o: trivial.bpf.c vmlinux.h
> + $(CLANG) $(CFLAGS) $(BPF_CFLAGS) -c $< -o $@
> +
> +loader.h: trivial.bpf.o
> + $(BPFTOOL) gen skeleton -S -k $(CERTDIR)/signing_key.pem -i $(CERTDIR)/signing_key.x509 \
Does this create an unconditional dependency on kernel cryptographic signing
keys? If the target kernel configuration disables module signing or other
features that generate these specific keys, the files won't exist and the
build might fail unconditionally instead of gracefully skipping.
> + -L $< name trivial > $@
[ ... ]
> diff --git a/tools/testing/selftests/hornet/trivial.bpf.c b/tools/testing/selftests/hornet/trivial.bpf.c
> new file mode 100644
> index 000000000000..d38c5b53ff93
> --- /dev/null
> +++ b/tools/testing/selftests/hornet/trivial.bpf.c
[ ... ]
> +SEC("tracepoint/syscalls/sys_enter_unlinkat")
> +int handle_enter_unlink(struct trace_event_raw_sys_enter *ctx)
> +{
> + char filename[128] = { 0 };
> + struct task_struct *task;
> + unsigned long start_time = 0;
> + int pid = bpf_get_current_pid_tgid() >> 32;
> + char *pathname_ptr = (char *) BPF_CORE_READ(ctx, args[1]);
Should tracepoint arguments be accessed directly (e.g., ctx->args[1])
instead of using BPF_CORE_READ()?
Passing the verifier-translated tracepoint context pointer (PTR_TO_CTX)
to memory-reading helpers (which BPF_CORE_READ expands to) is an
anti-pattern that defeats direct memory access optimizations and can
lead to verifier rejection.
> +
> + bpf_probe_read_str(filename, sizeof(filename), pathname_ptr);
Will this fail to read the user-space pointer? On architectures with strict
user/kernel memory separation (like x86 with SMAP), bpf_probe_read_str()
cannot read user memory. Would bpf_probe_read_user_str() be more
appropriate here?
> + task = (struct task_struct *)bpf_get_current_task();
> + start_time = BPF_CORE_READ(task, start_time);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260429191431.2345448-1-bboscaccy@linux.microsoft.com?part=9
next prev parent reply other threads:[~2026-04-29 23:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-29 19:14 [v6 00/10] Reintroduce Hornet LSM Blaise Boscaccy
2026-04-29 19:14 ` [v6 01/10] crypto: pkcs7: add flag for validated trust on a signed info block Blaise Boscaccy
2026-04-29 21:20 ` sashiko-bot
2026-04-29 19:14 ` [v6 02/10] crypto: pkcs7: add ability to extract signed attributes by OID Blaise Boscaccy
2026-04-29 21:42 ` sashiko-bot
2026-04-29 19:14 ` [v6 03/10] crypto: pkcs7: add tests for pkcs7_get_authattr Blaise Boscaccy
2026-04-29 22:03 ` sashiko-bot
2026-04-29 19:14 ` [v6 04/10] lsm: framework for BPF integrity verification Blaise Boscaccy
2026-04-29 22:24 ` sashiko-bot
2026-04-29 19:14 ` [v6 05/10] lsm: security: Add additional enum values for bpf integrity checks Blaise Boscaccy
2026-04-29 19:14 ` [v6 06/10] security: Hornet LSM Blaise Boscaccy
2026-04-29 23:18 ` sashiko-bot
2026-04-29 19:14 ` [v6 07/10] hornet: Introduce gen_sig Blaise Boscaccy
2026-04-29 23:32 ` sashiko-bot
2026-04-29 19:14 ` [v6 08/10] hornet: Add a light skeleton data extractor scripts Blaise Boscaccy
2026-04-29 23:47 ` sashiko-bot
2026-04-29 19:14 ` [v6 09/10] selftests/hornet: Add a selftest for the Hornet LSM Blaise Boscaccy
2026-04-29 23:57 ` sashiko-bot [this message]
2026-04-29 19:14 ` [v6 10/10] ipe: Add BPF program load policy enforcement via Hornet integration Blaise Boscaccy
2026-04-30 0:31 ` sashiko-bot
2026-05-04 23:52 ` Fan Wu
2026-05-07 19:19 ` [v6 00/10] Reintroduce Hornet LSM Paul Moore
2026-05-08 18:03 ` Blaise Boscaccy
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=20260429235734.65395C19425@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