linux/tools/testing/radix-tree
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
..
generated maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
linux radix tree test suite: add lockdep_is_held to header 2022-09-26 19:46:14 -07:00
trace/events Maple Tree: add new data structure 2022-09-26 19:46:13 -07:00
.gitignore maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
benchmark.c
bitmap.c
idr-test.c idr test suite: Improve reporting from idr_find_test_1 2021-04-01 07:50:42 -04:00
iteration_check_2.c
iteration_check.c
linux.c maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
main.c
Makefile maple_tree: reorganize testing to restore module testing 2022-11-08 15:57:22 -08:00
maple.c maple_tree: fix write memory barrier of nodes once dead for RCU mode 2023-04-05 18:06:21 -07:00
multiorder.c radix tree test suite: Register the main thread with the RCU library 2021-04-01 07:41:30 -04:00
regression1.c
regression2.c
regression3.c
regression4.c
regression.h
tag_check.c
test.c
test.h
xarray.c radix tree test suite: Register the main thread with the RCU library 2021-04-01 07:41:30 -04:00