Files
linux/include/uapi/linux
Toke Høiland-Jørgensen 09d88791c7 bpf: Make sure internal and UAPI bpf_redirect flags don't overlap
The bpf_redirect_info is shared between the SKB and XDP redirect paths,
and the two paths use the same numeric flag values in the ri->flags
field (specifically, BPF_F_BROADCAST == BPF_F_NEXTHOP). This means that
if skb bpf_redirect_neigh() is used with a non-NULL params argument and,
subsequently, an XDP redirect is performed using the same
bpf_redirect_info struct, the XDP path will get confused and end up
crashing, which syzbot managed to trigger.

With the stack-allocated bpf_redirect_info, the structure is no longer
shared between the SKB and XDP paths, so the crash doesn't happen
anymore. However, different code paths using identically-numbered flag
values in the same struct field still seems like a bit of a mess, so
this patch cleans that up by moving the flag definitions together and
redefining the three flags in BPF_F_REDIRECT_INTERNAL to not overlap
with the flags used for XDP. It also adds a BUILD_BUG_ON() check to make
sure the overlap is not re-introduced by mistake.

Fixes: e624d4ed4a ("xdp: Extend xdp_redirect_map with broadcast support")
Reported-by: syzbot+cca39e6e84a367a7e6f6@syzkaller.appspotmail.com
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Closes: https://syzkaller.appspot.com/bug?extid=cca39e6e84a367a7e6f6
Link: https://lore.kernel.org/bpf/20240920125625.59465-1-toke@redhat.com
2024-10-01 21:40:12 +02:00
..
2024-04-15 13:42:38 +02:00
2022-08-11 10:31:19 -07:00
2024-08-20 14:02:22 -04:00
2023-01-20 09:33:22 +00:00
2024-04-08 14:10:45 +01:00
2024-06-11 12:57:49 -05:00
2023-03-16 21:20:32 -07:00
2024-09-04 16:51:11 +02:00
2023-09-21 19:22:05 +02:00
2022-08-10 13:49:50 +01:00
2024-05-07 01:35:57 +02:00
2024-08-29 10:39:37 +02:00
2024-05-07 01:35:57 +02:00
2024-04-01 10:49:28 +01:00
2024-08-26 09:37:23 -07:00
2024-08-26 09:37:23 -07:00
2024-08-26 12:02:03 -03:00
2024-06-01 07:28:21 +02:00
2024-09-01 20:26:05 -07:00
2022-09-20 09:13:38 +02:00
2024-09-16 23:50:52 +02:00
2024-08-19 22:36:26 -04:00
2023-12-15 17:01:30 +01:00
2024-09-06 08:31:40 -06:00
2024-09-11 20:44:32 -07:00
2022-09-07 16:46:03 +02:00
2024-08-12 17:50:34 -07:00
2023-11-28 19:05:16 +00:00
2024-09-19 14:25:26 -05:00
2023-12-20 19:26:31 -05:00
2022-11-17 11:04:23 -08:00
2022-09-27 17:29:09 -07:00
2023-06-05 09:36:35 +02:00
2024-02-28 18:47:08 -07:00
2023-12-29 11:58:24 -08:00
2023-03-23 17:25:46 +01:00
2024-04-22 17:07:13 -04:00