This is a note to let you know that I've just added the patch titled sparc64: Convert copy_in_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-copy_in_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:08:18 -0700 Subject: sparc64: Convert copy_in_user to accurate exception reporting. From: "David S. Miller" <davem@xxxxxxxxxxxxx> [ Upstream commit 0096ac9f47b1a2e851b3165d44065d18e5f13d58 ] 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/copy_in_user.S | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) --- a/arch/sparc/lib/copy_in_user.S +++ b/arch/sparc/lib/copy_in_user.S @@ -8,18 +8,33 @@ #define XCC xcc -#define EX(x,y) \ +#define EX(x,y,z) \ 98: x,y; \ .section __ex_table,"a";\ .align 4; \ - .word 98b, __retl_mone; \ + .word 98b, z; \ .text; \ .align 4; +#define EX_O4(x,y) EX(x,y,__retl_o4_plus_8) +#define EX_O2_4(x,y) EX(x,y,__retl_o2_plus_4) +#define EX_O2_1(x,y) EX(x,y,__retl_o2_plus_1) + .register %g2,#scratch .register %g3,#scratch .text +__retl_o4_plus_8: + add %o4, %o2, %o4 + retl + add %o4, 8, %o0 +__retl_o2_plus_4: + retl + add %o2, 4, %o0 +__retl_o2_plus_1: + retl + add %o2, 1, %o0 + .align 32 /* Don't try to get too fancy here, just nice and @@ -44,8 +59,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=s andn %o2, 0x7, %o4 and %o2, 0x7, %o2 1: subcc %o4, 0x8, %o4 - EX(ldxa [%o1] %asi, %o5) - EX(stxa %o5, [%o0] %asi) + EX_O4(ldxa [%o1] %asi, %o5) + EX_O4(stxa %o5, [%o0] %asi) add %o1, 0x8, %o1 bgu,pt %XCC, 1b add %o0, 0x8, %o0 @@ -53,8 +68,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=s be,pt %XCC, 1f nop sub %o2, 0x4, %o2 - EX(lduwa [%o1] %asi, %o5) - EX(stwa %o5, [%o0] %asi) + EX_O2_4(lduwa [%o1] %asi, %o5) + EX_O2_4(stwa %o5, [%o0] %asi) add %o1, 0x4, %o1 add %o0, 0x4, %o0 1: cmp %o2, 0 @@ -70,8 +85,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=s 82: subcc %o2, 4, %o2 - EX(lduwa [%o1] %asi, %g1) - EX(stwa %g1, [%o0] %asi) + EX_O2_4(lduwa [%o1] %asi, %g1) + EX_O2_4(stwa %g1, [%o0] %asi) add %o1, 4, %o1 bgu,pt %XCC, 82b add %o0, 4, %o0 @@ -82,8 +97,8 @@ ENTRY(___copy_in_user) /* %o0=dst, %o1=s .align 32 90: subcc %o2, 1, %o2 - EX(lduba [%o1] %asi, %g1) - EX(stba %g1, [%o0] %asi) + EX_O2_1(lduba [%o1] %asi, %g1) + EX_O2_1(stba %g1, [%o0] %asi) add %o1, 1, %o1 bgu,pt %XCC, 90b add %o0, 1, %o0 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