2024-01-30 23:31:53

by Kees Cook

[permalink] [raw]
Subject: [PATCH] LoongArch: vDSO: Disable UBSAN instrumentation

The vDSO executes in userspace, so the kernel's UBSAN should not
instrument it. Solves these kind of build errors:

loongarch64-linux-ld: arch/loongarch/vdso/vgettimeofday.o: in function `vdso_shift_ns':
lib/vdso/gettimeofday.c:23:(.text+0x3f8): undefined reference to `__ubsan_handle_shift_out_of_bounds'

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Cc: Huacai Chen <[email protected]>
Cc: WANG Xuerui <[email protected]>
Cc: Vincenzo Frascino <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Masahiro Yamada <[email protected]>
Cc: Fangrui Song <[email protected]>
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
---
arch/loongarch/vdso/Makefile | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index c74c9921304f..f597cd08a96b 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -2,6 +2,7 @@
# Objects to go into the VDSO.

KASAN_SANITIZE := n
+UBSAN_SANITIZE := n
KCOV_INSTRUMENT := n

# Include the generic Makefile to check the built vdso.
--
2.34.1



2024-01-31 06:07:06

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH] LoongArch: vDSO: Disable UBSAN instrumentation

Queued, thanks.

Huacai

On Wed, Jan 31, 2024 at 7:31 AM Kees Cook <[email protected]> wrote:
>
> The vDSO executes in userspace, so the kernel's UBSAN should not
> instrument it. Solves these kind of build errors:
>
> loongarch64-linux-ld: arch/loongarch/vdso/vgettimeofday.o: in function `vdso_shift_ns':
> lib/vdso/gettimeofday.c:23:(.text+0x3f8): undefined reference to `__ubsan_handle_shift_out_of_bounds'
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Cc: Huacai Chen <[email protected]>
> Cc: WANG Xuerui <[email protected]>
> Cc: Vincenzo Frascino <[email protected]>
> Cc: Nathan Chancellor <[email protected]>
> Cc: Masahiro Yamada <[email protected]>
> Cc: Fangrui Song <[email protected]>
> Cc: [email protected]
> Signed-off-by: Kees Cook <[email protected]>
> ---
> arch/loongarch/vdso/Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index c74c9921304f..f597cd08a96b 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -2,6 +2,7 @@
> # Objects to go into the VDSO.
>
> KASAN_SANITIZE := n
> +UBSAN_SANITIZE := n
> KCOV_INSTRUMENT := n
>
> # Include the generic Makefile to check the built vdso.
> --
> 2.34.1
>