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
115115 default n
116116
117117 config GENERIC_BUG
118− bool
119− default y
118+ def_bool y
120119 depends on BUG
120+ select GENERIC_BUG_RELATIVE_POINTERS if 64BIT
121+
122+config GENERIC_BUG_RELATIVE_POINTERS
123+ bool
121124
122125 config GENERIC_HWEIGHT
123126 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
3434
3535 /* Alternative SMP implementation. */
3636 #define ALTERNATIVE(cond, replacement) "!0:" \
37− ".section .altinstructions, \"aw\" !" \
37+ ".section .altinstructions, \"a\" !" \
38+ ".align 4 !" \
3839 ".word (0b-4-.) !" \
3940 ".hword 1, " __stringify(cond) " !" \
4041 ".word " __stringify(replacement) " !" \
@@ -44,7 +45,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, · 3 unmodified lines
4445
4546 /* to replace one single instructions by a new instruction */
4647 #define ALTERNATIVE(from, to, cond, replacement)\
47− .section .altinstructions, "aw" ! \
48+ .section .altinstructions, "a" ! \
49+ .align 4 ! \
4850 .word (from - .) ! \
4951 .hword (to - from)/4, cond ! \
5052 .word replacement ! \
@@ -52,7 +54,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end, · 1 unmodified line
5254
5355 /* to replace multiple instructions by new code */
5456 #define ALTERNATIVE_CODE(from, num_instructions, cond, new_instr_ptr)\
55− .section .altinstructions, "aw" ! \
57+ .section .altinstructions, "a" ! \
58+ .align 4 ! \
5659 .word (from - .) ! \
5760 .hword -num_instructions, cond ! \
5861 .word (new_instr_ptr - .) ! \
arch/parisc/include/asm/assembly.h+1−0
@@ -574,6 +574,7 @@ · 573 unmodified lines
574574 */
575575 #define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \
576576 .section __ex_table,"aw" ! \
577+ .align 4 ! \
577578 .word (fault_addr - .), (except_addr - .) ! \
578579 .previous
579580
arch/parisc/include/asm/bug.h+22−16
@@ -17,24 +17,27 @@ · 16 unmodified lines
1717 #define PARISC_BUG_BREAK_ASM "break 0x1f, 0x1fff"
1818 #define PARISC_BUG_BREAK_INSN 0x03ffe01f /* PARISC_BUG_BREAK_ASM */
1919
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) " - ."
2222 #else
23−#define ASM_WORD_INSN ".word\t"
23+# define __BUG_REL(val) ".word " __stringify(val)
2424 #endif
2525
26+
2627 #ifdef CONFIG_DEBUG_BUGVERBOSE
2728 #define BUG() \
2829 do { \
2930 asm volatile("\n" \
3031 "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" \
3538 "\t.popsection" \
3639 : : "i" (__FILE__), "i" (__LINE__), \
37− "i" (0), "i" (sizeof(struct bug_entry)) ); \
40+ "i" (0), "i" (sizeof(struct bug_entry)) ); \
3841 unreachable(); \
3942 } while(0)
4043
@@ -51,10 +54,12 @@ · 10 unmodified lines
5154 do { \
5255 asm volatile("\n" \
5356 "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" \
5863 "\t.popsection" \
5964 : : "i" (__FILE__), "i" (__LINE__), \
6065 "i" (BUGFLAG_WARNING|(flags)), \
@@ -65,10 +70,11 @@ · 4 unmodified lines
6570 do { \
6671 asm volatile("\n" \
6772 "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" \
7278 "\t.popsection" \
7379 : : "i" (BUGFLAG_WARNING|(flags)), \
7480 "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
1515 asm_volatile_goto("1:\n\t"
1616 "nop\n\t"
1717 ".pushsection __jump_table, \"aw\"\n\t"
18+ ".align %1\n\t"
1819 ".word 1b - ., %l[l_yes] - .\n\t"
1920 __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
2021 ".popsection\n\t"
21− : : "i" (&((char *)key)[branch]) : : l_yes);
22+ : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
23+ : : l_yes);
2224
2325 return false;
2426 l_yes:
@@ -30,10 +32,12 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool · 5 unmodified lines
3032 asm_volatile_goto("1:\n\t"
3133 "b,n %l[l_yes]\n\t"
3234 ".pushsection __jump_table, \"aw\"\n\t"
35+ ".align %1\n\t"
3336 ".word 1b - ., %l[l_yes] - .\n\t"
3437 __stringify(ASM_ULONG_INSN) " %c0 - .\n\t"
3538 ".popsection\n\t"
36− : : "i" (&((char *)key)[branch]) : : l_yes);
39+ : : "i" (&((char *)key)[branch]), "i" (sizeof(long))
40+ : : l_yes);
3741
3842 return false;
3943 l_yes:
arch/parisc/include/asm/ldcw.h+1−1
@@ -55,7 +55,7 @@ · 54 unmodified lines
5555 })
5656
5757 #ifdef CONFIG_SMP
58−# define __lock_aligned __section(".data..lock_aligned")
58+# define __lock_aligned __section(".data..lock_aligned") __aligned(16)
5959 #endif
6060
6161 #endif /* __PARISC_LDCW_H */
arch/parisc/include/asm/uaccess.h+1−0
@@ -41,6 +41,7 @@ struct exception_table_entry { · 40 unmodified lines
4141
4242 #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
4343 ".section __ex_table,\"aw\"\n" \
44+ ".align 4\n" \
4445 ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \
4546 ".previous\n"
4647
arch/parisc/include/uapi/asm/errno.h+0−2
@@ -75,7 +75,6 @@ · 74 unmodified lines
7575
7676 /* We now return you to your regularly scheduled HPUX. */
7777
78−#define ENOSYM 215 /* symbol does not exist in executable */
7978 #define ENOTSOCK 216 /* Socket operation on non-socket */
8079 #define EDESTADDRREQ 217 /* Destination address required */
8180 #define EMSGSIZE 218 /* Message too long */
@@ -101,7 +100,6 @@ · 19 unmodified lines
101100 #define ETIMEDOUT 238 /* Connection timed out */
102101 #define ECONNREFUSED 239 /* Connection refused */
103102 #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
104−#define EREMOTERELEASE 240 /* Remote peer released connection */
105103 #define EHOSTDOWN 241 /* Host is down */
106104 #define EHOSTUNREACH 242 /* No route to host */
107105
arch/parisc/kernel/vmlinux.lds.S+1−0
@@ -130,6 +130,7 @@ SECTIONS · 129 unmodified lines
130130 RO_DATA(8)
131131
132132 /* unwind info */
133+ . = ALIGN(4);
133134 .PARISC.unwind : {
134135 __start___unwind = .;
135136 *(.PARISC.unwind)
lib/errname.c+0−6
@@ -111,9 +111,6 @@ static const char *names_0[] = { · 110 unmodified lines
111111 E(ENOSPC),
112112 E(ENOSR),
113113 E(ENOSTR),
114−#ifdef ENOSYM
115− E(ENOSYM),
116−#endif
117114 E(ENOSYS),
118115 E(ENOTBLK),
119116 E(ENOTCONN),
@@ -144,9 +141,6 @@ static const char *names_0[] = { · 24 unmodified lines
144141 #endif
145142 E(EREMOTE),
146143 E(EREMOTEIO),
147−#ifdef EREMOTERELEASE
148− E(EREMOTERELEASE),
149−#endif
150144 E(ERESTART),
151145 E(ERFKILL),
152146 E(EROFS),
tools/arch/parisc/include/uapi/asm/errno.h+0−2
@@ -75,7 +75,6 @@ · 74 unmodified lines
7575
7676 /* We now return you to your regularly scheduled HPUX. */
7777
78−#define ENOSYM 215 /* symbol does not exist in executable */
7978 #define ENOTSOCK 216 /* Socket operation on non-socket */
8079 #define EDESTADDRREQ 217 /* Destination address required */
8180 #define EMSGSIZE 218 /* Message too long */
@@ -101,7 +100,6 @@ · 19 unmodified lines
101100 #define ETIMEDOUT 238 /* Connection timed out */
102101 #define ECONNREFUSED 239 /* Connection refused */
103102 #define EREFUSED ECONNREFUSED /* for HP's NFS apparently */
104−#define EREMOTERELEASE 240 /* Remote peer released connection */
105103 #define EHOSTDOWN 241 /* Host is down */
106104 #define EHOSTUNREACH 242 /* No route to host */
107105

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