android_kernel_motorola_sm6375/security
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Daniel Borkmann be5cfab9c4
BACKPORT: bpf: Add lockdown check for probe_write_user helper
commit 51e1bb9eeaf7868db56e58f47848e364ab4c4129 upstream.

Back then, commit 96ae522795 ("bpf: Add bpf_probe_write_user BPF helper
to be called in tracers") added the bpf_probe_write_user() helper in order
to allow to override user space memory. Its original goal was to have a
facility to "debug, divert, and manipulate execution of semi-cooperative
processes" under CAP_SYS_ADMIN. Write to kernel was explicitly disallowed
since it would otherwise tamper with its integrity.

One use case was shown in cf9b1199de ("samples/bpf: Add test/example of
using bpf_probe_write_user bpf helper") where the program DNATs traffic
at the time of connect(2) syscall, meaning, it rewrites the arguments to
a syscall while they're still in userspace, and before the syscall has a
chance to copy the argument into kernel space. These days we have better
mechanisms in BPF for achieving the same (e.g. for load-balancers), but
without having to write to userspace memory.

Of course the bpf_probe_write_user() helper can also be used to abuse
many other things for both good or bad purpose. Outside of BPF, there is
a similar mechanism for ptrace(2) such as PTRACE_PEEK{TEXT,DATA} and
PTRACE_POKE{TEXT,DATA}, but would likely require some more effort.
Commit 96ae522795 explicitly dedicated the helper for experimentation
purpose only. Thus, move the helper's availability behind a newly added
LOCKDOWN_BPF_WRITE_USER lockdown knob so that the helper is disabled under
the "integrity" mode. More fine-grained control can be implemented also
from LSM side with this change.

Fixes: 96ae522795 ("bpf: Add bpf_probe_write_user BPF helper to be called in tracers")
Change-Id: I824213c9e94b9c0c3ce0fe6188ed82ddebab018c
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tashfin Shakeer Rhythm <tashfinshakeerrhythm@gmail.com>
2026-02-01 20:44:42 -08:00
..
apparmor BACKPORT: sysctl: pass kernel pointers to ->proc_handler 2025-12-23 13:36:15 -08:00
bpf UPSTREAM: bpf: Implement bpf_local_storage for inodes 2026-01-14 18:12:21 -08:00
integrity This is the 5.4.291 stable release 2025-03-13 14:53:52 +00:00
keys KEYS: trusted_tpm1: Compare HMAC values in constant time 2025-10-29 14:00:01 +01:00
loadpin
lockdown BACKPORT: bpf: Add lockdown check for probe_write_user helper 2026-02-01 20:44:42 -08:00
safesetid
selinux UPSTREAM: selinux: fix inconsistency between inode_getxattr and inode_listsecurity 2026-01-14 18:13:16 -08:00
smack This is the 5.4.294 stable release 2025-06-05 07:11:21 +00:00
tomoyo tomoyo: don't emit warning in tomoyo_write_control() 2025-03-13 12:43:03 +01:00
yama BACKPORT: sysctl: pass kernel pointers to ->proc_handler 2025-12-23 13:36:15 -08:00
commoncap.c This is the 5.4.224 stable release 2022-11-16 16:18:17 +00:00
device_cgroup.c device_cgroup: Roll back to original exceptions after copy failure 2023-01-18 11:41:50 +01:00
inode.c securityfs: don't pin dentries twice, once is enough... 2025-08-28 16:21:24 +02:00
Kconfig UPSTREAM: bpf: lsm: Initialize the BPF LSM hooks 2026-01-14 18:12:20 -08:00
Kconfig.hardening ANDROID: kernelci build-break for 64-bit riscv clang builds (5.4 only) 2025-01-31 16:42:47 -08:00
lsm_audit.c dump_common_audit_data(): fix racy accesses to ->d_name 2021-01-19 18:26:16 +01:00
Makefile UPSTREAM: bpf: lsm: Initialize the BPF LSM hooks 2026-01-14 18:12:20 -08:00
min_addr.c BACKPORT: sysctl: pass kernel pointers to ->proc_handler 2025-12-23 13:36:15 -08:00
security.c BACKPORT: security: Refactor declaration of LSM hooks 2025-12-23 13:36:10 -08:00