Merge tag 'parisc-for-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:
"This patchset fixes and enforces correct section alignments for the
ex_table, altinstructions, parisc_unwind, jump_table and bug_table
which are created by inline assembly.

Due to not being correctly aligned at link & load time they can
trigger unnecessarily the kernel unaligned exception handler at
runtime. While at it, I switched the bug table to use relative
addresses which reduces the size of the table by half on 64-bit.

We still had the ENOSYM and EREMOTERELEASE errno symbols as left-overs
from HP-UX, which now trigger build-issues with glibc. We can simply
remove them.

Most of the patches are tagged for stable kernel series.

Summary:

- Drop HP-UX ENOSYM and EREMOTERELEASE return codes to avoid glibc
build issues

- Fix section alignments for ex_table, altinstructions, parisc unwind
table, jump_table and bug_table

- Reduce size of bug_table on 64-bit kernel by using relative
pointers"

* tag 'parisc-for-6.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
parisc: Reduce size of the bug_table on 64-bit kernel by half
parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
parisc: Use natural CPU alignment for bug_table
parisc: Ensure 32-bit alignment on parisc unwind section
parisc: Mark lock_aligned variables 16-byte aligned on SMP
parisc: Mark jump_table naturally aligned
parisc: Mark altinstructions read-only and 32-bit aligned
parisc: Mark ex_table entries 32-bit aligned in uaccess.h
parisc: Mark ex_table entries 32-bit aligned in assembly.h

Changed files
+43 -34
arch
lib
tools
arch
parisc
include
uapi
asm
+5 -2
arch/parisc/Kconfig
··· 115 115 default n 116 116 117 117 config GENERIC_BUG 118 - bool 119 - default y 118 + def_bool y 120 119 depends on BUG 120 + select GENERIC_BUG_RELATIVE_POINTERS if 64BIT 121 + 122 + config GENERIC_BUG_RELATIVE_POINTERS 123 + bool 121 124 122 125 config GENERIC_HWEIGHT 123 126 bool
+6 -3
arch/parisc/include/asm/alternative.h
··· 34 34 35 35 /* Alternative SMP implementation. */ 36 36 #define ALTERNATIVE(cond, replacement) "!0:" \ 37 - ".section .altinstructions, \"aw\" !" \ 37 + ".section .altinstructions, \"a\" !" \ 38 + ".align 4 !" \ 38 39 ".word (0b-4-.) !" \ 39 40 ".hword 1, " __stringify(cond) " !" \ 40 41 ".word " __stringify(replacement) " !" \ ··· 45 44 46 45 /* to replace one single instructions by a new instruction */ 47 46 #define ALTERNATIVE(from, to, cond, replacement)\ 48 - .section .altinstructions, "aw" ! \ 47 + .section .altinstructions, "a" ! \ 48 + .align 4 ! \ 49 49 .word (from - .) ! \ 50 50 .hword (to - from)/4, cond ! \ 51 51 .word replacement ! \ ··· 54 52 55 53 /* to replace multiple instructions by new code */ 56 54 #define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\ 57 - .section .altinstructions, "aw" ! \ 55 + .section .altinstructions, "a" ! \ 56 + .align 4 ! \ 58 57 .word (from - .) ! \ 59 58 .hword -num_instructions, cond ! \ 60 59 .word (new_instr_ptr - .) ! \
+1
arch/parisc/include/asm/assembly.h
··· 574 574 */ 575 575 #define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \ 576 576 .section __ex_table,"aw" ! \ 577 + .align 4 ! \ 577 578 .word (fault_addr - .), (except_addr - .) ! \ 578 579 .previous 579 580
+22 -16
arch/parisc/include/asm/bug.h
··· 17 17 #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff" 18 18 #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */ 19 19 20 - #if defined(CONFIG_64BIT) 21 - #define ASM_WORD_INSN ".dword\t" 20 + #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS 21 + # define __BUG_REL(val) ".word " __stringify(val) " - ." 22 22 #else 23 - #define ASM_WORD_INSN ".word\t" 23 + # define __BUG_REL(val) ".word " __stringify(val) 24 24 #endif 25 + 25 26 26 27 #ifdef CONFIG_DEBUG_BUGVERBOSE 27 28 #define BUG() \ 28 29 do { \ 29 30 asm volatile("\n" \ 30 31 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 31 - "\t.pushsection __bug_table,\"aw\"\n" \ 32 - "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 33 - "\t.short %c1, %c2\n" \ 34 - "\t.org 2b+%c3\n" \ 32 + "\t.pushsection __bug_table,\"a\"\n" \ 33 + "\t.align 4\n" \ 34 + "2:\t" __BUG_REL(1b) "\n" \ 35 + "\t" __BUG_REL(%c0) "\n" \ 36 + "\t.short %1, %2\n" \ 37 + "\t.blockz %3-2*4-2*2\n" \ 35 38 "\t.popsection" \ 36 39 : : "i" (__FILE__), "i" (__LINE__), \ 37 - "i" (0), "i" (sizeof(struct bug_entry)) ); \ 40 + "i" (0), "i" (sizeof(struct bug_entry)) ); \ 38 41 unreachable(); \ 39 42 } while(0) 40 43 ··· 54 51 do { \ 55 52 asm volatile("\n" \ 56 53 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 57 - "\t.pushsection __bug_table,\"aw\"\n" \ 58 - "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 59 - "\t.short %c1, %c2\n" \ 60 - "\t.org 2b+%c3\n" \ 54 + "\t.pushsection __bug_table,\"a\"\n" \ 55 + "\t.align 4\n" \ 56 + "2:\t" __BUG_REL(1b) "\n" \ 57 + "\t" __BUG_REL(%c0) "\n" \ 58 + "\t.short %1, %2\n" \ 59 + "\t.blockz %3-2*4-2*2\n" \ 61 60 "\t.popsection" \ 62 61 : : "i" (__FILE__), "i" (__LINE__), \ 63 62 "i" (BUGFLAG_WARNING|(flags)), \ ··· 70 65 do { \ 71 66 asm volatile("\n" \ 72 67 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 73 - "\t.pushsection __bug_table,\"aw\"\n" \ 74 - "2:\t" ASM_WORD_INSN "1b\n" \ 75 - "\t.short %c0\n" \ 76 - "\t.org 2b+%c1\n" \ 68 + "\t.pushsection __bug_table,\"a\"\n" \ 69 + "\t.align %2\n" \ 70 + "2:\t" __BUG_REL(1b) "\n" \ 71 + "\t.short %0\n" \ 72 + "\t.blockz %1-4-2\n" \ 77 73 "\t.popsection" \ 78 74 : : "i" (BUGFLAG_WARNING|(flags)), \ 79 75 "i" (sizeof(struct bug_entry)) ); \
+6 -2
arch/parisc/include/asm/jump_label.h
··· 15 15 asm_volatile_goto("1:\n\t" 16 16 "nop\n\t" 17 17 ".pushsection __jump_table, \"aw\"\n\t" 18 + ".align %1\n\t" 18 19 ".word 1b - ., %l[l_yes] - .\n\t" 19 20 __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" 20 21 ".popsection\n\t" 21 - : : "i" (&((char *)key)[branch]) : : l_yes); 22 + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) 23 + : : l_yes); 22 24 23 25 return false; 24 26 l_yes: ··· 32 30 asm_volatile_goto("1:\n\t" 33 31 "b,n %l[l_yes]\n\t" 34 32 ".pushsection __jump_table, \"aw\"\n\t" 33 + ".align %1\n\t" 35 34 ".word 1b - ., %l[l_yes] - .\n\t" 36 35 __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" 37 36 ".popsection\n\t" 38 - : : "i" (&((char *)key)[branch]) : : l_yes); 37 + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) 38 + : : l_yes); 39 39 40 40 return false; 41 41 l_yes:
+1 -1
arch/parisc/include/asm/ldcw.h
··· 55 55 }) 56 56 57 57 #ifdef CONFIG_SMP 58 - # define __lock_aligned __section(".data..lock_aligned") 58 + # define __lock_aligned __section(".data..lock_aligned") __aligned(16) 59 59 #endif 60 60 61 61 #endif /* __PARISC_LDCW_H */
+1
arch/parisc/include/asm/uaccess.h
··· 41 41 42 42 #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ 43 43 ".section __ex_table,\"aw\"\n" \ 44 + ".align 4\n" \ 44 45 ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \ 45 46 ".previous\n" 46 47
-2
arch/parisc/include/uapi/asm/errno.h
··· 75 75 76 76 /* We now return you to your regularly scheduled HPUX. */ 77 77 78 - #define ENOSYM 215 /* symbol does not exist in executable */ 79 78 #define ENOTSOCK 216 /* Socket operation on non-socket */ 80 79 #define EDESTADDRREQ 217 /* Destination address required */ 81 80 #define EMSGSIZE 218 /* Message too long */ ··· 100 101 #define ETIMEDOUT 238 /* Connection timed out */ 101 102 #define ECONNREFUSED 239 /* Connection refused */ 102 103 #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ 103 - #define EREMOTERELEASE 240 /* Remote peer released connection */ 104 104 #define EHOSTDOWN 241 /* Host is down */ 105 105 #define EHOSTUNREACH 242 /* No route to host */ 106 106
+1
arch/parisc/kernel/vmlinux.lds.S
··· 130 130 RO_DATA(8) 131 131 132 132 /* unwind info */ 133 + . = ALIGN(4); 133 134 .PARISC.unwind : { 134 135 __start___unwind = .; 135 136 *(.PARISC.unwind)
-6
lib/errname.c
··· 111 111 E(ENOSPC), 112 112 E(ENOSR), 113 113 E(ENOSTR), 114 - #ifdef ENOSYM 115 - E(ENOSYM), 116 - #endif 117 114 E(ENOSYS), 118 115 E(ENOTBLK), 119 116 E(ENOTCONN), ··· 141 144 #endif 142 145 E(EREMOTE), 143 146 E(EREMOTEIO), 144 - #ifdef EREMOTERELEASE 145 - E(EREMOTERELEASE), 146 - #endif 147 147 E(ERESTART), 148 148 E(ERFKILL), 149 149 E(EROFS),
-2
tools/arch/parisc/include/uapi/asm/errno.h
··· 75 75 76 76 /* We now return you to your regularly scheduled HPUX. */ 77 77 78 - #define ENOSYM 215 /* symbol does not exist in executable */ 79 78 #define ENOTSOCK 216 /* Socket operation on non-socket */ 80 79 #define EDESTADDRREQ 217 /* Destination address required */ 81 80 #define EMSGSIZE 218 /* Message too long */ ··· 100 101 #define ETIMEDOUT 238 /* Connection timed out */ 101 102 #define ECONNREFUSED 239 /* Connection refused */ 102 103 #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ 103 - #define EREMOTERELEASE 240 /* Remote peer released connection */ 104 104 #define EHOSTDOWN 241 /* Host is down */ 105 105 #define EHOSTUNREACH 242 /* No route to host */ 106 106