From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Anton Blanchard <anton@samba.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Ben Hutchings <ben@decadent.org.uk>,
Yijing Wang <wangyijing@huawei.com>
Subject: [PATCH 3.4 40/44] powerpc: Restore registers on error exit from csum_partial_copy_generic()
Date: Mon, 7 Jul 2014 17:07:30 -0700 [thread overview]
Message-ID: <20140707235859.835406315@linuxfoundation.org> (raw)
In-Reply-To: <20140707235858.652771077@linuxfoundation.org>
3.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
commit 8f21bd0090052e740944f9397e2be5ac7957ded7 upstream.
The csum_partial_copy_generic() function saves the PowerPC non-volatile
r14, r15, and r16 registers for the main checksum-and-copy loop.
Unfortunately, it fails to restore them upon error exit from this loop,
which results in silent corruption of these registers in the presumably
rare event of an access exception within that loop.
This commit therefore restores these register on error exit from the loop.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[bwh: Backported to 3.2: register name macros use lower-case 'r']
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/powerpc/lib/checksum_64.S | 54 ++++++++++++++++++++++++++++++-----------
1 file changed, 40 insertions(+), 14 deletions(-)
--- a/arch/powerpc/lib/checksum_64.S
+++ b/arch/powerpc/lib/checksum_64.S
@@ -229,19 +229,35 @@ _GLOBAL(csum_partial)
blr
- .macro source
+ .macro srcnr
100:
.section __ex_table,"a"
.align 3
- .llong 100b,.Lsrc_error
+ .llong 100b,.Lsrc_error_nr
.previous
.endm
- .macro dest
+ .macro source
+150:
+ .section __ex_table,"a"
+ .align 3
+ .llong 150b,.Lsrc_error
+ .previous
+ .endm
+
+ .macro dstnr
200:
.section __ex_table,"a"
.align 3
- .llong 200b,.Ldest_error
+ .llong 200b,.Ldest_error_nr
+ .previous
+ .endm
+
+ .macro dest
+250:
+ .section __ex_table,"a"
+ .align 3
+ .llong 250b,.Ldest_error
.previous
.endm
@@ -277,11 +293,11 @@ _GLOBAL(csum_partial_copy_generic)
mtctr r6
1:
-source; lhz r6,0(r3) /* align to doubleword */
+srcnr; lhz r6,0(r3) /* align to doubleword */
subi r5,r5,2
addi r3,r3,2
adde r0,r0,r6
-dest; sth r6,0(r4)
+dstnr; sth r6,0(r4)
addi r4,r4,2
bdnz 1b
@@ -395,10 +411,10 @@ dest; std r16,56(r4)
mtctr r6
3:
-source; ld r6,0(r3)
+srcnr; ld r6,0(r3)
addi r3,r3,8
adde r0,r0,r6
-dest; std r6,0(r4)
+dstnr; std r6,0(r4)
addi r4,r4,8
bdnz 3b
@@ -408,10 +424,10 @@ dest; std r6,0(r4)
srdi. r6,r5,2
beq .Lcopy_tail_halfword
-source; lwz r6,0(r3)
+srcnr; lwz r6,0(r3)
addi r3,r3,4
adde r0,r0,r6
-dest; stw r6,0(r4)
+dstnr; stw r6,0(r4)
addi r4,r4,4
subi r5,r5,4
@@ -419,10 +435,10 @@ dest; stw r6,0(r4)
srdi. r6,r5,1
beq .Lcopy_tail_byte
-source; lhz r6,0(r3)
+srcnr; lhz r6,0(r3)
addi r3,r3,2
adde r0,r0,r6
-dest; sth r6,0(r4)
+dstnr; sth r6,0(r4)
addi r4,r4,2
subi r5,r5,2
@@ -430,10 +446,10 @@ dest; sth r6,0(r4)
andi. r6,r5,1
beq .Lcopy_finish
-source; lbz r6,0(r3)
+srcnr; lbz r6,0(r3)
sldi r9,r6,8 /* Pad the byte out to 16 bits */
adde r0,r0,r9
-dest; stb r6,0(r4)
+dstnr; stb r6,0(r4)
.Lcopy_finish:
addze r0,r0 /* add in final carry */
@@ -443,6 +459,11 @@ dest; stb r6,0(r4)
blr
.Lsrc_error:
+ ld r14,STK_REG(r14)(r1)
+ ld r15,STK_REG(r15)(r1)
+ ld r16,STK_REG(r16)(r1)
+ addi r1,r1,STACKFRAMESIZE
+.Lsrc_error_nr:
cmpdi 0,r7,0
beqlr
li r6,-EFAULT
@@ -450,6 +471,11 @@ dest; stb r6,0(r4)
blr
.Ldest_error:
+ ld r14,STK_REG(r14)(r1)
+ ld r15,STK_REG(r15)(r1)
+ ld r16,STK_REG(r16)(r1)
+ addi r1,r1,STACKFRAMESIZE
+.Ldest_error_nr:
cmpdi 0,r8,0
beqlr
li r6,-EFAULT
next prev parent reply other threads:[~2014-07-08 0:03 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 0:06 [PATCH 3.4 00/44] 3.4.98-stable review Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 01/44] ibmvscsi: Abort init sequence during error recovery Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 02/44] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 03/44] xhci: Fix runtime suspended xhci from blocking system suspend Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 05/44] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 07/44] USB: ftdi_sio: fix null deref at port probe Greg Kroah-Hartman
2014-07-08 0:06 ` [PATCH 3.4 09/44] rt2x00: disable TKIP on USB Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 10/44] rt2x00: fix rfkill regression on rt2500pci Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 11/44] mtd: pxa3xx_nand: make the driver work on big-endian systems Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 12/44] drm/radeon: only apply hdmi bpc pll flags when encoder mode is hdmi Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 13/44] drm/radeon: fix typo in radeon_connector_is_dp12_capable() Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 14/44] drm/radeon/atom: fix dithering on certain panels Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 15/44] drm/vmwgfx: Fix incorrect write to read-only register v2: Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 16/44] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 17/44] Bluetooth: Remove unused hci_le_ltk_reply() Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 18/44] mac80211: dont check netdev state for debugfs read/write Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 19/44] ARM: OMAP2+: Fix parser-bug in platform muxing code Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 21/44] CIFS: fix mount failure with broken pathnames when smb3 mount with mapchars option Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 22/44] KVM: x86: Increase the number of fixed MTRR regs to 10 Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 23/44] KVM: x86: preserve the high 32-bits of the PAT register Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 24/44] nfsd: fix rare symlink decoding bug Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 25/44] tools: ffs-test: fix header values endianess Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 26/44] md: flush writes before starting a recovery Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 27/44] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 28/44] acpi/video_detect: blacklist samsung x360 Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 29/44] ACPI / video: Add "Asus UL30VT" to ACPI video detect blacklist Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 30/44] ACPI / video: Add "Asus UL30A" " Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 31/44] ACPI video: ignore BIOS initial backlight value for HP 1000 Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 32/44] staging: comedi: das08: Correct AI encoding for das08jr-16-ao Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 33/44] staging: comedi: fix a race between do_cmd_ioctl() and read/write Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 34/44] staging: wlags49_h2: buffer overflow setting station name Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 35/44] Staging: bcm: Create and initialize new device id in InterfaceInit Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 36/44] Staging: bcm: Add two products and remove an existing product Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 37/44] powerpc: Fix emulation of illegal instructions on PowerNV platform Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 38/44] powerpc/smp: Section mismatch from smp_release_cpus to __initdata spinning_secondaries Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 39/44] powerpc: Dont Oops when accessing /proc/powerpc/lparcfg without hypervisor Greg Kroah-Hartman
2014-07-08 0:07 ` Greg Kroah-Hartman [this message]
2014-07-08 0:07 ` [PATCH 3.4 41/44] powerpc/pseries/lparcfg: Fix possible overflow are more than 1026 Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 42/44] powerpc/pseries: Duplicate dtl entries sometimes sent to userspace Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 43/44] ACPI video: ignore BIOS backlight value for HP dm4 Greg Kroah-Hartman
2014-07-08 0:07 ` [PATCH 3.4 44/44] powerpc/sysfs: Disable writing to PURR in guest mode Greg Kroah-Hartman
2014-07-08 13:14 ` [PATCH 3.4 00/44] 3.4.98-stable review Guenter Roeck
2014-07-08 22:14 ` Greg Kroah-Hartman
2014-07-08 19:30 ` Shuah Khan
2014-07-08 22:14 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140707235859.835406315@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=anton@samba.org \
--cc=ben@decadent.org.uk \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=stable@vger.kernel.org \
--cc=wangyijing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox