Skip to content

Commit d2da77f

Browse files
committed
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
2 parents 4892711 + 4326683 commit d2da77f

File tree

11 files changed

+43
-34
lines changed

11 files changed

+43
-34
lines changed

arch/parisc/Kconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ config ARCH_HAS_ILOG2_U64
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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
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,15 +45,17 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
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 ! \
5153
.previous
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@
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

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,27 @@
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 @@
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 @@
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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran
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
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct exception_table_entry {
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
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 @@
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ SECTIONS
130130
RO_DATA(8)
131131

132132
/* unwind info */
133+
. = ALIGN(4);
133134
.PARISC.unwind : {
134135
__start___unwind = .;
135136
*(.PARISC.unwind)

lib/errname.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ static const char *names_0[] = {
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[] = {
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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
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 @@
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

0 commit comments

Comments
 (0)