[PATCH] ARM: uaccess: Disable KASAN for uaccess_with_memcpy.c

He Zhe zhe.he at windriver.com
Mon Aug 15 00:45:02 PDT 2022


Oops, some reviewers were missing at first.

Zhe

On 7/11/22 17:48, He Zhe wrote:
> uaccess_with_memcpy.c accesses user-space address on purpose. We should
> disable KASAN instrumentation for it, otherwise we would have call traces
> like the following.
>
> BUG: KASAN: user-memory-access in __clear_user_memset+0x154/0x21c
> Write of size 4032 at addr 00501040 by task init/1
>
> CPU: 1 PID: 1 Comm: init Not tainted 5.15.52-yocto-standard #1
> Hardware name: Xilinx Zynq Platform
> [<80116be8>] (unwind_backtrace) from [<8010ea3c>] (show_stack+0x18/0x1c)
> [<8010ea3c>] (show_stack) from [<80fc287c>] (dump_stack_lvl+0x40/0x4c)
> [<80fc287c>] (dump_stack_lvl) from [<80391148>] (kasan_report+0x19c/0x1cc)
> [<80391148>] (kasan_report) from [<80391b78>] (kasan_check_range+0x20/0x174)
> [<80391b78>] (kasan_check_range) from [<8039230c>] (memset+0x20/0x3c)
> [<8039230c>] (memset) from [<808112f0>] (__clear_user_memset+0x154/0x21c)
> [<808112f0>] (__clear_user_memset) from [<8044a9d4>] (clear_user+0x44/0x5c)
> [<8044a9d4>] (clear_user) from [<8044aa0c>] (padzero+0x20/0x38)
> [<8044aa0c>] (padzero) from [<8044ca00>] (load_elf_binary+0x994/0x1740)
> [<8044ca00>] (load_elf_binary) from [<803b4ed0>] (bprm_execve+0x420/0x8ec)
> [<803b4ed0>] (bprm_execve) from [<803b5bc0>] (kernel_execve+0x15c/0x190)
> [<803b5bc0>] (kernel_execve) from [<80fb9bf0>] (try_to_run_init_process+0x14/0x40)
> [<80fb9bf0>] (try_to_run_init_process) from [<80fccd3c>] (kernel_init+0xc8/0x148)
> [<80fccd3c>] (kernel_init) from [<80100130>] (ret_from_fork+0x14/0x24)
>
> Signed-off-by: He Zhe <zhe.he at windriver.com>
> ---
>  arch/arm/lib/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
> index 6d2ba454f25b..ddeb46efed80 100644
> --- a/arch/arm/lib/Makefile
> +++ b/arch/arm/lib/Makefile
> @@ -27,6 +27,7 @@ endif
>  
>  # using lib_ here won't override already available weak symbols
>  obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
> +KASAN_SANITIZE_uaccess_with_memcpy.o := n
>  
>  lib-$(CONFIG_MMU) += $(mmu-y)
>  




More information about the linux-arm-kernel mailing list