diff options
| author | Yibo Tan <lhfff@tju.edu.cn> | 2026-09-20 02:51:10 +0800 |
|---|---|---|
| committer | Joel Granados <joel.granados@kernel.org> | 2026-09-25 13:59:36 +0200 |
| commit | 238dfe02fb0a9f72d7fd275d74ce80f13923ef31 (patch) | |
| tree | 4f8af901162956e94a47060f7c7c199cc8618d67 /tools/perf/scripts/python/bin | |
| parent | ccb5bf46e31cef31d0ed1957b1fd3dbf8c774243 (diff) | |
| download | linux-next-238dfe02fb0a9f72d7fd275d74ce80f13923ef31.tar.gz linux-next-238dfe02fb0a9f72d7fd275d74ce80f13923ef31.zip | |
sysctl: unregister tables before freeing bitmap
The table registered for bitmap_0001 retains a pointer to
test_data.bitmap_0001. unregister_sysctl_table() prevents new handlers
from starting and waits for active handlers to finish.
test_sysctl_exit() currently frees the bitmap before unregistering the
table. A concurrent read during module removal can therefore enter
proc_do_large_bitmap() while the bitmap is freed. KASAN reports a
slab-use-after-free in _find_next_bit().
Unregister all tables before freeing the bitmap so the unregister rundown
provides the required lifetime boundary.
The unmodified module reproduced the use-after-free in three KASAN runs.
With this change, three runs each completed 100 load, read and unload race
rounds without a kernel diagnostic.
Fixes: 2ea622b887e7 ("tools/testing/selftests/sysctl/sysctl.sh: add proc_do_large_bitmap() test case")
Assisted-by: LLM
Signed-off-by: Yibo Tan <lhfff@tju.edu.cn>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/bin')
0 files changed, 0 insertions, 0 deletions
