linux-stable/kernel/trace
Jiri Olsa d72bc08770 bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT
[ Upstream commit c09eb2e578 ]

Martynas reported bpf_get_func_ip returning +4 address when
CONFIG_X86_KERNEL_IBT option is enabled.

When CONFIG_X86_KERNEL_IBT is enabled we'll have endbr instruction
at the function entry, which screws return value of bpf_get_func_ip()
helper that should return the function address.

There's short term workaround for kprobe_multi bpf program made by
Alexei [1], but we need this fixup also for bpf_get_attach_cookie,
that returns cookie based on the entry_ip value.

Moving the fixup in the fprobe handler, so both bpf_get_func_ip
and bpf_get_attach_cookie get expected function address when
CONFIG_X86_KERNEL_IBT option is enabled.

Also renaming kprobe_multi_link_handler entry_ip argument to fentry_ip
so it's clearer this is an ftrace __fentry__ ip.

[1] commit 7f0059b58f ("selftests/bpf: Fix kprobe_multi test.")

Cc: Peter Zijlstra <peterz@infradead.org>
Reported-by: Martynas Pumputis <m@lambda.lt>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220926153340.1621984-5-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-24 09:58:15 +02:00
..
Kconfig ftrace: Be more specific about arch impact when function tracer is enabled 2022-07-12 16:36:34 -04:00
Makefile tracing: Disable kcov on trace_preemptirq.c 2022-05-26 21:13:00 -04:00
blktrace.c blktrace: Trace remapped requests correctly 2022-08-17 15:14:17 +02:00
bpf_trace.c bpf: Adjust kprobe_multi entry_ip for CONFIG_X86_KERNEL_IBT 2022-10-24 09:58:15 +02:00
bpf_trace.h
error_report-traces.c
fgraph.c arm64 fixes for 5.19-rc1: 2022-06-03 14:05:34 -07:00
fprobe.c fprobe: Resolve symbols with ftrace_lookup_symbols 2022-05-10 14:42:06 -07:00
ftrace.c ftrace: Still disable enabled records marked as disabled 2022-10-24 09:56:56 +02:00
ftrace_internal.h
kprobe_event_gen_test.c tracing: kprobe: Make gen test module work in arm and riscv 2022-10-24 09:58:06 +02:00
pid_list.c tracing: Cleanup double word in comment 2022-04-26 17:58:50 -04:00
pid_list.h
power-traces.c
preemptirq_delay_test.c
rethook.c rethook: Reject getting a rethook if RCU is not watching 2022-06-17 21:53:35 +02:00
ring_buffer.c ring-buffer: Fix race between reset page and reading page 2022-10-24 09:56:57 +02:00
ring_buffer_benchmark.c
rpm-traces.c
synth_event_gen_test.c
trace.c tracing: Do not free snapshot if tracer is on cmdline 2022-10-24 09:56:58 +02:00
trace.h tracing: Have existing event_command.parse() implementations use helpers 2022-04-26 17:58:50 -04:00
trace_benchmark.c
trace_benchmark.h
trace_boot.c tracing: Initialize integer variable to prevent garbage return value 2022-05-26 21:13:00 -04:00
trace_branch.c
trace_clock.c
trace_dynevent.c tracing: Use trace_create_file() to simplify creation of tracefs entries 2022-05-26 21:12:52 -04:00
trace_dynevent.h
trace_entries.h
trace_eprobe.c tracing: Move duplicate code of trace_kprobe/eprobe.c into header 2022-10-24 09:56:58 +02:00
trace_event_perf.c tracing/perf: Fix double put of trace event when init fails 2022-08-25 11:45:09 +02:00
trace_events.c tracing: Have filter accept "common_cpu" to be consistent 2022-08-25 11:45:10 +02:00
trace_events_filter.c tracing: Fix comments of create_filter() 2022-05-26 21:13:01 -04:00
trace_events_filter_test.h
trace_events_hist.c tracing/histograms: Fix memory leak problem 2022-07-12 16:35:42 -04:00
trace_events_inject.c
trace_events_synth.c tracing: Fix reading strings from synthetic events 2022-10-24 09:56:58 +02:00
trace_events_trigger.c tracing: Fix to check event_mutex is held while accessing trigger list 2022-09-15 10:47:10 +02:00
trace_events_user.c tracing: mark user_events as BROKEN 2022-04-02 10:32:14 -07:00
trace_export.c
trace_functions.c
trace_functions_graph.c
trace_hwlat.c
trace_irqsoff.c
trace_kdb.c
trace_kprobe.c tracing: Move duplicate code of trace_kprobe/eprobe.c into header 2022-10-24 09:56:58 +02:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_osnoise.c tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads 2022-10-24 09:58:06 +02:00
trace_output.c tracing: Remove usage of list iterator after the loop body 2022-04-27 17:19:30 -04:00
trace_output.h
trace_preemptirq.c tracing: hold caller_addr to hardirq_{enable,disable}_ip 2022-09-15 10:47:10 +02:00
trace_printk.c
trace_probe.c tracing/probes: Have kprobes and uprobes use $COMM too 2022-08-25 11:45:10 +02:00
trace_probe.h
trace_probe_kernel.h tracing: Add "(fault)" name injection to kernel probes 2022-10-24 09:56:58 +02:00
trace_probe_tmpl.h
trace_recursion_record.c tracing: Use trace_create_file() to simplify creation of tracefs entries 2022-05-26 21:12:52 -04:00
trace_sched_switch.c sched/tracing: Append prev_state to tp args instead 2022-05-12 00:37:11 +02:00
trace_sched_wakeup.c sched/tracing: Append prev_state to tp args instead 2022-05-12 00:37:11 +02:00
trace_selftest.c tracing: Reset the function filter after completing trampoline/graph selftest 2022-05-25 16:57:37 -04:00
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c
trace_stat.c
trace_stat.h
trace_synth.h
trace_syscalls.c tracing: Make tp_printk work on syscall tracepoints 2022-04-26 17:58:52 -04:00
trace_uprobe.c tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() 2022-06-17 19:12:07 -04:00
tracing_map.c tracing: Fix tracing_map_sort_entries() kernel-doc comment 2022-04-26 17:58:51 -04:00
tracing_map.h