Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247792

Re: [PATCH] ARM: SWP emulation: Restore original *data when failed

From Vladimir Murzin <vladimir.murzin@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ARM: SWP emulation: Restore original *data when failed
Date 2015-10-15 15:30 +0200
Message-ID <qjQLv-7Gi-9@gated-at.bofh.it> (permalink)
References (1 earlier) <qjM5c-QH-9@gated-at.bofh.it> <qjMyd-1oN-13@gated-at.bofh.it> <qjMyd-1oN-11@gated-at.bofh.it> <qjMRz-21D-5@gated-at.bofh.it> <qjQsa-7jf-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15/10/15 14:02, Will Deacon wrote:
> On Thu, Oct 15, 2015 at 10:17:47AM +0100, Vladimir Murzin wrote:
>> We might need the same change for arm64 counterpart (see
>> arch/arm64/kernel/armv8_deprecated.c).
> 
> Something like below?

Looks good. Should these two go to stable?

Vladimir

> 
> Will
> 
>>From 63c3e83073cfac2e011adf0ed6f335275cc977a7 Mon Sep 17 00:00:00 2001
> From: Will Deacon <will.deacon@arm.com>
> Date: Thu, 15 Oct 2015 13:55:53 +0100
> Subject: [PATCH] arm64: compat: fix stxr failure case in SWP emulation
> 
> If the STXR instruction fails in the SWP emulation code, we leave *data
> overwritten with the loaded value, therefore corrupting the data written
> by a subsequent, successful attempt.
> 
> This patch re-jigs the code so that we only write back to *data once we
> know that the update has happened.
> 
> Reported-by: Shengjiu Wang <shengjiu.wang@freescale.com>
> Reported-by: Vladimir Murzin <vladimir.murzin@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  arch/arm64/kernel/armv8_deprecated.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
> index bcee7abac68e..6039d1eb5912 100644
> --- a/arch/arm64/kernel/armv8_deprecated.c
> +++ b/arch/arm64/kernel/armv8_deprecated.c
> @@ -284,12 +284,12 @@ static void register_insn_emulation_sysctl(struct ctl_table *table)
>  	__asm__ __volatile__(					\
>  	ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN,	\
>  		    CONFIG_ARM64_PAN)				\
> -	"	mov		%w2, %w1\n"			\
> -	"0:	ldxr"B"		%w1, [%3]\n"			\
> -	"1:	stxr"B"		%w0, %w2, [%3]\n"		\
> +	"0:	ldxr"B"		%w2, [%3]\n"			\
> +	"1:	stxr"B"		%w0, %w1, [%3]\n"		\
>  	"	cbz		%w0, 2f\n"			\
>  	"	mov		%w0, %w4\n"			\
>  	"2:\n"							\
> +	"	mov		%w1, %w2\n"			\
>  	"	.pushsection	 .fixup,\"ax\"\n"		\
>  	"	.align		2\n"				\
>  	"3:	mov		%w0, %w5\n"			\
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-10-15 10:30 +0200
  Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-10-15 11:00 +0200
    Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Vladimir Murzin <vladimir.murzin@arm.com> - 2015-10-15 11:20 +0200
      Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Will Deacon <will.deacon@arm.com> - 2015-10-15 15:10 +0200
        Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Vladimir Murzin <vladimir.murzin@arm.com> - 2015-10-15 15:30 +0200
          Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Vladimir Murzin <vladimir.murzin@arm.com> - 2015-10-16 10:00 +0200
            Re: [PATCH] ARM: SWP emulation: Restore original *data when failed Catalin Marinas <catalin.marinas@arm.com> - 2015-10-16 12:40 +0200

csiph-web