kasan-for-arm32

李文杰 liwenjie.liwenjie at bytedance.com
Sat Jan 28 19:41:08 PST 2023


Hello everyone:

1. I encountered a problem when porting the patch of kasan-for-arm32
which contributed by linus.walleij at linaro.org. The problem is as
follows.

2. The global functions in the .ko module which exported by
EXPORT_SYMBOL() was treated as global variable by mistake. Then kasan
calls the __asan_register_globals() to register it and causes kernel
panic:

[  103.830475] Unable to handle kernel paging request at virtual
address be1030f8
[  103.838288] pgd = c289c846
[  103.841130] [be1030f8] *pgd=772f8811, *pte=430e76df, *ppte=430e765f
...
[  103.893070] CPU: 0 PID: 783 Comm: modprobe Tainted: G    B   W  O
   5.4.134-debug+ #1
...
[  103.909498] PC is at mmioset+0x74/0xa8
[  103.913403] LR is at kasan_poison_shadow+0x28/0x2c
...
[  104.226636] Backtrace:
[  104.226671] [<c0382278>] (kasan_poison_shadow) from [<c03823dc>]
(kasan_unpoison_shadow+0x1c/0x34)
[  104.226700] [<c03823c0>] (kasan_unpoison_shadow) from [<c03837a8>]
(__asan_register_globals+0x3c/0x60)
[  104.226712]  r5:00000016 r4:f881f070
[  104.265480] [<c038376c>] (__asan_register_globals) from
[<f8817060>] (_GLOBAL__sub_I_65535_1_rmnet_is_real_dev_registered+0x18/0x20
[rmnet_core])
[  104.265498]  r7:f8825630 r6:c7267700 r5:00000001 r4:f88254c0
[  104.318152] [<f8817048>]
(_GLOBAL__sub_I_65535_1_rmnet_is_real_dev_registered [rmnet_core])
from [<c17be778>] (do_init_module+0x274/0x2f8)
[  104.318182] [<c17be504>] (do_init_module) from [<c022df18>]
(load_module+0x2ea4/0x37cc)
[  104.337397]  r10:d5827ee0 r9:e0e86000 r8:00000001 r7:c3096210
r6:00000001 r5:c72678a4
[  104.337407]  r4:f88254c0
[  104.337438] [<c022b074>] (load_module) from [<c022ebc8>]
(sys_finit_module+0x120/0x184)
[  104.337459]  r10:00000003 r9:b6bc4231 r8:d5827ee0 r7:00000000
r6:c2a0e848 r5:d5827f60
[  104.337469]  r4:b9b04fc8
[  104.337496] [<c022eaa8>] (sys_finit_module) from [<c0101000>]
(ret_fast_syscall+0x0/0x2c)

3. rmnet_is_real_dev_registered() actually is a global function which
EXPORT_SYMBOL() in a module. But it was treated as a global variable.

Could someone help me ? Thanks,
...



More information about the linux-arm-kernel mailing list