Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.12.y] Backport request: 49b18315be4e ("bpf: Add NULL check for dynptr in bpf_verify_pkcs7_signature")
@ 2026-11-19  5:55 梓川咲太
  2026-11-19 16:08 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: 梓川咲太 @ 2026-11-19  5:55 UTC (permalink / raw)
  To: stable; +Cc: bpf, gregkh, sashal

Hi Stable Maintainers,

Please consider backporting upstream commit:

  49b18315be4e590fae0fc39c87d46c87e9ec903c ("bpf: Add NULL check for
dynptr in bpf_verify_pkcs7_signature")

to linux-6.12.y.

In v6.12.118, bpf_verify_pkcs7_signature() dereferences data_ptr->data
without checking whether the dynptr is empty/null, which allows an attached
eBPF program to trigger a NULL pointer dereference in kernel space.

Upstream commit 49b18315be4e applies to kernel/bpf/helpers.c, whereas in
v6.12.118 this function resides in kernel/trace/bpf_trace.c:1403. The patch
logic is identical.

Verified on x86_64 QEMU v6.12.118: passing an uninitialized/empty dynptr to
bpf_verify_pkcs7_signature() loads cleanly under lsm.s/file_open pre-patch;
with this check backported, the verifier/helper rejects it safely.

Fixes: e917c6999a09 ("bpf: Add bpf_verify_pkcs7_signature() kfunc")
Signed-off-by: BoBppy <inkxiao12@gmail.com>
---
 kernel/trace/bpf_trace.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1384,8 +1384,12 @@ __bpf_kfunc int
bpf_verify_pkcs7_signature(struct bpf_dynptr *data_p,

  data_len = __bpf_dynptr_size(data_ptr);
  data = __bpf_dynptr_data(data_ptr, data_len);
+ if (!data)
+ return -EINVAL;
+
  sig_len = __bpf_dynptr_size(sig_ptr);
  sig = __bpf_dynptr_data(sig_ptr, sig_len);
+ if (!sig)
+ return -EINVAL;

  return verify_pkcs7_signature(data, data_len, sig, sig_len,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 16:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  5:55 [PATCH 6.12.y] Backport request: 49b18315be4e ("bpf: Add NULL check for dynptr in bpf_verify_pkcs7_signature") 梓川咲太
2026-11-19 16:08 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox