Maciej Fijalkowski
c5114710c8
xsk: fix usage of multi-buffer BPF helpers for ZC XDP
Currently when packet is shrunk via bpf_xdp_adjust_tail() and memory
type is set to MEM_TYPE_XSK_BUFF_POOL, null ptr dereference happens:
[1136314.192256] BUG: kernel NULL pointer dereference, address:
0000000000000034
[1136314.203943] #PF: supervisor read access in kernel mode
[1136314.213768] #PF: error_code(0x0000) - not-present page
[1136314.223550] PGD 0 P4D 0
[1136314.230684] Oops: 0000 [#1] PREEMPT SMP NOPTI
[1136314.239621] CPU: 8 PID: 54203 Comm: xdpsock Not tainted 6.6.0+ #257
[1136314.250469] Hardware name: Intel Corporation S2600WFT/S2600WFT,
BIOS SE5C620.86B.02.01.0008.031920191559 03/19/2019
[1136314.265615] RIP: 0010:__xdp_return+0x6c/0x210
[1136314.274653] Code: ad 00 48 8b 47 08 49 89 f8 a8 01 0f 85 9b 01 00 00 0f 1f 44 00 00 f0 41 ff 48 34 75 32 4c 89 c7 e9 79 cd 80 ff 83 fe 03 75 17 <f6> 41 34 01 0f 85 02 01 00 00 48 89 cf e9 22 cc 1e 00 e9 3d d2 86
[1136314.302907] RSP: 0018:ffffc900089f8db0 EFLAGS: 00010246
[1136314.312967] RAX: ffffc9003168aed0 RBX: ffff8881c3300000 RCX:
0000000000000000
[1136314.324953] RDX: 0000000000000000 RSI: 0000000000000003 RDI:
ffffc9003168c000
[1136314.336929] RBP: 0000000000000ae0 R08: 0000000000000002 R09:
0000000000010000
[1136314.348844] R10: ffffc9000e495000 R11: 0000000000000040 R12:
0000000000000001
[1136314.360706] R13: 0000000000000524 R14: ffffc9003168aec0 R15:
0000000000000001
[1136314.373298] FS: 00007f8df8bbcb80(0000) GS:ffff8897e0e00000(0000)
knlGS:0000000000000000
[1136314.386105] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[1136314.396532] CR2: 0000000000000034 CR3: 00000001aa912002 CR4:
00000000007706f0
[1136314.408377] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[1136314.420173] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[1136314.431890] PKRU: 55555554
[1136314.439143] Call Trace:
[1136314.446058] <IRQ>
[1136314.452465] ? __die+0x20/0x70
[1136314.459881] ? page_fault_oops+0x15b/0x440
[1136314.468305] ? exc_page_fault+0x6a/0x150
[1136314.476491] ? asm_exc_page_fault+0x22/0x30
[1136314.484927] ? __xdp_return+0x6c/0x210
[1136314.492863] bpf_xdp_adjust_tail+0x155/0x1d0
[1136314.501269] bpf_prog_ccc47ae29d3b6570_xdp_sock_prog+0x15/0x60
[1136314.511263] ice_clean_rx_irq_zc+0x206/0xc60 [ice]
[1136314.520222] ? ice_xmit_zc+0x6e/0x150 [ice]
[1136314.528506] ice_napi_poll+0x467/0x670 [ice]
[1136314.536858] ? ttwu_do_activate.constprop.0+0x8f/0x1a0
[1136314.546010] __napi_poll+0x29/0x1b0
[1136314.553462] net_rx_action+0x133/0x270
[1136314.561619] __do_softirq+0xbe/0x28e
[1136314.569303] do_softirq+0x3f/0x60
This comes from __xdp_return() call with xdp_buff argument passed as
NULL which is supposed to be consumed by xsk_buff_free() call.
To address this properly, in ZC case, a node that represents the frag
being removed has to be pulled out of xskb_list. Introduce
appropriate xsk helpers to do such node operation and use them
accordingly within bpf_xdp_adjust_tail().
Fixes: 24ea50127e ("xsk: support mbuf on ZC RX")
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> # For the xsk header part
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/r/20240124191602.566724-4-maciej.fijalkowski@intel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2024-01-24 16:24:06 -08:00
..
2023-03-27 02:33:48 +00:00
2023-12-22 12:56:21 -05:00
2023-08-10 18:24:48 -07:00
2023-12-29 07:46:38 +00:00
2024-01-12 13:52:21 -08:00
2024-01-04 18:06:46 -08:00
2023-12-15 11:01:27 +00:00
2021-11-17 20:17:05 -08:00
2023-12-17 10:56:33 +00:00
2023-06-15 22:33:26 -07:00
2023-08-10 19:31:52 -07:00
2024-01-02 12:41:16 +00:00
2024-01-07 14:58:26 +00:00
2023-12-08 10:40:51 +00:00
2023-12-24 15:22:50 +00:00
2023-11-30 00:25:16 +01:00
2023-12-15 10:37:35 +00:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2023-03-18 12:23:34 +00:00
2022-08-09 22:14:02 -07:00
2021-12-13 12:34:09 +00:00
2023-07-28 18:06:30 -07:00
2022-11-02 20:38:13 -07:00
2022-07-22 12:53:22 +01:00
2023-08-24 10:07:13 +02:00
2021-03-26 17:43:55 +01:00
2023-08-03 08:38:07 -07:00
2022-11-16 11:31:47 +02:00
2023-12-21 20:35:14 +01:00
2023-12-15 11:14:57 +01:00
2023-01-27 11:19:46 +00:00
2021-12-22 15:03:47 -08:00
2022-07-22 12:53:22 +01:00
2023-07-14 20:39:29 -07:00
2022-07-24 18:39:17 -06:00
2023-07-27 17:17:32 -07:00
2022-07-22 12:53:22 +01:00
2023-01-20 09:33:22 +00:00
2023-10-20 11:34:51 +01:00
2023-12-20 11:50:13 +00:00
2023-08-14 08:01:06 +01:00
2023-10-24 13:08:14 -07:00
2023-10-24 13:08:14 -07:00
2021-11-29 19:50:45 -08:00
2022-12-05 21:58:27 -08:00
2023-08-22 13:19:02 +02:00
2023-10-25 18:04:29 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-12-06 16:06:02 -08:00
2024-01-03 16:42:48 -08:00
2022-07-28 22:21:54 -07:00
2023-08-02 10:09:31 +01:00
2023-10-06 11:37:02 +01:00
2023-11-02 09:31:02 +01:00
2023-04-12 16:40:39 -07:00
2022-12-01 15:09:10 +01:00
2023-08-08 15:58:23 -07:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2023-12-29 08:43:59 +00:00
2022-10-31 10:43:04 +00:00
2023-10-06 07:30:40 +02:00
2023-06-10 00:11:41 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2023-07-28 14:07:59 -07:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2023-10-12 15:14:27 +03:00
2023-11-20 11:43:03 +01:00
2023-12-08 10:40:51 +00:00
2022-07-22 12:53:22 +01:00
2023-08-15 13:57:51 -07:00
2023-08-14 07:06:13 +01:00
2024-01-19 21:13:25 -08:00
2022-02-07 20:12:45 -08:00
2021-10-15 11:33:08 +01:00
2023-07-14 20:39:29 -07:00
2023-12-22 22:15:35 +00:00
2024-01-21 18:09:30 +00:00
2023-12-22 22:15:35 +00:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2023-12-21 22:16:47 +01:00
2023-09-19 18:21:44 +02:00
2022-04-25 11:40:45 +01:00
2023-10-05 13:16:47 -07:00
2023-11-16 22:33:31 +00:00
2023-04-22 01:39:41 +02:00
2023-12-15 17:56:27 -08:00
2022-09-29 07:18:00 +02:00
2022-07-22 12:53:22 +01:00
2022-10-31 20:14:27 -07:00
2023-10-30 14:36:57 -07:00
2023-12-22 22:15:34 +00:00
2023-08-22 21:40:40 +02:00
2023-06-12 21:13:23 -07:00
2021-03-23 14:14:50 -07:00
2023-08-04 15:33:17 -07:00
2023-08-04 15:33:17 -07:00
2022-07-22 12:53:22 +01:00
2023-07-20 10:46:28 +02:00
2021-10-13 09:40:46 -07:00
2024-01-19 21:30:09 -08:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-28 11:29:36 +02:00
2021-11-07 19:25:29 +00:00
2023-08-18 16:05:26 +02:00
2023-12-21 20:35:15 +01:00
2022-10-12 12:57:19 +02:00
2023-12-27 13:08:10 +00:00
2023-06-20 20:06:16 -07:00
2021-10-29 13:23:51 +01:00
2021-03-26 15:14:56 -07:00
2022-07-22 12:53:22 +01:00
2023-08-22 17:31:18 -07:00
2022-11-18 12:14:55 +00:00
2022-07-22 12:53:22 +01:00
2023-08-07 08:53:55 +01:00
2023-11-28 12:18:29 +01:00
2022-05-11 12:43:10 +01:00
2023-10-18 09:23:01 +01:00
2021-12-10 06:38:26 -08:00
2024-01-13 18:26:23 +00:00
2023-12-04 18:04:05 -08:00
2022-07-22 12:53:22 +01:00
2023-11-20 10:15:16 -08:00
2023-12-19 15:31:40 +01:00
2022-07-22 12:53:22 +01:00
2023-10-06 10:50:34 +01:00
2023-11-20 11:43:45 +01:00
2023-07-14 20:39:29 -07:00
2023-08-04 15:33:50 -07:00
2023-07-14 20:39:30 -07:00
2023-06-02 09:55:22 +01:00
2023-12-20 11:50:13 +00:00
2023-12-20 11:50:13 +00:00
2022-07-22 12:53:22 +01:00
2022-07-15 18:50:35 -07:00
2021-08-09 15:34:21 -07:00
2022-07-22 12:53:22 +01:00
2023-04-06 12:01:20 -07:00
2023-03-17 08:56:37 +00:00
2022-10-11 17:42:58 -06:00
2023-09-18 09:44:05 +02:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2023-10-16 09:57:52 +01:00
2023-06-19 11:32:58 -07:00
2023-07-14 20:39:30 -07:00
2023-08-20 11:40:03 +01:00
2023-12-26 21:20:08 +00:00
2023-12-12 14:24:14 +01:00
2022-07-22 12:53:22 +01:00
2022-01-04 12:17:35 +00:00
2021-04-28 14:06:45 -07:00
2023-12-26 20:24:33 +00:00
2022-10-25 11:35:16 +02:00
2024-01-21 18:09:30 +00:00
2023-10-04 11:49:20 -07:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2023-08-09 13:12:15 -07:00
2024-01-02 12:41:16 +00:00
2024-01-04 18:06:46 -08:00
2023-12-04 14:45:26 -08:00
2024-01-04 18:06:46 -08:00
2023-10-23 15:01:53 -07:00
2023-07-28 14:07:59 -07:00
2023-10-13 11:26:10 +01:00
2023-08-01 15:06:27 -07:00
2022-12-12 15:04:39 -08:00
2022-07-22 12:53:22 +01:00
2023-10-23 08:48:57 +01:00
2023-08-07 08:53:55 +01:00
2023-09-14 16:16:36 +02:00
2023-11-16 22:33:31 +00:00
2023-03-18 12:23:34 +00:00
2022-07-22 12:53:22 +01:00
2024-01-24 16:24:06 -08:00
2023-11-29 14:59:40 -08:00
2023-12-14 16:38:59 +01:00
2023-12-14 17:12:49 -08:00
2023-12-13 16:16:40 -08:00