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: <20201103124622.GC40454@C02TD0UTHF1T.local>
Date:   Tue, 3 Nov 2020 12:46:22 +0000
From:   Mark Rutland <mark.rutland@....com>
To:     Will Deacon <will@...nel.org>
Cc:     linux-arm-kernel@...ts.infradead.org,
        Kees Cook <keescook@...omium.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Sami Tolvanen <samitolvanen@...gle.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/4] arm64: alternatives: Remove READ_ONCE() usage
 during patch operation

On Tue, Nov 03, 2020 at 12:17:20PM +0000, Will Deacon wrote:
> In preparation for patching the internals of READ_ONCE() itself, replace
> its usage on the alternatives patching patch with a volatile variable
> instead.
> 
> Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Signed-off-by: Will Deacon <will@...nel.org>

Acked-by: Mark Rutland <mark.rutland@....com>

Mark.

> ---
>  arch/arm64/kernel/alternative.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/alternative.c b/arch/arm64/kernel/alternative.c
> index 73039949b5ce..a57cffb752e8 100644
> --- a/arch/arm64/kernel/alternative.c
> +++ b/arch/arm64/kernel/alternative.c
> @@ -21,7 +21,8 @@
>  #define ALT_ORIG_PTR(a)		__ALT_PTR(a, orig_offset)
>  #define ALT_REPL_PTR(a)		__ALT_PTR(a, alt_offset)
>  
> -static int all_alternatives_applied;
> +/* Volatile, as we may be patching the guts of READ_ONCE() */
> +static volatile int all_alternatives_applied;
>  
>  static DECLARE_BITMAP(applied_alternatives, ARM64_NCAPS);
>  
> @@ -205,7 +206,7 @@ static int __apply_alternatives_multi_stop(void *unused)
>  
>  	/* We always have a CPU 0 at this point (__init) */
>  	if (smp_processor_id()) {
> -		while (!READ_ONCE(all_alternatives_applied))
> +		while (!all_alternatives_applied)
>  			cpu_relax();
>  		isb();
>  	} else {
> @@ -217,7 +218,7 @@ static int __apply_alternatives_multi_stop(void *unused)
>  		BUG_ON(all_alternatives_applied);
>  		__apply_alternatives(&region, false, remaining_capabilities);
>  		/* Barriers provided by the cache flushing */
> -		WRITE_ONCE(all_alternatives_applied, 1);
> +		all_alternatives_applied = 1;
>  	}
>  
>  	return 0;
> -- 
> 2.29.1.341.ge80a0c044ae-goog
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ