All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4.4.y] arm64: armv8_deprecated: ensure extension of addr
@ 2017-05-24  9:56 Mark Rutland
  2017-06-12 13:22 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Rutland @ 2017-05-24  9:56 UTC (permalink / raw)
  To: stable

commit 55de49f9aa17b0b2b144dd2af587177b9aadf429 upstream.

Our compat swp emulation holds the compat user address in an unsigned
int, which it passes to __user_swpX_asm(). When a 32-bit value is passed
in a register, the upper 32 bits of the register are unknown, and we
must extend the value to 64 bits before we can use it as a base address.

This patch casts the address to unsigned long to ensure it has been
suitably extended, avoiding the potential issue, and silencing a related
warning from clang.

Fixes: bd35a4adc413 ("arm64: Port SWP/SWPB emulation support from arm")
Cc: <stable@vger.kernel.org> # 3.19.x-
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/kernel/armv8_deprecated.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
index 937f5e5..478a00b 100644
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -305,7 +305,8 @@ static void register_insn_emulation_sysctl(struct ctl_table *table)
 	ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN,	\
 		CONFIG_ARM64_PAN)				\
 	: "=&r" (res), "+r" (data), "=&r" (temp)		\
-	: "r" (addr), "i" (-EAGAIN), "i" (-EFAULT)		\
+	: "r" ((unsigned long)addr), "i" (-EAGAIN),		\
+	  "i" (-EFAULT)						\
 	: "memory")
 
 #define __user_swp_asm(data, addr, res, temp) \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4.4.y] arm64: armv8_deprecated: ensure extension of addr
  2017-05-24  9:56 [PATCH v4.4.y] arm64: armv8_deprecated: ensure extension of addr Mark Rutland
@ 2017-06-12 13:22 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2017-06-12 13:22 UTC (permalink / raw)
  To: Mark Rutland; +Cc: stable

On Wed, May 24, 2017 at 10:56:49AM +0100, Mark Rutland wrote:
> commit 55de49f9aa17b0b2b144dd2af587177b9aadf429 upstream.
> 
> Our compat swp emulation holds the compat user address in an unsigned
> int, which it passes to __user_swpX_asm(). When a 32-bit value is passed
> in a register, the upper 32 bits of the register are unknown, and we
> must extend the value to 64 bits before we can use it as a base address.
> 
> This patch casts the address to unsigned long to ensure it has been
> suitably extended, avoiding the potential issue, and silencing a related
> warning from clang.
> 
> Fixes: bd35a4adc413 ("arm64: Port SWP/SWPB emulation support from arm")
> Cc: <stable@vger.kernel.org> # 3.19.x-
> Acked-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  arch/arm64/kernel/armv8_deprecated.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Now applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-12 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24  9:56 [PATCH v4.4.y] arm64: armv8_deprecated: ensure extension of addr Mark Rutland
2017-06-12 13:22 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.