diff options
author | Huacai Chen <chenhuacai@loongson.cn> | 2024-04-10 16:08:51 +0300 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2024-04-10 16:08:51 +0300 |
commit | 1a629fe4cca0fc4cf546b4ca2e9d4b75bbfde9ff (patch) | |
tree | e0c115674d1fd82f769fbbe6b124c0896c6121ab /arch/loongarch/boot/dts/loongson-2k2000.dtsi | |
parent | 0ca84aeaee150796d4b5577b1b0ae52a947e7813 (diff) | |
download | linux-1a629fe4cca0fc4cf546b4ca2e9d4b75bbfde9ff.tar.xz |
LoongArch: Make virt_addr_valid()/__virt_addr_valid() work with KFENCE
When enabling both CONFIG_KFENCE and CONFIG_DEBUG_SG, I get the
following backtraces when running LongArch kernels.
[ 2.496257] kernel BUG at include/linux/scatterlist.h:187!
...
[ 2.501925] Call Trace:
[ 2.501950] [<9000000004ad59c4>] sg_init_one+0xac/0xc0
[ 2.502204] [<9000000004a438f8>] do_test_kpp+0x278/0x6e4
[ 2.502353] [<9000000004a43dd4>] alg_test_kpp+0x70/0xf4
[ 2.502494] [<9000000004a41b48>] alg_test+0x128/0x690
[ 2.502631] [<9000000004a3d898>] cryptomgr_test+0x20/0x40
[ 2.502775] [<90000000041b4508>] kthread+0x138/0x158
[ 2.502912] [<9000000004161c48>] ret_from_kernel_thread+0xc/0xa4
The backtrace is always similar but not exactly the same. It is always
triggered from cryptomgr_test, but not always from the same test.
Analysis shows that with CONFIG_KFENCE active, the address returned from
kmalloc() and friends is not always below vm_map_base. It is allocated
by kfence_alloc() which at least sometimes seems to get its memory from
an address space above vm_map_base. This causes __virt_addr_valid() to
return false for the affected objects.
Let __virt_addr_valid() return 1 for kfence pool addresses, this make
virt_addr_valid()/__virt_addr_valid() work with KFENCE.
Reported-by: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/boot/dts/loongson-2k2000.dtsi')
0 files changed, 0 insertions, 0 deletions