edd822b692
[ Upstream commit 1bb4bd266cf39fd2fa711f2d265c558b92df1119 ] Several test runners register individual worker threads with the RCU library, but neglect to register the main thread, which can lead to objects being freed while the main thread is in what appears to be an RCU critical section. Reported-by: Chris von Recklinghausen <crecklin@redhat.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
38 lines
701 B
C
38 lines
701 B
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* xarray.c: Userspace shim for XArray test-suite
|
|
* Copyright (c) 2018 Matthew Wilcox <willy@infradead.org>
|
|
*/
|
|
|
|
#define XA_DEBUG
|
|
#include "test.h"
|
|
|
|
#define module_init(x)
|
|
#define module_exit(x)
|
|
#define MODULE_AUTHOR(x)
|
|
#define MODULE_LICENSE(x)
|
|
#define dump_stack() assert(0)
|
|
|
|
#include "../../../lib/xarray.c"
|
|
#undef XA_DEBUG
|
|
#include "../../../lib/test_xarray.c"
|
|
|
|
void xarray_tests(void)
|
|
{
|
|
xarray_checks();
|
|
xarray_exit();
|
|
}
|
|
|
|
int __weak main(void)
|
|
{
|
|
rcu_register_thread();
|
|
radix_tree_init();
|
|
xarray_tests();
|
|
radix_tree_cpu_dead(1);
|
|
rcu_barrier();
|
|
if (nr_allocated)
|
|
printf("nr_allocated = %d\n", nr_allocated);
|
|
rcu_unregister_thread();
|
|
return 0;
|
|
}
|