summaryrefslogtreecommitdiff
path: root/include/linux/debugobjects.h
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-11-02 16:11:04 +0900
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>2026-11-06 12:22:22 +0900
commit07038c33e791e80c6422c26211fcb9c751439f34 (patch)
tree589137ba7af63b7420d8ae70ef3a6b2c38a23002 /include/linux/debugobjects.h
parenta553b499f22bf054964d4fd16d136f3d4f836c23 (diff)
samples/kprobes: Use trace_printk() in probe handlers
Probe handlers execute in atomic/non-preemptible contexts. Furthermore, unless hit via an unoptimized breakpoint on certain architectures, they do not run with in_nmi() set (e.g. jump-optimized kprobes, ftrace-based kprobes, or kretprobe return handlers). Calling printk() from probe handlers can directly attempt to acquire console and scheduler locks (via console_unlock()), risking a deadlock if the probed context or interrupted code already holds one of those locks. Replace printk() (pr_info) in handler_pre(), handler_post(), and ret_handler() with trace_printk(), and update the comments to direct users to /sys/kernel/tracing/trace. Also update the stack backtrace comment in kprobe_example to reference trace_dump_stack(0). Also fix a minor format string typo ("p->addr," -> "p->addr =") in the S390 pre and post handlers while touching those lines. Additionally, update CONFIG_SAMPLE_KPROBES in samples/Kconfig to depend on EVENT_TRACING so that the tracing subsystem is enabled when building the samples. Link: https://lore.kernel.org/all/179360346488.115681.12990812332058260390.stgit@devnote2/ Reported-by: Tiezhu Yang <yangtiezhu@loongson.cn> Closes: https://lore.kernel.org/all/d179086d-78d8-d0e3-e113-9072cffa55f4@loongson.cn/ Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions