linux-stable/tools
Liam R. Howlett 2128f7c00f maple_tree: fix write memory barrier of nodes once dead for RCU mode
[ Upstream commit c13af03de4 ]

During the development of the maple tree, the strategy of freeing multiple
nodes changed and, in the process, the pivots were reused to store
pointers to dead nodes.  To ensure the readers see accurate pivots, the
writers need to mark the nodes as dead and call smp_wmb() to ensure any
readers can identify the node as dead before using the pivot values.

There were two places where the old method of marking the node as dead
without smp_wmb() were being used, which resulted in RCU readers seeing
the wrong pivot value before seeing the node was dead.  Fix this race
condition by using mte_set_node_dead() which has the smp_wmb() call to
ensure the race is closed.

Add a WARN_ON() to the ma_free_rcu() call to ensure all nodes being freed
are marked as dead to ensure there are no other call paths besides the two
updated paths.

This is necessary for the RCU mode of the maple tree.

Link: https://lkml.kernel.org/r/20230227173632.3292573-6-surenb@google.com
Fixes: 54a611b605 ("Maple Tree: add new data structure")
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-20 12:35:12 +02:00
..
accounting
arch parisc: Align parisc MADV_XXX constants with all other architectures 2023-01-14 10:33:40 +01:00
bootconfig bootconfig: Fix testcase to increase max node 2023-03-30 12:49:07 +02:00
bpf bpftool: Always disable stack protection for BPF objects 2023-03-10 09:33:49 +01:00
build perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available 2022-10-25 17:40:48 -03:00
certs
cgroup iocost_monitor: reorder BlkgIterator 2022-09-23 16:57:10 -10:00
counter
debugging tools: Add new "test" taint to kernel-chktaint 2022-09-07 14:51:12 -06:00
edid
firewire
firmware
gpio tools: gpio: fix -c option of gpio-event-mon 2023-02-01 08:34:49 +01:00
hv tools: hv: kvp: remove unnecessary (void*) conversions 2022-09-05 16:55:20 +00:00
iio tools/iio/iio_utils:fix memory leak 2023-03-11 13:55:35 +01:00
include tools/nolibc: prevent gcc from making memset() loop over itself 2023-02-01 08:34:31 +01:00
io_uring
kvm/kvm_stat tools/kvm_stat: update exit reasons for vmx/svm/aarch64/userspace 2022-11-09 12:26:52 -05:00
laptop
leds
lib libbpf: Fix single-line struct definition output in btf_dump 2023-04-20 12:35:10 +02:00
memory-model tools/memory-model: Clarify LKMM's limitations in litmus-tests.txt 2022-08-31 05:15:31 -07:00
objtool objtool: Fix memory leak in create_static_call_sections() 2023-03-11 13:55:17 +01:00
pci
pcmcia
perf perf stat: Fix counting when initial delay configured 2023-03-17 08:50:24 +01:00
power tools/power turbostat: fix decoding of HWP_STATUS 2023-04-06 12:10:41 +02:00
rcu
scripts
spi
testing maple_tree: fix write memory barrier of nodes once dead for RCU mode 2023-04-20 12:35:12 +02:00
thermal tools/thermal: Fix possible path truncations 2022-08-03 19:28:46 +02:00
time
tracing tools/tracing/rtla: osnoise_hist: use total duration for average calculation 2023-03-10 09:33:26 +01:00
usb
verification rv/dot2c: Make automaton definition static 2022-10-20 16:02:45 -04:00
virtio tools/virtio: fix the vringh test for virtio ring changes 2023-02-22 12:59:42 +01:00
vm tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep" 2022-11-30 14:49:41 -08:00
wmi
Makefile