Benjamin Poirier
0756384fb1
vxlan: Fix nexthop hash size
...
The nexthop code expects a 31 bit hash, such as what is returned by
fib_multipath_hash() and rt6_multipath_hash(). Passing the 32 bit hash
returned by skb_get_hash() can lead to problems related to the fact that
'int hash' is a negative number when the MSB is set.
In the case of hash threshold nexthop groups, nexthop_select_path_hthr()
will disproportionately select the first nexthop group entry. In the case
of resilient nexthop groups, nexthop_select_path_res() may do an out of
bounds access in nh_buckets[], for example:
hash = -912054133
num_nh_buckets = 2
bucket_index = 65535
which leads to the following panic:
BUG: unable to handle page fault for address: ffffc900025910c8
PGD 100000067 P4D 100000067 PUD 10026b067 PMD 0
Oops: 0002 [#1 ] PREEMPT SMP KASAN NOPTI
CPU: 4 PID: 856 Comm: kworker/4:3 Not tainted 6.5.0-rc2+ #34
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: ipv6_addrconf addrconf_dad_work
RIP: 0010:nexthop_select_path+0x197/0xbf0
Code: c1 e4 05 be 08 00 00 00 4c 8b 35 a4 14 7e 01 4e 8d 6c 25 00 4a 8d 7c 25 08 48 01 dd e8 c2 25 15 ff 49 8d 7d 08 e8 39 13 15 ff <4d> 89 75 08 48 89 ef e8 7d 12 15 ff 48 8b 5d 00 e8 14 55 2f 00 85
RSP: 0018:ffff88810c36f260 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000002000c0 RCX: ffffffffaf02dd77
RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffffc900025910c8
RBP: ffffc900025910c0 R08: 0000000000000001 R09: fffff520004b2219
R10: ffffc900025910cf R11: 31392d2068736168 R12: 00000000002000c0
R13: ffffc900025910c0 R14: 00000000fffef608 R15: ffff88811840e900
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffc900025910c8 CR3: 0000000129d00000 CR4: 0000000000750ee0
PKRU: 55555554
Call Trace:
<TASK>
? __die+0x23/0x70
? page_fault_oops+0x1ee/0x5c0
? __pfx_is_prefetch.constprop.0+0x10/0x10
? __pfx_page_fault_oops+0x10/0x10
? search_bpf_extables+0xfe/0x1c0
? fixup_exception+0x3b/0x470
? exc_page_fault+0xf6/0x110
? asm_exc_page_fault+0x26/0x30
? nexthop_select_path+0x197/0xbf0
? nexthop_select_path+0x197/0xbf0
? lock_is_held_type+0xe7/0x140
vxlan_xmit+0x5b2/0x2340
? __lock_acquire+0x92b/0x3370
? __pfx_vxlan_xmit+0x10/0x10
? __pfx___lock_acquire+0x10/0x10
? __pfx_register_lock_class+0x10/0x10
? skb_network_protocol+0xce/0x2d0
? dev_hard_start_xmit+0xca/0x350
? __pfx_vxlan_xmit+0x10/0x10
dev_hard_start_xmit+0xca/0x350
__dev_queue_xmit+0x513/0x1e20
? __pfx___dev_queue_xmit+0x10/0x10
? __pfx_lock_release+0x10/0x10
? mark_held_locks+0x44/0x90
? skb_push+0x4c/0x80
? eth_header+0x81/0xe0
? __pfx_eth_header+0x10/0x10
? neigh_resolve_output+0x215/0x310
? ip6_finish_output2+0x2ba/0xc90
ip6_finish_output2+0x2ba/0xc90
? lock_release+0x236/0x3e0
? ip6_mtu+0xbb/0x240
? __pfx_ip6_finish_output2+0x10/0x10
? find_held_lock+0x83/0xa0
? lock_is_held_type+0xe7/0x140
ip6_finish_output+0x1ee/0x780
ip6_output+0x138/0x460
? __pfx_ip6_output+0x10/0x10
? __pfx___lock_acquire+0x10/0x10
? __pfx_ip6_finish_output+0x10/0x10
NF_HOOK.constprop.0+0xc0/0x420
? __pfx_NF_HOOK.constprop.0+0x10/0x10
? ndisc_send_skb+0x2c0/0x960
? __pfx_lock_release+0x10/0x10
? __local_bh_enable_ip+0x93/0x110
? lock_is_held_type+0xe7/0x140
ndisc_send_skb+0x4be/0x960
? __pfx_ndisc_send_skb+0x10/0x10
? mark_held_locks+0x65/0x90
? find_held_lock+0x83/0xa0
ndisc_send_ns+0xb0/0x110
? __pfx_ndisc_send_ns+0x10/0x10
addrconf_dad_work+0x631/0x8e0
? lock_acquire+0x180/0x3f0
? __pfx_addrconf_dad_work+0x10/0x10
? mark_held_locks+0x24/0x90
process_one_work+0x582/0x9c0
? __pfx_process_one_work+0x10/0x10
? __pfx_do_raw_spin_lock+0x10/0x10
? mark_held_locks+0x24/0x90
worker_thread+0x93/0x630
? __kthread_parkme+0xdc/0x100
? __pfx_worker_thread+0x10/0x10
kthread+0x1a5/0x1e0
? __pfx_kthread+0x10/0x10
ret_from_fork+0x34/0x60
? __pfx_kthread+0x10/0x10
ret_from_fork_asm+0x1b/0x30
RIP: 0000:0x0
Code: Unable to access opcode bytes at 0xffffffffffffffd6.
RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
Modules linked in:
CR2: ffffc900025910c8
---[ end trace 0000000000000000 ]---
RIP: 0010:nexthop_select_path+0x197/0xbf0
Code: c1 e4 05 be 08 00 00 00 4c 8b 35 a4 14 7e 01 4e 8d 6c 25 00 4a 8d 7c 25 08 48 01 dd e8 c2 25 15 ff 49 8d 7d 08 e8 39 13 15 ff <4d> 89 75 08 48 89 ef e8 7d 12 15 ff 48 8b 5d 00 e8 14 55 2f 00 85
RSP: 0018:ffff88810c36f260 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 00000000002000c0 RCX: ffffffffaf02dd77
RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffffc900025910c8
RBP: ffffc900025910c0 R08: 0000000000000001 R09: fffff520004b2219
R10: ffffc900025910cf R11: 31392d2068736168 R12: 00000000002000c0
R13: ffffc900025910c0 R14: 00000000fffef608 R15: ffff88811840e900
FS: 0000000000000000(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffffffffd6 CR3: 0000000129d00000 CR4: 0000000000750ee0
PKRU: 55555554
Kernel panic - not syncing: Fatal exception in interrupt
Kernel Offset: 0x2ca00000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff)
---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---
Fix this problem by ensuring the MSB of hash is 0 using a right shift - the
same approach used in fib_multipath_hash() and rt6_multipath_hash().
Fixes: 1274e1cc4226 ("vxlan: ecmp support for mac fdb entries")
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-08-02 10:58:26 +01:00
..
2023-03-27 02:33:48 +00:00
2023-07-20 11:25:24 -07:00
2021-07-01 13:19:48 -07:00
2021-11-19 11:52:25 +00:00
2023-06-27 14:06:29 -03:00
2023-07-05 14:42:16 +02:00
2023-06-17 09:53:53 +01:00
2021-11-17 20:17:05 -08:00
2023-06-15 22:33:26 -07:00
2023-04-21 08:19:30 +01:00
2023-02-16 10:39:28 +01:00
2023-02-20 16:46:10 -08:00
2023-03-17 08:56:37 +00:00
2023-05-01 07:43:19 +01:00
2023-03-18 12:23:33 +00:00
2023-03-29 08:19:38 +01: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
2022-09-16 14:34:01 +01:00
2022-11-02 20:38:13 -07:00
2022-07-22 12:53:22 +01:00
2023-07-14 20:39:29 -07:00
2021-03-26 17:43:55 +01:00
2022-08-24 13:46:58 +01:00
2022-11-16 11:31:47 +02:00
2023-06-21 14:01:29 +02:00
2023-07-14 20:39:29 -07: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
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2023-01-20 09:33:22 +00:00
2023-07-14 20:39:29 -07:00
2023-04-20 20:20:49 -07:00
2023-04-20 20:20:49 -07:00
2023-04-09 15:35:49 +01:00
2023-06-27 09:45:22 -07:00
2021-11-29 19:50:45 -08:00
2022-12-05 21:58:27 -08:00
2023-01-13 20:59:14 -08:00
2023-03-28 18:52:28 -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
2021-12-16 07:18:35 -08:00
2022-07-28 22:21:54 -07:00
2023-06-12 17:01:45 -07:00
2023-02-20 16:46:10 -08:00
2023-06-02 10:52:38 +01:00
2023-04-12 16:40:39 -07:00
2022-12-01 15:09:10 +01:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2021-10-18 12:54:41 +01:00
2022-11-21 13:09:07 +00:00
2022-10-31 10:43:04 +00:00
2021-01-29 20:39:14 -08:00
2023-07-29 17:10:27 +01: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-05-24 22:05:24 -07:00
2022-07-22 12:53:22 +01:00
2021-06-28 14:29:45 -07:00
2023-06-14 12:32:19 +02:00
2023-03-23 21:51:30 +01:00
2022-04-06 22:09:39 -07:00
2022-07-22 12:53:22 +01:00
2022-07-22 12:53:22 +01:00
2022-07-29 11:58:54 +01:00
2023-06-24 15:50:13 -07:00
2022-08-24 19:30:07 -07: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
2022-12-30 07:25:52 +00:00
2023-07-29 18:13:41 +01:00
2022-12-30 07:25:52 +00:00
2022-02-17 07:00:39 -06:00
2021-11-16 13:16:54 +00:00
2023-03-29 08:22:52 +01:00
2023-03-28 18:52:22 -07:00
2022-04-25 11:40:45 +01:00
2022-04-11 17:37:50 -07:00
2023-04-13 16:43:38 -07:00
2023-04-22 01:39:41 +02:00
2023-07-29 18:13:41 +01: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
2022-09-02 20:34:32 -07:00
2023-07-24 16:52:37 -07:00
2023-06-12 21:13:23 -07:00
2021-03-23 14:14:50 -07:00
2022-07-22 12:53:22 +01: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
2023-07-14 20:39:29 -07: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
2021-08-30 01:51:36 +02:00
2023-06-21 09:16:57 +02:00
2022-10-12 12:57:19 +02:00
2023-05-10 11:32:09 +01: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
2022-12-12 13:11:24 -08:00
2022-11-18 12:14:55 +00:00
2022-07-22 12:53:22 +01:00
2023-03-21 21:32:18 -07:00
2023-06-01 21:36:37 -07:00
2022-05-11 12:43:10 +01:00
2022-10-24 11:04:43 +01:00
2021-12-10 06:38:26 -08:00
2023-04-18 12:59:01 +02:00
2022-07-22 12:53:22 +01:00
2023-01-28 00:33:51 -08:00
2022-07-22 12:53:22 +01:00
2023-05-11 18:07:05 -07:00
2023-01-28 13:51:22 +01:00
2023-07-14 20:39:29 -07:00
2022-07-22 12:53:22 +01:00
2023-05-23 20:25:13 -07:00
2023-07-14 20:39:30 -07:00
2023-06-02 09:55:22 +01:00
2023-05-15 09:31:07 +01:00
2023-07-12 15:59:33 -07: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-06-19 12:05:29 +02:00
2022-02-02 14:45:18 +00:00
2022-08-01 11:59:23 -07:00
2023-07-29 18:13:41 +01:00
2023-06-19 11:32:58 -07:00
2023-07-14 20:39:30 -07:00
2022-10-31 18:10:21 -07:00
2023-06-17 00:17:42 -07:00
2023-06-27 10:50:22 -07: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-03-15 08:18:35 +00:00
2022-10-25 11:35:16 +02:00
2023-06-27 09:45:22 -07:00
2021-08-03 13:05:26 +01:00
2022-07-22 12:53:22 +01:00
2022-07-18 11:24:10 +01:00
2022-11-09 19:06:13 -08:00
2023-02-16 09:27:07 +01:00
2023-07-20 12:34:18 -07:00
2023-06-15 09:01:05 +01:00
2022-10-24 09:40:39 +01:00
2022-12-12 15:04:39 -08:00
2022-07-22 12:53:22 +01:00
2022-11-08 16:42:28 +00:00
2023-06-15 22:33:26 -07:00
2022-10-12 17:50:37 -07:00
2023-08-02 10:58:26 +01:00
2023-03-18 12:23:34 +00:00
2022-07-22 12:53:22 +01:00
2023-06-19 14:06:22 +02:00
2023-03-07 09:33:43 -08:00
2023-04-13 16:43:38 -07:00
2023-05-21 09:21:37 +02:00
2023-04-27 22:24:51 +02:00