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
..
2023-12-15 17:06:45 +01:00
2024-06-20 11:52:56 +02:00
2024-04-15 13:42:38 +02:00
2022-11-17 22:49:39 +01:00
2024-06-30 11:29:17 +01:00
2024-07-12 10:11:43 +02:00
2024-09-03 18:19:40 +02:00
2023-08-22 15:13:20 +02:00
2022-08-09 19:51:05 +02:00
2023-04-27 18:49:24 -04:00
2023-12-19 10:37:50 -08:00
2024-09-11 11:23:56 +02:00
2024-07-29 01:19:51 +01:00
2024-02-19 10:58:24 +00:00
2024-02-17 17:00:09 +01:00
2022-11-23 19:55:22 +01:00
2023-06-20 14:28:17 -06:00
2022-11-04 16:56:41 +01:00
2022-08-11 10:31:19 -07:00
2022-12-22 18:18:37 -08:00
2023-03-10 21:05:16 +01:00
2024-08-20 14:02:22 -04:00
2023-05-30 16:42:00 -07:00
2024-08-30 08:22:36 +02:00
2024-02-16 12:42:59 +11:00
2023-11-14 08:16:34 +01:00
2024-02-08 08:41:03 -05:00
2024-09-11 10:45:28 -06:00
2023-07-24 20:11:54 -06:00
2024-10-01 21:40:12 +02:00
2024-07-11 15:33:28 +02:00
2024-03-05 17:13:24 +01:00
2024-02-13 11:47:13 +01:00
2023-06-06 17:05:54 -04:00
2022-09-24 08:50:04 +02:00
2024-08-08 15:23:21 +02:00
2023-07-14 08:43:49 -10:00
2024-05-24 10:36:55 +01:00
2023-04-18 16:39:34 -07:00
2023-10-16 11:38:56 -04:00
2024-04-02 10:49:38 +08:00
2024-04-30 08:48:10 -07:00
2023-01-20 09:33:22 +00:00
2024-04-08 14:10:45 +01:00
2023-07-20 17:24:57 -05:00
2024-06-11 12:57:49 -05:00
2023-03-06 15:49:07 -06:00
2023-03-30 15:57:50 -04:00
2024-06-05 14:52:15 +05:30
2024-08-26 19:21:14 -07:00
2022-08-29 15:32:13 +02:00
2023-08-23 14:17:42 -07:00
2024-09-17 14:46:17 +02:00
2024-08-26 09:33:58 -07:00
2024-08-23 13:04:34 +01:00
2023-06-15 14:55:15 +02:00
2024-02-14 11:01:01 +00:00
2024-09-18 07:40:56 +09:00
2023-04-19 23:39:42 -04:00
2022-11-28 12:46:23 -08:00
2024-08-28 16:53:57 +02:00
2024-03-06 13:13:05 +01:00
2024-01-27 18:08:54 -08:00
2024-09-05 11:39:17 +02:00
2024-09-13 21:15:44 -07:00
2023-06-06 07:54:00 +09:00
2023-03-16 21:20:32 -07:00
2024-07-21 17:15:46 -07:00
2023-09-25 22:34:33 -07:00
2023-08-09 15:43:27 +09:30
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-02-15 08:44:57 +01:00
2023-10-27 09:21:13 +02:00
2024-05-07 01:35:57 +02:00
2023-05-24 22:05:24 -07:00
2023-10-27 18:04:30 +08:00
2022-09-20 11:53:32 +01:00
2024-08-29 10:39:37 +02:00
2023-03-10 21:05:16 +01:00
2024-05-06 11:13:56 +02:00
2023-10-04 13:00:34 +05:30
2022-10-28 12:36:34 +08:00
2023-12-20 11:27:20 +00:00
2022-09-15 09:08:09 +02:00
2024-05-07 01:35:57 +02:00
2022-08-18 20:37:35 -07:00
2024-08-26 09:37:22 -07:00
2024-04-02 18:24:33 -07:00
2022-12-12 09:29:56 +00:00
2024-04-01 10:49:28 +01:00
2024-07-25 11:57:27 +02:00
2024-02-27 18:22:49 -08:00
2024-09-04 16:40:33 -07:00
2024-08-26 09:37:23 -07:00
2024-08-26 09:37:23 -07:00
2024-03-06 13:13:00 +01:00
2024-06-07 11:08:07 +02:00
2024-09-14 08:51:15 -06:00
2024-02-28 11:19:41 +00:00
2024-08-22 10:45:12 +02:00
2023-01-06 19:22:53 -08:00
2024-08-26 12:02:03 -03:00
2023-08-15 10:06:49 -06:00
2023-02-06 09:01:00 +00:00
2022-10-17 09:51:26 -05:00
2023-07-28 13:30:51 -07:00
2023-03-16 15:18:02 +01:00
2024-06-01 07:28:21 +02:00
2024-09-01 20:26:05 -07:00
2024-04-23 14:59:01 +10:00
2024-09-06 17:55:05 -04:00
2024-05-02 16:18:13 -04:00
2024-07-16 09:53:05 -04:00
2022-09-20 09:13:38 +02:00
2024-09-16 23:50:52 +02:00
2024-09-12 20:28:46 -07:00
2024-08-19 22:36:26 -04:00
2022-08-29 10:44:08 +02:00
2024-05-08 17:29:24 -04:00
2024-02-22 13:32:55 +01:00
2024-09-11 20:53:43 -07:00
2024-04-29 14:56:36 +02:00
2023-05-25 16:21:22 +02:00
2023-03-23 17:25:46 +01:00
2023-12-15 17:01:30 +01:00
2023-01-07 11:29:29 +01:00
2023-01-18 17:12:37 -08:00
2024-02-22 10:24:46 -08:00
2024-07-19 20:22:12 +02:00
2024-06-28 14:36:43 +02:00
2023-12-15 12:17:16 +00:00
2024-04-11 08:19:54 -07:00
2024-09-06 08:31:40 -06:00
2022-11-03 20:46:32 -07:00
2024-09-10 16:55:23 -07:00
2024-09-11 20:44:32 -07:00
2022-09-07 16:46:03 +02:00
2023-10-20 11:43:35 +01:00
2024-08-12 17:50:34 -07:00
2024-07-08 13:47:25 -04:00
2024-05-06 12:47:24 -04:00
2024-07-08 14:10:05 -04:00
2024-07-09 11:29:59 +02:00
2023-09-27 09:40:02 +02:00
2024-09-16 11:15:26 +02:00
2023-11-28 19:05:16 +00:00
2024-04-11 15:34:40 +02:00
2024-07-05 17:45:47 -07:00
2024-04-25 12:37:12 -07:00
2023-03-23 12:22:19 +09:00
2024-09-19 14:25:26 -05:00
2023-12-18 11:55:56 +01:00
2024-07-04 16:00:38 +02:00
2024-06-28 10:37:29 +02:00
2024-08-14 20:37:47 -07:00
2024-01-02 14:25:51 +00:00
2023-06-07 14:26:09 -06:00
2022-12-01 03:22:20 +00:00
2024-05-22 09:56:00 -07:00
2024-07-05 17:45:47 -07:00
2023-01-06 17:12:39 +00:00
2023-07-20 22:14:21 +12:00
2024-08-14 13:05:42 -04:00
2024-09-08 18:40:33 +01:00
2023-04-16 14:23:07 +02:00
2023-08-09 09:15:39 +02:00
2024-07-19 20:22:48 +02:00
2023-12-20 19:26:31 -05:00
2024-08-14 16:42:58 +03:00
2023-01-06 19:28:01 -08:00
2023-07-15 11:35:02 -07:00
2022-12-27 12:52:12 +01:00
2023-10-25 18:04:29 -07:00
2024-06-18 10:09:17 -10:00
2023-03-09 11:31:44 +01:00
2023-07-17 16:08:08 -07:00
2023-08-22 11:10:26 -06:00
2022-09-20 12:33:22 +02:00
2023-10-10 08:51:10 +02:00
2023-09-18 11:14:42 +02:00
2024-01-27 18:15:24 -08:00
2024-09-05 20:11:43 +02:00
2024-07-16 11:44:00 -04:00
2023-12-26 20:24:33 +00:00
2024-08-20 11:38:23 +02:00
2024-05-01 10:06:27 +02:00
2024-06-20 15:19:17 -06:00
2024-05-08 00:42:25 -07:00
2022-11-09 14:06:51 +01:00
2023-12-02 01:17:48 +02:00
2023-03-24 16:59:09 -04:00
2023-04-18 16:39:34 -07:00
2024-07-01 09:44:27 +01:00
2024-05-13 14:48:04 -07:00
2022-11-17 11:04:23 -08:00
2024-04-03 14:03:09 +02:00
2023-12-04 10:37:46 +01:00
2022-09-27 17:29:09 -07:00
2023-06-15 13:41:53 +02:00
2024-07-03 16:40:45 -04:00
2023-06-05 09:36:35 +02:00
2024-02-28 18:47:08 -07:00
2024-04-18 11:38:23 +02:00
2024-09-11 20:44:32 -07:00
2024-07-03 12:24:54 +02:00
2022-08-31 09:07:53 +02:00
2024-03-18 10:13:03 -04:00
2023-12-29 11:58:24 -08:00
2023-03-23 17:25:46 +01:00
2023-01-15 23:45:15 +02:00
2022-12-07 17:58:46 +01:00
2024-06-10 10:24:30 +02:00
2022-12-07 17:58:46 +01:00
2024-04-29 14:56:36 +02:00
2024-04-29 14:56:37 +02:00
2024-08-22 16:56:24 -07:00
2024-04-22 17:07:13 -04:00
2022-08-11 04:26:08 -04:00
2024-01-27 18:08:54 -08:00
2023-12-04 14:29:08 -07:00
2023-11-01 09:20:00 -04:00
2024-04-08 04:11:04 -04:00
2024-09-05 20:10:34 +02:00
2023-04-04 11:01:57 -04:00
2024-05-14 10:54:49 -04:00
2023-12-19 11:51:31 -07:00
2024-07-24 20:49:42 +03:00
2024-05-22 08:31:15 -04:00
2024-04-30 10:51:32 +02:00
2024-03-19 02:45:49 -04:00
2024-01-10 13:01:37 -05:00
2022-08-16 01:40:24 -04:00
2024-02-09 14:01:15 +01:00
2023-10-15 13:19:42 +01:00
2023-05-28 19:07:48 -06:00
2024-06-26 13:22:42 +02:00
2024-06-04 08:59:58 +02:00