FAILED: patch "[PATCH] arm64: compat: fix stxr failure case in SWP emulation" failed to apply to 4.2-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.2-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
589cb22bbedacf325951014c07a35a2b01ca57f6Mon Sep 17 00:00:00 2001
From: Will Deacon <[email protected]>
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.
arch/arm64/kernel/armv8_deprecated.c +9 -7
@@ -284,21 +284,23 @@ 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" \ +" b 3f\n" \"2:\n" \ +" mov %w1, %w2\n" \ +"3:\n" \" .pushsection .fixup,\"ax\"\n" \" .align 2\n" \ -"3: mov %w0, %w5\n" \ -" b 2b\n" \ +"4: mov %w0, %w5\n" \ +" b 3b\n" \" .popsection" \" .pushsection __ex_table,\"a\"\n" \" .align 3\n" \ -" .quad 0b, 3b\n" \ -" .quad 1b, 3b\n" \ +" .quad 0b, 4b\n" \ +" .quad 1b, 4b\n" \" .popsection\n" \ALTERNATIVE ("nop" ,SET_PSTATE_PAN (1 ),ARM64_HAS_PAN , \CONFIG_ARM64_PAN ) \