From: Jiri Olsa <olsajiri@gmail.com>
To: "Xavier Brouckaert (xabrouck)" <xabrouck@cisco.com>
Cc: "bpf@vger.kernel.org" <bpf@vger.kernel.org>
Subject: Re: BPF: writable uprobe pt_regs context bypasses lockdown=integrity
Date: Mon, 27 Apr 2026 16:09:04 +0200 [thread overview]
Message-ID: <ae9uAHH32FDshyLk@krava> (raw)
In-Reply-To: <DM6PR11MB4722C282C0F20BB23F54A87ADB362@DM6PR11MB4722.namprd11.prod.outlook.com>
On Mon, Apr 27, 2026 at 12:39:33PM +0000, Xavier Brouckaert (xabrouck) wrote:
SNIP
> Suggested fix
> -------------
> Gate writable kprobe/uprobe context behind security_locked_down() at
> the point the verifier permits the store. Two reasonable shapes:
>
> (a) In kprobe_prog_is_valid_access() (kernel/trace/bpf_trace.c),
> when type == BPF_WRITE, call
> security_locked_down(LOCKDOWN_BPF_WRITE_USER) and return false
> if denied. This reuses the existing reason and matches the
> intent ("BPF writing to user state"). One line, adjacent to the
> kprobe_write_ctx flag set.
>
> (b) Introduce a dedicated LOCKDOWN_BPF_WRITE_REGS reason at
> LOCKDOWN_INTEGRITY_MAX scope, for clearer audit messages, and
> check it in the same place.
>
> Either way the check belongs at verify/load time rather than attach
> time, so the program is refused outright rather than attaching as a
> no-op.
>
> Orthogonally, a CONFIG_BPF_UPROBE_OVERRIDE knob (mirroring
> CONFIG_BPF_KPROBE_OVERRIDE for bpf_override_return) would let
> distributions opt out independent of lockdown.
I guess I can feed this to claude and get the fix right away ;-)
makes sense to me to fix this, since we already have LOCKDOWN_BPF_WRITE_USER
and changing user space registers is on the same level
I can check and send the patch, if you don't plan to do it yourself
thanks,
jirka
next prev parent reply other threads:[~2026-04-27 14:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 12:39 BPF: writable uprobe pt_regs context bypasses lockdown=integrity Xavier Brouckaert (xabrouck)
2026-04-27 13:42 ` Greg KH
2026-04-27 13:43 ` Greg KH
2026-04-27 14:09 ` Jiri Olsa [this message]
2026-04-27 14:16 ` Alexei Starovoitov
2026-04-27 14:25 ` Nicolas Bouchinet
2026-04-27 14:56 ` Daniel Borkmann
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=ae9uAHH32FDshyLk@krava \
--to=olsajiri@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=xabrouck@cisco.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.