Li Huafei
7b0007b28d
kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case
...
[ Upstream commit 5dd7caf0bdc5d0bae7cf9776b4d739fb09bd5ebb ]
In __unregister_kprobe_top(), if the currently unregistered probe has
post_handler but other child probes of the aggrprobe do not have
post_handler, the post_handler of the aggrprobe is cleared. If this is
a ftrace-based probe, there is a problem. In later calls to
disarm_kprobe(), we will use kprobe_ftrace_ops because post_handler is
NULL. But we're armed with kprobe_ipmodify_ops. This triggers a WARN in
__disarm_kprobe_ftrace() and may even cause use-after-free:
Failed to disarm kprobe-ftrace at kernel_clone+0x0/0x3c0 (error -2)
WARNING: CPU: 5 PID: 137 at kernel/kprobes.c:1135 __disarm_kprobe_ftrace.isra.21+0xcf/0xe0
Modules linked in: testKprobe_007(-)
CPU: 5 PID: 137 Comm: rmmod Not tainted 6.1.0-rc4-dirty #18
[...]
Call Trace:
<TASK>
__disable_kprobe+0xcd/0xe0
__unregister_kprobe_top+0x12/0x150
? mutex_lock+0xe/0x30
unregister_kprobes.part.23+0x31/0xa0
unregister_kprobe+0x32/0x40
__x64_sys_delete_module+0x15e/0x260
? do_user_addr_fault+0x2cd/0x6b0
do_syscall_64+0x3a/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
[...]
For the kprobe-on-ftrace case, we keep the post_handler setting to
identify this aggrprobe armed with kprobe_ipmodify_ops. This way we
can disarm it correctly.
Link: https://lore.kernel.org/all/20221112070000.35299-1-lihuafei1@huawei.com/
Fixes: 0bc11ed5ab ("kprobes: Allow kprobes coexist with livepatch")
Reported-by: Zhao Gongyi <zhaogongyi@huawei.com>
Suggested-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-25 17:42:21 +01:00
..
bpf
bpf: Ensure correct locking around vulnerable function find_vpid()
2022-10-26 13:22:24 +02:00
cgroup
cgroup-v1: add disabled controller check in cgroup1_parse_param()
2022-11-03 23:56:54 +09:00
configs
debug
lockdown: also lock down previous kgdb use
2022-06-06 08:33:48 +02:00
dma
dma-debug: make things less spammy under memory pressure
2022-06-22 14:11:19 +02:00
events
perf/core: Fix data race between perf_event_set_output() and perf_mmap_close()
2022-07-29 17:14:10 +02:00
gcov
gcov: support GCC 12.1 and newer compilers
2022-10-26 13:22:20 +02:00
irq
genirq: Don't return error on missing optional irq_request_resources()
2022-08-25 11:17:29 +02:00
livepatch
livepatch: fix race between fork and KLP transition
2022-10-26 13:22:18 +02:00
locking
locking/lockdep: Avoid RCU-induced noinstr fail
2021-11-17 09:48:28 +01:00
power
PM: hibernate: Allow hybrid sleep to work with s2idle
2022-11-03 23:56:55 +09:00
printk
printk: fix return value of printk.devkmsg __setup handler
2022-04-15 14:18:08 +02:00
rcu
rcu: Don't deboost before reporting expedited quiescent state
2022-03-28 08:46:48 +02:00
sched
sched/deadline: Fix priority inheritance with multiple scheduling classes
2022-09-05 10:27:39 +02:00
time
timekeeping: contribute wall clock to rng on time change
2022-08-25 11:18:15 +02:00
trace
ring-buffer: Include dropped pages in counting dirty patches
2022-11-25 17:42:20 +01:00
.gitignore
kbuild: update config_data.gz only when the content of .config is changed
2021-05-11 14:04:16 +02:00
acct.c
async.c
Revert "module, async: async_synchronize_full() on module init iff async is used"
2022-02-23 11:59:56 +01:00
audit.c
audit: improve audit queue handling when "audit=1" on cmdline
2022-02-08 18:24:26 +01:00
audit.h
audit: log AUDIT_TIME_* records only from rules
2022-04-15 14:18:04 +02:00
audit_fsnotify.c
audit: fix potential double free on error path from fsnotify_add_inode_mark
2022-09-05 10:27:38 +02:00
audit_tree.c
audit: move put_tree() to avoid trim_trees refcount underflow and UAF
2021-09-03 10:08:16 +02:00
audit_watch.c
audit: CONFIG_CHANGE don't log internal bookkeeping as an event
2020-10-01 13:17:32 +02:00
auditfilter.c
audit: fix a net reference leak in audit_list_rules_send()
2020-06-22 09:30:59 +02:00
auditsc.c
audit: log AUDIT_TIME_* records only from rules
2022-04-15 14:18:04 +02:00
backtracetest.c
bounds.c
capability.c
compat.c
configs.c
context_tracking.c
cpu.c
random: clear fast pool, crng, and batches in cpuhp bring up
2022-06-22 14:11:12 +02:00
cpu_pm.c
kernel/cpu_pm: Fix uninitted local in cpu_pm
2020-06-22 09:31:22 +02:00
crash_core.c
crash_dump.c
cred.c
delayacct.c
dma.c
exec_domain.c
exit.c
don't dump the threads that had been already exiting when zapped.
2020-11-18 19:20:31 +01:00
extable.c
fail_function.c
fail_function: Remove a redundant mutex unlock
2020-11-24 13:29:18 +01:00
fork.c
copy_process(): Move fd_install() out of sighand->siglock critical section
2022-02-23 12:00:00 +01:00
freezer.c
futex.c
mm, futex: fix shared futex pgoff on shmem huge page
2021-06-30 08:47:55 -04:00
gen_kheaders.sh
kbuild: add variables for compression tools
2020-09-03 11:27:10 +02:00
groups.c
hung_task.c
iomem.c
irq_work.c
jump_label.c
kallsyms.c
kallsyms: Refactor kallsyms_show_value() to take cred
2020-07-16 08:16:44 +02:00
kcmp.c
exec: Transform exec_update_mutex into a rw_semaphore
2021-01-09 13:44:55 +01:00
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
kcov.c
kexec.c
kexec_core.c
kernel: kexec: remove the lock operation of system_transition_mutex
2021-02-03 23:25:56 +01:00
kexec_elf.c
kexec_file.c
kexec_file: drop weak attribute from arch_kexec_apply_relocations[_add]
2022-07-02 16:28:50 +02:00
kexec_internal.h
kheaders.c
kmod.c
kprobes.c
kprobes: Skip clearing aggrprobe's post_handler in kprobe-on-ftrace case
2022-11-25 17:42:21 +01:00
ksysfs.c
kthread.c
kthread: Fix PF_KTHREAD vs to_kthread() race
2021-09-12 08:56:39 +02:00
latencytop.c
Makefile
kbuild: update config_data.gz only when the content of .config is changed
2021-05-11 14:04:16 +02:00
module-internal.h
module.c
module/ftrace: handle patchable-function-entry
2022-02-23 11:59:56 +01:00
module_signature.c
module: harden ELF info handling
2021-04-07 14:47:38 +02:00
module_signing.c
module: harden ELF info handling
2021-04-07 14:47:38 +02:00
notifier.c
kernel/notifier.c: intercept duplicate registrations to avoid infinite loops
2020-10-01 13:17:23 +02:00
nsproxy.c
padata.c
padata: add separate cpuhp node for CPUHP_PADATA_DEAD
2020-06-17 16:40:22 +02:00
panic.c
params.c
pid.c
pid_namespace.c
memcg: enable accounting for pids in nested pid namespaces
2021-09-22 12:26:37 +02:00
profile.c
profiling: fix shift too large makes kernel panic
2022-08-25 11:18:02 +02:00
ptrace.c
ptrace: Reimplement PTRACE_KILL by always sending SIGKILL
2022-06-14 18:11:24 +02:00
range.c
reboot.c
reboot: fix overflow parsing reboot cpu number
2020-11-18 19:20:30 +01:00
relay.c
kernel/relay.c: fix memleak on destroy relay channel
2020-08-26 10:40:51 +02:00
resource.c
/dev/mem: Revoke mappings when a driver claims the region
2020-06-24 17:50:35 +02:00
rseq.c
seccomp.c
seccomp: Invalidate seccomp mode to catch death failures
2022-02-16 12:52:53 +01:00
signal.c
signal handling: don't use BUG_ON() for debugging
2022-07-21 20:59:27 +02:00
smp.c
smp: Fix offline cpu check in flush_smp_call_function_queue()
2022-04-20 09:19:39 +02:00
smpboot.c
kthread: Extract KTHREAD_IS_PER_CPU
2021-02-07 15:35:49 +01:00
smpboot.h
softirq.c
stackleak.c
stacktrace.c
stop_machine.c
sys.c
prctl: allow to setup brk for et_dyn executables
2021-09-26 14:07:08 +02:00
sys_ni.c
kernel/sys_ni: add compat entry for fadvise64_64
2022-09-05 10:27:38 +02:00
sysctl-test.c
kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()
2020-10-01 13:17:10 +02:00
sysctl.c
mm: sysctl: fix missing numa_stat when !CONFIG_HUGETLB_PAGE
2022-07-21 20:59:24 +02:00
sysctl_binary.c
task_work.c
taskstats.c
test_kprobes.c
torture.c
tracepoint.c
tracepoint: Add tracepoint_probe_register_may_exist() for BPF tracing
2021-07-14 16:53:08 +02:00
tsacct.c
taskstats: Cleanup the use of task->exit_code
2022-02-23 11:59:57 +01:00
ucount.c
uid16.c
uid16.h
umh.c
usermodehelper: reset umask to default before executing user process
2020-10-14 10:32:58 +02:00
up.c
smp: Fix smp_call_function_single_async prototype
2021-05-14 09:44:33 +02:00
user-return-notifier.c
user.c
user_namespace.c
utsname.c
utsname_sysctl.c
watchdog.c
watchdog: export lockup_detector_reconfigure
2022-08-25 11:18:37 +02:00
watchdog_hld.c
workqueue.c
workqueue: don't skip lockdep work dependency in cancel_work_sync()
2022-09-28 11:04:09 +02:00
workqueue_internal.h