This is a note to let you know that I've just added the patch titled sparc64: Convert GENcopy_{from,to}_user to accurate exception reporting. to the 4.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sparc64-convert-gencopy_-from-to-_user-to-accurate-exception-reporting.patch and it can be found in the queue-4.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sat Nov 19 09:52:59 CET 2016 From: "David S. Miller" <davem@xxxxxxxxxxxxx> Date: Mon, 15 Aug 2016 15:26:38 -0700 Subject: sparc64: Convert GENcopy_{from,to}_user to accurate exception reporting. From: "David S. Miller" <davem@xxxxxxxxxxxxx> [ 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@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxxxxx) */ -#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@xxxxxxxxxxxxx) */ -#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 Patches currently in stable-queue which might be from davem@xxxxxxxxxxxxx are queue-4.8/sparc64-delete-now-unused-user-copy-fixup-functions.patch queue-4.8/net-__skb_flow_dissect-must-cap-its-return-value.patch queue-4.8/tcp-take-care-of-truncations-done-by-sk_filter.patch queue-4.8/net-clear-sk_err_soft-in-sk_clone_lock.patch queue-4.8/dccp-do-not-release-listeners-too-soon.patch queue-4.8/sparc64-convert-copy_in_user-to-accurate-exception-reporting.patch queue-4.8/net-stmmac-fix-lack-of-link-transition-for-fixed-phys.patch queue-4.8/sparc64-handle-extremely-large-kernel-tlb-range-flushes-more-gracefully.patch queue-4.8/sparc-handle-negative-offsets-in-arch_jump_label_transform.patch queue-4.8/sparc64-delete-__ret_efault.patch queue-4.8/dctcp-avoid-bogus-doubling-of-cwnd-after-loss.patch queue-4.8/sparc64-delete-now-unused-user-copy-assembler-helpers.patch queue-4.8/revert-bnx2-reset-device-during-driver-initialization.patch queue-4.8/net-mangle-zero-checksum-in-skb_checksum_help.patch queue-4.8/revert-include-uapi-linux-atm_zatm.h-include-linux-time.h.patch queue-4.8/ipv4-allow-local-fragmentation-in-ip_finish_output_gso.patch queue-4.8/tcp-fix-return-value-for-partial-writes.patch queue-4.8/ip6_tunnel-clear-ip6cb-in-ip6tunnel_xmit.patch queue-4.8/sctp-assign-assoc_id-earlier-in-__sctp_connect.patch queue-4.8/sparc64-convert-ng4copy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/bpf-fix-htab-map-destruction-when-extra-reserve-is-in-use.patch queue-4.8/ipv6-dccp-fix-out-of-bound-access-in-dccp_v6_err.patch queue-4.8/sparc64-convert-u3copy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/sparc64-convert-ng2copy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/sparc64-fix-illegal-relative-branches-in-hypervisor-patched-tlb-code.patch queue-4.8/sparc64-convert-gencopy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/sparc64-convert-u1copy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/sctp-change-sk-state-only-when-it-has-assocs-in-sctp_shutdown.patch queue-4.8/sparc64-prepare-to-move-to-more-saner-user-copy-exception-handling.patch queue-4.8/bnx2-wait-for-in-flight-dma-to-complete-at-probe-stage.patch queue-4.8/bgmac-stop-clearing-dma-receive-control-register-right-after-it-is-set.patch queue-4.8/ipv6-dccp-add-missing-bind_conflict-to-dccp_ipv6_mapped.patch queue-4.8/tcp-fix-potential-memory-corruption.patch queue-4.8/sparc64-convert-ngcopy_-from-to-_user-to-accurate-exception-reporting.patch queue-4.8/fib_trie-correct-proc-net-route-off-by-one-error.patch queue-4.8/mlxsw-spectrum_router-correctly-dump-neighbour-activity.patch queue-4.8/sparc64-fix-illegal-relative-branches-in-hypervisor-patched-tlb-cross-call-code.patch queue-4.8/mlxsw-spectrum-fix-refcount-bug-on-span-entries.patch queue-4.8/sparc64-handle-extremely-large-kernel-tsb-range-flushes-sanely.patch queue-4.8/sparc64-fix-instruction-count-in-comment-for-__hypervisor_flush_tlb_pending.patch queue-4.8/dccp-do-not-send-reset-to-already-closed-sockets.patch queue-4.8/ipv4-use-new_gw-for-redirect-neigh-lookup.patch queue-4.8/net-icmp6_send-should-use-dst-dev-to-determine-l3-domain.patch queue-4.8/dccp-fix-out-of-bound-access-in-dccp_v4_err.patch queue-4.8/net-icmp_route_lookup-should-use-rt-dev-to-determine-l3-domain.patch queue-4.8/sock-fix-sendmmsg-for-partial-sendmsg.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html