History

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

Linus Torvalds committed 2 years ago

Commit d2da77f2 parents 4892711 432668311 files · +43 −34Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t