Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1525932
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.4 23/37] sparc64: Fix illegal relative branches in hypervisor patched TLB code. |
| Date | 2016-11-19 10:30 +0100 |
| Message-ID | <sFa8c-33e-115@gated-at.bofh.it> (permalink) |
| References | <sFa89-33e-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: "David S. Miller" <davem@davemloft.net> [ Upstream commit b429ae4d5b565a71dfffd759dfcd4f6c093ced94 ] When we copy code over to patch another piece of code, we can only use PC-relative branches that target code within that piece of code. Such PC-relative branches cannot be made to external symbols because the patch moves the location of the code and thus modifies the relative address of external symbols. Use an absolute jmpl to fix this problem. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- arch/sparc/mm/ultra.S | 65 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 14 deletions(-) --- a/arch/sparc/mm/ultra.S +++ b/arch/sparc/mm/ultra.S @@ -30,7 +30,7 @@ .text .align 32 .globl __flush_tlb_mm -__flush_tlb_mm: /* 18 insns */ +__flush_tlb_mm: /* 19 insns */ /* %o0=(ctx & TAG_CONTEXT_BITS), %o1=SECONDARY_CONTEXT */ ldxa [%o1] ASI_DMMU, %g2 cmp %g2, %o0 @@ -81,7 +81,7 @@ __flush_tlb_page: /* 22 insns */ .align 32 .globl __flush_tlb_pending -__flush_tlb_pending: /* 26 insns */ +__flush_tlb_pending: /* 27 insns */ /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ rdpr %pstate, %g7 sllx %o1, 3, %o1 @@ -113,7 +113,7 @@ __flush_tlb_pending: /* 26 insns */ .align 32 .globl __flush_tlb_kernel_range -__flush_tlb_kernel_range: /* 16 insns */ +__flush_tlb_kernel_range: /* 19 insns */ /* %o0=start, %o1=end */ cmp %o0, %o1 be,pn %xcc, 2f @@ -131,6 +131,9 @@ __flush_tlb_kernel_range: /* 16 insns */ retl nop nop + nop + nop + nop __spitfire_flush_tlb_mm_slow: rdpr %pstate, %g1 @@ -309,19 +312,28 @@ __hypervisor_tlb_tl0_error: ret restore -__hypervisor_flush_tlb_mm: /* 10 insns */ +__hypervisor_flush_tlb_mm: /* 19 insns */ mov %o0, %o2 /* ARG2: mmu context */ mov 0, %o0 /* ARG0: CPU lists unimplemented */ mov 0, %o1 /* ARG1: CPU lists unimplemented */ mov HV_MMU_ALL, %o3 /* ARG3: flags */ mov HV_FAST_MMU_DEMAP_CTX, %o5 ta HV_FAST_TRAP - brnz,pn %o0, __hypervisor_tlb_tl0_error + brnz,pn %o0, 1f mov HV_FAST_MMU_DEMAP_CTX, %o1 retl nop +1: sethi %hi(__hypervisor_tlb_tl0_error), %o5 + jmpl %o5 + %lo(__hypervisor_tlb_tl0_error), %g0 + nop + nop + nop + nop + nop + nop + nop -__hypervisor_flush_tlb_page: /* 11 insns */ +__hypervisor_flush_tlb_page: /* 22 insns */ /* %o0 = context, %o1 = vaddr */ mov %o0, %g2 mov %o1, %o0 /* ARG0: vaddr + IMMU-bit */ @@ -330,10 +342,21 @@ __hypervisor_flush_tlb_page: /* 11 insns srlx %o0, PAGE_SHIFT, %o0 sllx %o0, PAGE_SHIFT, %o0 ta HV_MMU_UNMAP_ADDR_TRAP - brnz,pn %o0, __hypervisor_tlb_tl0_error + brnz,pn %o0, 1f mov HV_MMU_UNMAP_ADDR_TRAP, %o1 retl nop +1: sethi %hi(__hypervisor_tlb_tl0_error), %o2 + jmpl %o2 + %lo(__hypervisor_tlb_tl0_error), %g0 + nop + nop + nop + nop + nop + nop + nop + nop + nop __hypervisor_flush_tlb_pending: /* 16 insns */ /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ @@ -347,14 +370,25 @@ __hypervisor_flush_tlb_pending: /* 16 in srlx %o0, PAGE_SHIFT, %o0 sllx %o0, PAGE_SHIFT, %o0 ta HV_MMU_UNMAP_ADDR_TRAP - brnz,pn %o0, __hypervisor_tlb_tl0_error + brnz,pn %o0, 1f mov HV_MMU_UNMAP_ADDR_TRAP, %o1 brnz,pt %g1, 1b nop retl nop +1: sethi %hi(__hypervisor_tlb_tl0_error), %o2 + jmpl %o2 + %lo(__hypervisor_tlb_tl0_error), %g0 + nop + nop + nop + nop + nop + nop + nop + nop + nop -__hypervisor_flush_tlb_kernel_range: /* 16 insns */ +__hypervisor_flush_tlb_kernel_range: /* 19 insns */ /* %o0=start, %o1=end */ cmp %o0, %o1 be,pn %xcc, 2f @@ -366,12 +400,15 @@ __hypervisor_flush_tlb_kernel_range: /* mov 0, %o1 /* ARG1: mmu context */ mov HV_MMU_ALL, %o2 /* ARG2: flags */ ta HV_MMU_UNMAP_ADDR_TRAP - brnz,pn %o0, __hypervisor_tlb_tl0_error + brnz,pn %o0, 3f mov HV_MMU_UNMAP_ADDR_TRAP, %o1 brnz,pt %g2, 1b sub %g2, %g3, %g2 2: retl nop +3: sethi %hi(__hypervisor_tlb_tl0_error), %o2 + jmpl %o2 + %lo(__hypervisor_tlb_tl0_error), %g0 + nop #ifdef DCACHE_ALIASING_POSSIBLE /* XXX Niagara and friends have an 8K cache, so no aliasing is @@ -819,28 +856,28 @@ hypervisor_patch_cachetlbops: sethi %hi(__hypervisor_flush_tlb_mm), %o1 or %o1, %lo(__hypervisor_flush_tlb_mm), %o1 call tlb_patch_one - mov 10, %o2 + mov 19, %o2 sethi %hi(__flush_tlb_page), %o0 or %o0, %lo(__flush_tlb_page), %o0 sethi %hi(__hypervisor_flush_tlb_page), %o1 or %o1, %lo(__hypervisor_flush_tlb_page), %o1 call tlb_patch_one - mov 11, %o2 + mov 22, %o2 sethi %hi(__flush_tlb_pending), %o0 or %o0, %lo(__flush_tlb_pending), %o0 sethi %hi(__hypervisor_flush_tlb_pending), %o1 or %o1, %lo(__hypervisor_flush_tlb_pending), %o1 call tlb_patch_one - mov 16, %o2 + mov 27, %o2 sethi %hi(__flush_tlb_kernel_range), %o0 or %o0, %lo(__flush_tlb_kernel_range), %o0 sethi %hi(__hypervisor_flush_tlb_kernel_range), %o1 or %o1, %lo(__hypervisor_flush_tlb_kernel_range), %o1 call tlb_patch_one - mov 16, %o2 + mov 19, %o2 #ifdef DCACHE_ALIASING_POSSIBLE sethi %hi(__flush_dcache_page), %o0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.4 00/37] 4.4.34-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 31/37] sparc64: Convert U1copy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 02/37] net: clear sk_err_soft in sk_clone_lock() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 12/37] fib_trie: Correct /proc/net/route off by one error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 27/37] sparc64: Delete __ret_efault. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 25/37] sparc64: Fix illegal relative branches in hypervisor patched TLB cross-call code. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 10/37] ipv6: dccp: add missing bind_conflict to dccp_ipv6_mapped Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 32/37] sparc64: Convert NG4copy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 24/37] sparc64: Fix instruction count in comment for __hypervisor_flush_tlb_pending. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 07/37] dccp: do not send reset to already closed sockets Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 14/37] net: __skb_flow_dissect() must cap its return value Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 30/37] sparc64: Convert GENcopy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 05/37] ip6_tunnel: Clear IP6CB in ip6tunnel_xmit() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 35/37] sparc64: Convert U3copy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 33/37] sparc64: Convert NGcopy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 11/37] sctp: assign assoc_id earlier in __sctp_connect Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 19/37] sparc: serial: sunhv: fix a double lock bug Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 16/37] tcp: take care of truncations done by sk_filter() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 23/37] sparc64: Fix illegal relative branches in hypervisor patched TLB code. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:30 +0100
[PATCH 4.4 36/37] sparc64: Delete now unused user copy assembler helpers. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 09/37] ipv6: dccp: fix out of bound access in dccp_v6_err() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 17/37] tty: Prevent ldisc drivers from re-using stale tty fields Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 26/37] sparc64: Handle extremely large kernel TLB range flushes more gracefully. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 29/37] sparc64: Convert copy_in_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 34/37] sparc64: Convert NG2copy_{from,to}_user to accurate exception reporting. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 15/37] ipv4: use new_gw for redirect neigh lookup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 37/37] sparc64: Delete now unused user copy fixup functions. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:40 +0100
[PATCH 4.4 01/37] dctcp: avoid bogus doubling of cwnd after loss Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
[PATCH 4.4 20/37] sparc64 mm: Fix base TSB sizing when hugetlb pages are used Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
[PATCH 4.4 04/37] bgmac: stop clearing DMA receive control register right after it is set Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
[PATCH 4.4 21/37] sparc: Handle negative offsets in arch_jump_label_transform Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
[PATCH 4.4 08/37] dccp: fix out of bound access in dccp_v4_err() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
[PATCH 4.4 22/37] sparc64: Handle extremely large kernel TSB range flushes sanely. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-19 10:50 +0100
Re: [PATCH 4.4 00/37] 4.4.34-stable review Guenter Roeck <linux@roeck-us.net> - 2016-11-19 17:30 +0100
Re: [PATCH 4.4 00/37] 4.4.34-stable review Shuah Khan <shuah.kh@samsung.com> - 2016-11-21 17:40 +0100
Re: [PATCH 4.4 00/37] 4.4.34-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-11-21 17:50 +0100
csiph-web