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
Unified · Split
| @@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64 · 114 unmodified lines | ||
| 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 |
| @@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, · 33 unmodified lines | ||
| 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) " !" \ |
| @@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, · 3 unmodified lines | ||
| 44 | 45 | |
| 45 | 46 | /* to replace one single instructions by a new instruction */ |
| 46 | 47 | #define ALTERNATIVE(from, to, cond, replacement)\ |
| 47 | − .section .altinstructions, "aw" ! \ | |
| 48 | + .section .altinstructions, "a" ! \ | |
| 49 | + .align 4 ! \ | |
| 48 | 50 | .word (from - .) ! \ |
| 49 | 51 | .hword (to - from)/4, cond ! \ |
| 50 | 52 | .word replacement ! \ |
| @@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, · 1 unmodified line | ||
| 52 | 54 | |
| 53 | 55 | /* to replace multiple instructions by new code */ |
| 54 | 56 | #define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\ |
| 55 | − .section .altinstructions, "aw" ! \ | |
| 57 | + .section .altinstructions, "a" ! \ | |
| 58 | + .align 4 ! \ | |
| 56 | 59 | .word (from - .) ! \ |
| 57 | 60 | .hword -num_instructions, cond ! \ |
| 58 | 61 | .word (new_instr_ptr - .) ! \ |
| @@ -574,6 +574,7 @@ · 573 unmodified lines | ||
| 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 | |
| @@ -17,24 +17,27 @@ · 16 unmodified lines | ||
| 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 | |
| @@ -51,10 +54,12 @@ · 10 unmodified lines | ||
| 51 | 54 | do { \ |
| 52 | 55 | asm volatile("\n" \ |
| 53 | 56 | "1:\t" PARISC_BUG_BREAK_ASM "\n" \ |
| 54 | − "\t.pushsection __bug_table,\"aw\"\n" \ | |
| 55 | − "2:\t" ASM_WORD_INSN "1b, %c0\n" \ | |
| 56 | − "\t.short %c1, %c2\n" \ | |
| 57 | − "\t.org 2b+%c3\n" \ | |
| 57 | + "\t.pushsection __bug_table,\"a\"\n" \ | |
| 58 | + "\t.align 4\n" \ | |
| 59 | + "2:\t" __BUG_REL(1b) "\n" \ | |
| 60 | + "\t" __BUG_REL(%c0) "\n" \ | |
| 61 | + "\t.short %1, %2\n" \ | |
| 62 | + "\t.blockz %3-2*4-2*2\n" \ | |
| 58 | 63 | "\t.popsection" \ |
| 59 | 64 | : : "i" (__FILE__), "i" (__LINE__), \ |
| 60 | 65 | "i" (BUGFLAG_WARNING|(flags)), \ |
| @@ -65,10 +70,11 @@ · 4 unmodified lines | ||
| 65 | 70 | do { \ |
| 66 | 71 | asm volatile("\n" \ |
| 67 | 72 | "1:\t" PARISC_BUG_BREAK_ASM "\n" \ |
| 68 | − "\t.pushsection __bug_table,\"aw\"\n" \ | |
| 69 | − "2:\t" ASM_WORD_INSN "1b\n" \ | |
| 70 | − "\t.short %c0\n" \ | |
| 71 | − "\t.org 2b+%c1\n" \ | |
| 73 | + "\t.pushsection __bug_table,\"a\"\n" \ | |
| 74 | + "\t.align %2\n" \ | |
| 75 | + "2:\t" __BUG_REL(1b) "\n" \ | |
| 76 | + "\t.short %0\n" \ | |
| 77 | + "\t.blockz %1-4-2\n" \ | |
| 72 | 78 | "\t.popsection" \ |
| 73 | 79 | : : "i" (BUGFLAG_WARNING|(flags)), \ |
| 74 | 80 | "i" (sizeof(struct bug_entry)) ); \ |
| @@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran · 14 unmodified lines | ||
| 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: |
| @@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool · 5 unmodified lines | ||
| 30 | 32 | asm_volatile_goto("1:\n\t" |
| 31 | 33 | "b,n %l[l_yes]\n\t" |
| 32 | 34 | ".pushsection __jump_table, \"aw\"\n\t" |
| 35 | + ".align %1\n\t" | |
| 33 | 36 | ".word 1b - ., %l[l_yes] - .\n\t" |
| 34 | 37 | __stringify(ASM_ULONG_INSN) " %c0 - .\n\t" |
| 35 | 38 | ".popsection\n\t" |
| 36 | − : : "i" (&((char *)key)[branch]) : : l_yes); | |
| 39 | + : : "i" (&((char *)key)[branch]), "i" (sizeof(long)) | |
| 40 | + : : l_yes); | |
| 37 | 41 | |
| 38 | 42 | return false; |
| 39 | 43 | l_yes: |
| @@ -55,7 +55,7 @@ · 54 unmodified lines | ||
| 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 */ |
| @@ -41,6 +41,7 @@ struct exception_table_entry { · 40 unmodified lines | ||
| 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 | |
| @@ -75,7 +75,6 @@ · 74 unmodified lines | ||
| 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 */ |
| @@ -101,7 +100,6 @@ · 19 unmodified lines | ||
| 101 | 100 | #define ETIMEDOUT 238 /* Connection timed out */ |
| 102 | 101 | #define ECONNREFUSED 239 /* Connection refused */ |
| 103 | 102 | #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ |
| 104 | −#define EREMOTERELEASE 240 /* Remote peer released connection */ | |
| 105 | 103 | #define EHOSTDOWN 241 /* Host is down */ |
| 106 | 104 | #define EHOSTUNREACH 242 /* No route to host */ |
| 107 | 105 | |
| @@ -130,6 +130,7 @@ SECTIONS · 129 unmodified lines | ||
| 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) |
| @@ -111,9 +111,6 @@ static const char *names_0[] = { · 110 unmodified lines | ||
| 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), |
| @@ -144,9 +141,6 @@ static const char *names_0[] = { · 24 unmodified lines | ||
| 144 | 141 | #endif |
| 145 | 142 | E(EREMOTE), |
| 146 | 143 | E(EREMOTEIO), |
| 147 | −#ifdef EREMOTERELEASE | |
| 148 | − E(EREMOTERELEASE), | |
| 149 | −#endif | |
| 150 | 144 | E(ERESTART), |
| 151 | 145 | E(ERFKILL), |
| 152 | 146 | E(EROFS), |
| @@ -75,7 +75,6 @@ · 74 unmodified lines | ||
| 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 */ |
| @@ -101,7 +100,6 @@ · 19 unmodified lines | ||
| 101 | 100 | #define ETIMEDOUT 238 /* Connection timed out */ |
| 102 | 101 | #define ECONNREFUSED 239 /* Connection refused */ |
| 103 | 102 | #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */ |
| 104 | −#define EREMOTERELEASE 240 /* Remote peer released connection */ | |
| 105 | 103 | #define EHOSTDOWN 241 /* Host is down */ |
| 106 | 104 | #define EHOSTUNREACH 242 /* No route to host */ |
| 107 | 105 | |