Tonghao Zhang
0a473f8343
bpf: hash map, avoid deadlock with suitable hash mask
[ Upstream commit 9f907439dc ]
The deadlock still may occur while accessed in NMI and non-NMI
context. Because in NMI, we still may access the same bucket but with
different map_locked index.
For example, on the same CPU, .max_entries = 2, we update the hash map,
with key = 4, while running bpf prog in NMI nmi_handle(), to update
hash map with key = 20, so it will have the same bucket index but have
different map_locked index.
To fix this issue, using min mask to hash again.
Fixes: 20b6cc34ea ("bpf: Avoid hashtab deadlock with map_locked")
Signed-off-by: Tonghao Zhang <tong@infragraf.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Song Liu <song@kernel.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Hou Tao <houtao1@huawei.com>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20230111092903.92389-1-tong@infragraf.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-13 16:48:16 +02:00
..
2023-04-13 16:48:16 +02:00
2022-12-14 11:37:19 +01:00
2022-05-25 09:57:37 +02:00
2022-10-05 10:39:40 +02:00
2023-03-30 12:47:51 +02:00
2023-03-30 12:47:41 +02:00
2022-12-31 13:14:04 +01:00
2022-12-31 13:14:47 +01:00
2023-03-17 08:48:58 +01:00
2023-04-05 11:24:52 +02:00
2022-10-26 12:34:30 +02:00
2023-03-10 09:39:57 +01:00
2023-03-10 09:39:51 +01:00
2023-03-11 13:57:32 +01:00
2023-03-10 09:39:47 +01:00
2023-04-05 11:24:53 +02:00
2023-03-10 09:39:51 +01:00
2023-04-05 11:24:54 +02:00
2022-12-31 13:14:40 +01:00
2022-02-23 12:03:07 +01:00
2022-08-31 17:16:33 +02:00
2022-02-08 18:34:03 +01:00
2022-04-08 14:23:06 +02:00
2022-04-08 14:23:06 +02:00
2022-06-22 14:22:04 +02:00
2023-04-05 11:24:53 +02:00
2022-12-31 13:14:04 +01:00
2021-12-29 12:28:49 +01:00
2022-02-23 12:03:20 +01:00
2023-02-01 08:27:22 +01:00
2023-03-11 13:57:38 +01:00
2023-03-17 08:48:47 +01:00
2022-07-21 21:24:29 +02:00
2023-03-10 09:40:01 +01:00
2023-03-30 12:47:42 +02:00
2022-12-31 13:14:04 +01:00
2023-02-01 08:27:23 +01:00
2022-12-31 13:14:24 +01:00
2023-02-01 08:27:22 +01:00
2023-03-10 09:39:09 +01:00
2022-08-17 14:24:04 +02:00
2022-06-09 10:22:29 +02:00
2022-12-31 13:14:05 +01:00
2023-03-10 09:40:08 +01:00
2022-04-08 14:23:10 +02:00
2022-06-09 10:22:46 +02:00
2022-02-16 12:56:38 +01:00
2022-07-21 21:24:42 +02:00
2022-08-17 14:24:24 +02:00
2022-02-23 12:03:07 +01:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-04-13 20:59:28 +02:00
2022-08-31 17:16:33 +02:00
2023-01-24 07:22:44 +01:00
2023-02-01 08:27:20 +01:00
2022-01-27 11:05:35 +01:00
2022-02-23 12:03:20 +01:00
2022-03-08 19:12:42 +01:00
2023-03-17 08:48:59 +01:00
2022-08-25 11:40:43 +02:00
2022-09-28 11:11:56 +02:00