android_kernel_motorola_sm6375/kernel/trace
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jiri Olsa 75696eea7d
UPSTREAM: bpf: Disable preemption in bpf_event_output
commit d62cc390c2e99ae267ffe4b8d7e2e08b6c758c32 upstream.

We received report [1] of kernel crash, which is caused by
using nesting protection without disabled preemption.

The bpf_event_output can be called by programs executed by
bpf_prog_run_array_cg function that disabled migration but
keeps preemption enabled.

This can cause task to be preempted by another one inside the
nesting protection and lead eventually to two tasks using same
perf_sample_data buffer and cause crashes like:

  BUG: kernel NULL pointer dereference, address: 0000000000000001
  #PF: supervisor instruction fetch in kernel mode
  #PF: error_code(0x0010) - not-present page
  ...
  ? perf_output_sample+0x12a/0x9a0
  ? finish_task_switch.isra.0+0x81/0x280
  ? perf_event_output+0x66/0xa0
  ? bpf_event_output+0x13a/0x190
  ? bpf_event_output_data+0x22/0x40
  ? bpf_prog_dfc84bbde731b257_cil_sock4_connect+0x40a/0xacb
  ? xa_load+0x87/0xe0
  ? __cgroup_bpf_run_filter_sock_addr+0xc1/0x1a0
  ? release_sock+0x3e/0x90
  ? sk_setsockopt+0x1a1/0x12f0
  ? udp_pre_connect+0x36/0x50
  ? inet_dgram_connect+0x93/0xa0
  ? __sys_connect+0xb4/0xe0
  ? udp_setsockopt+0x27/0x40
  ? __pfx_udp_push_pending_frames+0x10/0x10
  ? __sys_setsockopt+0xdf/0x1a0
  ? __x64_sys_connect+0xf/0x20
  ? do_syscall_64+0x3a/0x90
  ? entry_SYSCALL_64_after_hwframe+0x72/0xdc

Fixing this by disabling preemption in bpf_event_output.

[1] https://github.com/cilium/cilium/issues/26756
Cc: stable@vger.kernel.org
Reported-by: Oleg "livelace" Popov <o.popov@livelace.ru>
Closes: https://github.com/cilium/cilium/issues/26756
Fixes: 2a916f2f546c ("bpf: Use migrate_disable/enable in array macros and cgroup/lirc code.")
Acked-by: Hou Tao <houtao1@huawei.com>
Change-Id: Icaf207af7dfb071f0adb10fe9bb7f367e25c1860
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20230725084206.580930-3-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@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:46 -08:00
..
blktrace.c UPSTREAM: cgroup: use cgrp->kn->id as the cgroup ID 2025-12-23 13:36:09 -08:00
bpf_trace.c UPSTREAM: bpf: Disable preemption in bpf_event_output 2026-02-01 20:44:46 -08:00
bpf_trace.h UPSTREAM: bpf: Use dedicated bpf_trace_printk event instead of trace_printk() 2026-02-01 20:44:43 -08:00
fgraph.c
ftrace.c ftrace: Let ftrace_enable_sysctl take a kernel pointer buffer 2026-02-01 20:38:01 -08:00
ftrace_internal.h
ipc_logging.c
ipc_logging_debug.c
ipc_logging_private.h
Kconfig UPSTREAM: ftrace: Add register_ftrace_direct() 2025-12-23 13:35:45 -08:00
Makefile UPSTREAM: bpf: Use dedicated bpf_trace_printk event instead of trace_printk() 2026-02-01 20:44:43 -08:00
msm_rtb.c
power-traces.c
preemptirq_delay_test.c tracing: Add MODULE_DESCRIPTION() to preemptirq_delay_test 2024-07-05 09:08:25 +02:00
preemptirq_long.c
ring_buffer.c This is the 5.4.292 stable release 2025-04-11 08:16:05 +00:00
ring_buffer_benchmark.c
rpm-traces.c
trace.c UPSTREAM: module: Fix up module_notifier return values 2026-01-14 18:12:53 -08:00
trace.h
trace_benchmark.c
trace_benchmark.h
trace_branch.c
trace_clock.c tracing: Use atomic64_inc_return() in trace_clock_counter() 2024-12-14 19:44:53 +01:00
trace_dynevent.c
trace_dynevent.h
trace_entries.h
trace_event_perf.c Merge 5.4.287 into android11-5.4-lts 2024-12-16 10:50:16 +00:00
trace_events.c UPSTREAM: module: Fix up module_notifier return values 2026-01-14 18:12:53 -08:00
trace_events_filter.c
trace_events_filter_test.h
trace_events_hist.c Merge branch 'android11-5.4-lts' of https://android.googlesource.com/kernel/common into android13-5.4-lahaina 2025-12-11 01:41:51 -08:00
trace_events_trigger.c Revert "tracing/trigger: Fix to return error if failed to alloc snapshot" 2024-05-02 16:18:30 +02:00
trace_export.c
trace_functions.c
trace_functions_graph.c tracing: Fix use-after-free in print_graph_function_flags during tracer switching 2025-04-10 14:29:43 +02:00
trace_hwlat.c
trace_irqsoff.c Merge tag 'ASB-2025-05-05_11-5.4' of https://android.googlesource.com/kernel/common into android13-5.4-lahaina 2025-05-18 08:00:20 +00:00
trace_kdb.c
trace_kprobe.c BACKPORT: maccess: rename probe_user_{read,write} to copy_{from,to}_user_nofault 2026-01-14 18:13:22 -08:00
trace_kprobe_selftest.c
trace_kprobe_selftest.h
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Remove precision vsnprintf() check from print event 2024-11-08 16:20:43 +01:00
trace_output.h
trace_preemptirq.c
trace_printk.c UPSTREAM: module: Fix up module_notifier return values 2026-01-14 18:12:53 -08:00
trace_probe.c tracing: Consider the NULL character when validating the event length 2024-11-08 16:20:51 +01:00
trace_probe.h tracing: Fix race condition in kprobe initialization causing NULL pointer dereference 2025-10-29 13:59:55 +01:00
trace_probe_tmpl.h
trace_sched_switch.c
trace_sched_wakeup.c tracing: Fix use-after-free in print_graph_function_flags during tracer switching 2025-04-10 14:29:43 +02:00
trace_selftest.c
trace_selftest_dynamic.c
trace_seq.c
trace_stack.c trace: fix an incorrect __user annotation on stack_trace_sysctl 2026-02-01 20:36:42 -08:00
trace_stat.c
trace_stat.h
trace_syscalls.c
trace_uprobe.c Merge tag 'ASB-2025-12-01_11-5.4' of https://android.googlesource.com/kernel/common into android13-5.4-lahaina 2025-12-04 19:21:35 +02:00
tracing_map.c tracing: Fix cmp_entries_dup() to respect sort() comparison rules 2024-12-14 19:44:48 +01:00
tracing_map.h