linux-stable/tools/testing/radix-tree
Matthew Wilcox 4ecd9542db ida: Free correct IDA bitmap
There's a relatively rare race where we look at the per-cpu preallocated
IDA bitmap, see it's NULL, allocate a new one, and atomically update it.
If the kmalloc() happened to sleep and we were rescheduled to a different
CPU, or an interrupt came in at the exact right time, another task
might have successfully allocated a bitmap and already deposited it.
I forgot what the semantics of cmpxchg() were and ended up freeing the
wrong bitmap leading to KASAN reporting a use-after-free.

Dmitry found the bug with syzkaller & wrote the patch.  I wrote the test
case that will reproduce the bug without his patch being applied.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
2017-03-07 13:18:23 -05:00
..
generated radix tree test suite: Remove obsolete CONFIG 2017-02-13 16:09:43 -05:00
linux radix tree test suite: Add config option for map shift 2017-02-13 21:44:10 -05:00
.gitignore radix tree test suite: Add config option for map shift 2017-02-13 21:44:10 -05:00
benchmark.c radix tree test suite: Add performance test for radix_tree_join() 2017-03-07 13:18:21 -05:00
idr-test.c ida: Free correct IDA bitmap 2017-03-07 13:18:23 -05:00
iteration_check.c radix tree test suite: Dial down verbosity with -v 2017-02-13 21:44:04 -05:00
linux.c radix-tree: Chain preallocated nodes through ->parent 2017-02-13 21:44:04 -05:00
main.c ida: Free correct IDA bitmap 2017-03-07 13:18:23 -05:00
Makefile radix tree test suite: Depend on Makefile and quieten grep 2017-03-07 13:18:22 -05:00
multiorder.c radix tree test suite: Fix split/join memory leaks 2017-02-13 21:44:08 -05:00
regression.h radix-tree tests: add regression3 test 2016-03-17 15:09:34 -07:00
regression1.c radix tree test suite: Dial down verbosity with -v 2017-02-13 21:44:04 -05:00
regression2.c radix tree test suite: Fix leaks in regression2.c 2017-02-13 21:44:07 -05:00
regression3.c radix tree test suite: Dial down verbosity with -v 2017-02-13 21:44:04 -05:00
tag_check.c radix tree test suite: Add test for radix_tree_clear_tags() 2017-03-07 13:18:19 -05:00
test.c radix tree test suite: Fix leaky tests 2017-02-13 21:44:06 -05:00
test.h ida: Free correct IDA bitmap 2017-03-07 13:18:23 -05:00