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: <4b412238-b20a-4346-bf67-f31df0a9f259@app.fastmail.com>
Date: Wed, 26 Mar 2025 22:23:33 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Jann Horn" <jannh@...gle.com>
Cc: "Marco Elver" <elver@...gle.com>, "Nathan Chancellor" <nathan@...nel.org>,
 Linux-Arch <linux-arch@...r.kernel.org>, linux-kernel@...r.kernel.org,
 "Linus Torvalds" <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] rwonce: fix crash by removing READ_ONCE() for unaligned read

On Wed, Mar 26, 2025, at 22:04, Jann Horn wrote:
> When arm64 is built with LTO, it upgrades READ_ONCE() to ldar / ldapr
> (load-acquire) to avoid issues that can be caused by the compiler
> optimizing away implicit address dependencies.
>
> Unlike plain loads, these load-acquire instructions actually require an
> aligned address.
>
> For now, fix it by removing the READ_ONCE() that the buggy commit
> introduced.
>
> Fixes: ece69af2ede1 ("rwonce: handle KCSAN like KASAN in read_word_at_a_time()")
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Closes: https://lore.kernel.org/r/20250326203926.GA10484@ax162
> Signed-off-by: Jann Horn <jannh@...gle.com>

Thanks for the quick fix!

I've applied this on top of the asm-generic branch, but I just sent
the pull request with the regression to Linus an hour ago.

I'll try to get a new pull request out tomorrow.

      Arnd

> ---
>  include/asm-generic/rwonce.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/rwonce.h b/include/asm-generic/rwonce.h
> index e9f2b84d2338..52b969c7cef9 100644
> --- a/include/asm-generic/rwonce.h
> +++ b/include/asm-generic/rwonce.h
> @@ -86,7 +86,12 @@ unsigned long read_word_at_a_time(const void *addr)
>  	kasan_check_read(addr, 1);
>  	kcsan_check_read(addr, 1);
> 
> -	return READ_ONCE(*(unsigned long *)addr);
> +	/*
> +	 * This load can race with concurrent stores to out-of-bounds memory,
> +	 * but READ_ONCE() can't be used because it requires higher alignment
> +	 * than plain loads in arm64 builds with LTO.
> +	 */
> +	return *(unsigned long *)addr;
>  }
> 
>  #endif /* __ASSEMBLY__ */
>
> ---
> base-commit: ece69af2ede103e190ffdfccd9f9ec850606ab5e
> change-id: 20250326-rwaat-fix-63d7557b3d88
>
> -- 
> Jann Horn <jannh@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ