linux-stable/tools
Liam R. Howlett c13af03de4 maple_tree: fix write memory barrier of nodes once dead for RCU mode
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>
2023-04-05 18:06:21 -07:00
..
accounting
arch perf tools fixes for v6.3: 2023-03-10 08:18:46 -08:00
bootconfig bootconfig: Fix testcase to increase max node 2023-03-22 01:00:28 +09:00
bpf bpftool: Use bpf_{btf,link,map,prog}_get_info_by_fd() 2023-02-16 15:32:45 -08:00
build tools build: Add test echo-cmd 2023-02-03 13:54:22 -03:00
certs
cgroup
counter
debugging
edid
firewire
firmware
gpio tools: gpio: fix -c option of gpio-event-mon 2023-01-27 14:05:46 +01:00
hv
iio tools/iio/iio_utils:fix memory leak 2023-01-21 17:52:26 +00:00
include Including fixes from netfilter, wifi and ipsec. 2023-03-17 13:31:16 -07:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Revert poisoning of strlcpy 2023-03-10 10:19:25 -08:00
memory-model
mm tools/mm: allow users to provide additional cflags/ldflags 2023-02-02 22:33:24 -08:00
net/ynl tools: ynl: Fix genlmsg header encoding formats 2023-03-22 20:40:04 -07:00
objtool Changes in this cycle were: 2023-03-02 09:45:34 -08:00
pci
pcmcia
perf perf tools fixes for v6.3: 2023-03-10 08:18:46 -08:00
power Power management fixes for 6.3-rc3 2023-03-17 11:02:26 -07:00
rcu
scripts tools: Add LoongArch build infrastructure 2023-02-25 22:12:18 +08:00
spi
testing maple_tree: fix write memory barrier of nodes once dead for RCU mode 2023-04-05 18:06:21 -07:00
thermal
time
tracing tracing updates for 6.3: 2023-02-23 10:20:49 -08:00
usb
verification tools/rv: Remove unneeded semicolon 2023-01-31 19:21:12 -05:00
virtio tools/virtio: Ignore virtio-trace/trace-agent 2023-03-13 02:29:12 -04:00
wmi
Makefile