From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.4 30/37] sparc64: Convert GENcopy_{from,to}_user to accurate exception reporting.
Date: Sat, 19 Nov 2016 10:20:46 +0100 [thread overview]
Message-ID: <20161119092011.517928827@linuxfoundation.org> (raw)
In-Reply-To: <20161119092010.016555184@linuxfoundation.org>
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <davem@davemloft.net>
[ Upstream commit d0796b555ba60c22eb41ae39a8362156cb08eee9 ]
Report the exact number of bytes which have not been successfully
copied when an exception occurs, using the running remaining length.
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/sparc/lib/GENcopy_from_user.S | 4 +--
arch/sparc/lib/GENcopy_to_user.S | 4 +--
arch/sparc/lib/GENmemcpy.S | 48 ++++++++++++++++++++++++++-----------
3 files changed, 38 insertions(+), 18 deletions(-)
--- a/arch/sparc/lib/GENcopy_from_user.S
+++ b/arch/sparc/lib/GENcopy_from_user.S
@@ -3,11 +3,11 @@
* Copyright (C) 2007 David S. Miller (davem@davemloft.net)
*/
-#define EX_LD(x) \
+#define EX_LD(x,y) \
98: x; \
.section __ex_table,"a";\
.align 4; \
- .word 98b, __retl_mone; \
+ .word 98b, y; \
.text; \
.align 4;
--- a/arch/sparc/lib/GENcopy_to_user.S
+++ b/arch/sparc/lib/GENcopy_to_user.S
@@ -3,11 +3,11 @@
* Copyright (C) 2007 David S. Miller (davem@davemloft.net)
*/
-#define EX_ST(x) \
+#define EX_ST(x,y) \
98: x; \
.section __ex_table,"a";\
.align 4; \
- .word 98b, __retl_mone; \
+ .word 98b, y; \
.text; \
.align 4;
--- a/arch/sparc/lib/GENmemcpy.S
+++ b/arch/sparc/lib/GENmemcpy.S
@@ -4,21 +4,18 @@
*/
#ifdef __KERNEL__
+#include <linux/linkage.h>
#define GLOBAL_SPARE %g7
#else
#define GLOBAL_SPARE %g5
#endif
#ifndef EX_LD
-#define EX_LD(x) x
+#define EX_LD(x,y) x
#endif
#ifndef EX_ST
-#define EX_ST(x) x
-#endif
-
-#ifndef EX_RETVAL
-#define EX_RETVAL(x) x
+#define EX_ST(x,y) x
#endif
#ifndef LOAD
@@ -45,6 +42,29 @@
.register %g3,#scratch
.text
+
+#ifndef EX_RETVAL
+#define EX_RETVAL(x) x
+ENTRY(GEN_retl_o4_1)
+ add %o4, %o2, %o4
+ retl
+ add %o4, 1, %o0
+ENDPROC(GEN_retl_o4_1)
+ENTRY(GEN_retl_g1_8)
+ add %g1, %o2, %g1
+ retl
+ add %g1, 8, %o0
+ENDPROC(GEN_retl_g1_8)
+ENTRY(GEN_retl_o2_4)
+ retl
+ add %o2, 4, %o0
+ENDPROC(GEN_retl_o2_4)
+ENTRY(GEN_retl_o2_1)
+ retl
+ add %o2, 1, %o0
+ENDPROC(GEN_retl_o2_1)
+#endif
+
.align 64
.globl FUNC_NAME
@@ -73,8 +93,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len
sub %g0, %o4, %o4
sub %o2, %o4, %o2
1: subcc %o4, 1, %o4
- EX_LD(LOAD(ldub, %o1, %g1))
- EX_ST(STORE(stb, %g1, %o0))
+ EX_LD(LOAD(ldub, %o1, %g1),GEN_retl_o4_1)
+ EX_ST(STORE(stb, %g1, %o0),GEN_retl_o4_1)
add %o1, 1, %o1
bne,pt %XCC, 1b
add %o0, 1, %o0
@@ -82,8 +102,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len
andn %o2, 0x7, %g1
sub %o2, %g1, %o2
1: subcc %g1, 0x8, %g1
- EX_LD(LOAD(ldx, %o1, %g2))
- EX_ST(STORE(stx, %g2, %o0))
+ EX_LD(LOAD(ldx, %o1, %g2),GEN_retl_g1_8)
+ EX_ST(STORE(stx, %g2, %o0),GEN_retl_g1_8)
add %o1, 0x8, %o1
bne,pt %XCC, 1b
add %o0, 0x8, %o0
@@ -100,8 +120,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len
1:
subcc %o2, 4, %o2
- EX_LD(LOAD(lduw, %o1, %g1))
- EX_ST(STORE(stw, %g1, %o1 + %o3))
+ EX_LD(LOAD(lduw, %o1, %g1),GEN_retl_o2_4)
+ EX_ST(STORE(stw, %g1, %o1 + %o3),GEN_retl_o2_4)
bgu,pt %XCC, 1b
add %o1, 4, %o1
@@ -111,8 +131,8 @@ FUNC_NAME: /* %o0=dst, %o1=src, %o2=len
.align 32
90:
subcc %o2, 1, %o2
- EX_LD(LOAD(ldub, %o1, %g1))
- EX_ST(STORE(stb, %g1, %o1 + %o3))
+ EX_LD(LOAD(ldub, %o1, %g1),GEN_retl_o2_1)
+ EX_ST(STORE(stb, %g1, %o1 + %o3),GEN_retl_o2_1)
bgu,pt %XCC, 90b
add %o1, 1, %o1
retl
next prev parent reply other threads:[~2016-11-19 9:22 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20161119092048epcas3p1db29198af4c10269f85a6b2169f469d8@epcas3p1.samsung.com>
2016-11-19 9:20 ` [PATCH 4.4 00/37] 4.4.34-stable review Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 01/37] dctcp: avoid bogus doubling of cwnd after loss Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 02/37] net: clear sk_err_soft in sk_clone_lock() Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 04/37] bgmac: stop clearing DMA receive control register right after it is set Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 05/37] ip6_tunnel: Clear IP6CB in ip6tunnel_xmit() Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 07/37] dccp: do not send reset to already closed sockets Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 08/37] dccp: fix out of bound access in dccp_v4_err() Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 09/37] ipv6: dccp: fix out of bound access in dccp_v6_err() Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 10/37] ipv6: dccp: add missing bind_conflict to dccp_ipv6_mapped Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 11/37] sctp: assign assoc_id earlier in __sctp_connect Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 12/37] fib_trie: Correct /proc/net/route off by one error Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 14/37] net: __skb_flow_dissect() must cap its return value Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 15/37] ipv4: use new_gw for redirect neigh lookup Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 16/37] tcp: take care of truncations done by sk_filter() Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 17/37] tty: Prevent ldisc drivers from re-using stale tty fields Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 18/37] sparc: Dont leak context bits into thread->fault_address Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 19/37] sparc: serial: sunhv: fix a double lock bug Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 20/37] sparc64 mm: Fix base TSB sizing when hugetlb pages are used Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 21/37] sparc: Handle negative offsets in arch_jump_label_transform Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 22/37] sparc64: Handle extremely large kernel TSB range flushes sanely Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 23/37] sparc64: Fix illegal relative branches in hypervisor patched TLB code Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 24/37] sparc64: Fix instruction count in comment for __hypervisor_flush_tlb_pending Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 25/37] sparc64: Fix illegal relative branches in hypervisor patched TLB cross-call code Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 26/37] sparc64: Handle extremely large kernel TLB range flushes more gracefully Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 27/37] sparc64: Delete __ret_efault Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 28/37] sparc64: Prepare to move to more saner user copy exception handling Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 29/37] sparc64: Convert copy_in_user to accurate exception reporting Greg Kroah-Hartman
2016-11-19 9:20 ` Greg Kroah-Hartman [this message]
2016-11-19 9:20 ` [PATCH 4.4 31/37] sparc64: Convert U1copy_{from,to}_user " Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 32/37] sparc64: Convert NG4copy_{from,to}_user " Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 33/37] sparc64: Convert NGcopy_{from,to}_user " Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 34/37] sparc64: Convert NG2copy_{from,to}_user " Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 35/37] sparc64: Convert U3copy_{from,to}_user " Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 36/37] sparc64: Delete now unused user copy assembler helpers Greg Kroah-Hartman
2016-11-19 9:20 ` [PATCH 4.4 37/37] sparc64: Delete now unused user copy fixup functions Greg Kroah-Hartman
2016-11-19 16:20 ` [PATCH 4.4 00/37] 4.4.34-stable review Guenter Roeck
2016-11-21 16:32 ` Shuah Khan
2016-11-21 16:49 ` 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=20161119092011.517928827@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).