]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Annotate data races in bpf_local_storage
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Tue, 21 Feb 2023 20:06:42 +0000 (21:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:36 +0000 (17:32 +0100)
commit99a09075e62a01b1d659fc7970011d3bf963bf02
treefc09d6cc9e813e074819079d50bce0552b2b4446
parent27923f197efda805ebf3c6a621335210d442abf8
bpf: Annotate data races in bpf_local_storage

[ Upstream commit 0a09a2f933c73dc76ab0b72da6855f44342a8903 ]

There are a few cases where hlist_node is checked to be unhashed without
holding the lock protecting its modification. In this case, one must use
hlist_unhashed_lockless to avoid load tearing and KCSAN reports. Fix
this by using lockless variant in places not protected by the lock.

Since this is not prompted by any actual KCSAN reports but only from
code review, I have not included a fixes tag.

Cc: Martin KaFai Lau <martin.lau@kernel.org>
Cc: KP Singh <kpsingh@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20230221200646.2500777-4-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/bpf_local_storage.c