lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQFuge+3T7uwNjgg8pnzVr=T0PaJ4LT10-zUdhZ5UZ-EA@mail.gmail.com>
Date: Mon, 15 Jul 2024 05:29:08 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>, 
	Kees Cook <keescook@...omium.org>, Marco Elver <elver@...gle.com>, 
	Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <kees@...nel.org>, 
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH] fortify: fix warnings in fortify tests with KASAN

On Mon, Jul 15, 2024 at 2:09 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> When a software KASAN mode is enabled, the fortify tests emit warnings
> on some architectures.
>
> For example, for ARCH=arm, the combination of CONFIG_FORTIFY_SOURCE=y
> and CONFIG_KASAN=y produces the following warnings:
>
>     TEST    lib/test_fortify/read_overflow-memchr.log
>   warning: unsafe memchr() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memchr.c
>     TEST    lib/test_fortify/read_overflow-memchr_inv.log
>   warning: unsafe memchr_inv() usage lacked '__read_overflow' symbol in lib/test_fortify/read_overflow-memchr_inv.c
>     TEST    lib/test_fortify/read_overflow-memcmp.log
>   warning: unsafe memcmp() usage lacked '__read_overflow' warning in lib/test_fortify/read_overflow-memcmp.c
>     TEST    lib/test_fortify/read_overflow-memscan.log
>   warning: unsafe memscan() usage lacked '__read_overflow' symbol in lib/test_fortify/read_overflow-memscan.c
>     TEST    lib/test_fortify/read_overflow2-memcmp.log
>   warning: unsafe memcmp() usage lacked '__read_overflow2' warning in lib/test_fortify/read_overflow2-memcmp.c
>      [ more and more similar warnings... ]
>
> Commit 9c2d1328f88a ("kbuild: provide reasonable defaults for tool
> coverage") removed KASAN flags from non-kernel objects by default.
> It was an intended behavior because lib/test_fortify/*.c are unit
> tests that are not linked to the kernel.
>
> As it turns out, some architectures require -fsanitize=kernel-(hw)address
> to define __SANITIZE_ADDRESS__ for the fortify tests.
>
> Without __SANITIZE_ADDRESS__ defined, arch/arm/include/asm/string.h
> defines __NO_FORTIFY, thus excluding <linux/fortify-string.h>.
>
> This issue does not occur on x86 thanks to commit 4ec4190be4cf
> ("kasan, x86: don't rename memintrinsics in uninstrumented files"),
> but there are still some architectures that define __NO_FORTIFY
> in such a situation.
>
> Set KASAN_SANITIZE=y explicitly to the fortify tests.
>
> Fixes: 9c2d1328f88a ("kbuild: provide reasonable defaults for tool coverage")
> Reported-by: Arnd Bergmann <arnd@...db.de>
> Closes: https://lore.kernel.org/all/0e8dee26-41cc-41ae-9493-10cd1a8e3268@app.fastmail.com/
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---

Applied to linux-kbuild.



-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ