[PATCH] arm: Add KPROBES_ON_FTRACE supported

2024-06-13 Thread Jinjie Ruan
Add support for kprobes on ftrace call sites to avoid much of the overhead with regular kprobes. Try it with simple steps: cd /sys/kernel/debug/tracing/ echo 'p:myprobe sys_clone r0=%r0 r1=%r1 r2=%r2' > kprobe_events echo 1 > events/kprobes/enable echo 1 > events/k

[PATCH v6 1/2] proc: pass file instead of inode to proc_mem_open

2024-06-13 Thread Adrian Ratiu
The file struct is required in proc_mem_open() so its f_mode can be checked when deciding whether to allow or deny /proc/*/mem open requests via the new read/write and foll_force restriction mechanism. Thus instead of directly passing the inode to the fun, we pass the file and get the inode inside

[PATCH v6 2/2] proc: restrict /proc/pid/mem

2024-06-13 Thread Adrian Ratiu
Prior to v2.6.39 write access to /proc//mem was restricted, after which it got allowed in commit 198214a7ee50 ("proc: enable writing to /proc/pid/mem"). Famous last words from that patch: "no longer a security hazard". :) Afterwards exploits started causing drama like [1]. The exploits using /proc