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]
Date: Thu, 25 Apr 2024 11:32:52 +0200
From: Marco Elver <elver@...gle.com>
To: Alexander Potapenko <glider@...gle.com>
Cc: dvyukov@...gle.com, akpm@...ux-foundation.org, ojeda@...nel.org, 
	linux-kernel@...r.kernel.org, 
	syzbot+355c5bb8c1445c871ee8@...kaller.appspotmail.com
Subject: Re: [PATCH] kmsan: compiler_types: declare __no_sanitize_or_inline

On Thu, 25 Apr 2024 at 11:29, Alexander Potapenko <glider@...gle.com> wrote:
>
> It turned out that KMSAN instruments READ_ONCE_NOCHECK(), resulting in
> false positive reports, because __no_sanitize_or_inline enforced inlining.
>
> Properly declare __no_sanitize_or_inline under __SANITIZE_MEMORY__,
> so that it does not inline the annotated function.

Maybe worth noting that this is only a problem for __always_inline,
since that is inlining-by-force, and from the compiler's point of view
WAI.

> Reported-by: syzbot+355c5bb8c1445c871ee8@...kaller.appspotmail.com
> Signed-off-by: Alexander Potapenko <glider@...gle.com>

Reviewed-by: Marco Elver <elver@...gle.com>

> ---
>  include/linux/compiler_types.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
> index 0caf354cb94b5..a6a28952836cb 100644
> --- a/include/linux/compiler_types.h
> +++ b/include/linux/compiler_types.h
> @@ -278,6 +278,17 @@ struct ftrace_likely_data {
>  # define __no_kcsan
>  #endif
>
> +#ifdef __SANITIZE_MEMORY__
> +/*
> + * Similarly to KASAN and KCSAN, KMSAN loses function attributes of inlined
> + * functions, therefore disabling KMSAN checks also requires disabling inlining.
> + *
> + * __no_sanitize_or_inline effectively prevents KMSAN from reporting errors
> + * within the function and marks all its outputs as initialized.
> + */
> +# define __no_sanitize_or_inline __no_kmsan_checks notrace __maybe_unused
> +#endif
> +
>  #ifndef __no_sanitize_or_inline
>  #define __no_sanitize_or_inline __always_inline
>  #endif
> --
> 2.44.0.769.g3c40516874-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ