Skip to content

Commit 80a3e39

Browse files
Andi KleenKAGA-KOKO
authored andcommitted
x86/extable: Mark exception handler functions visible
Mark the C exception handler functions that are directly called through exception tables visible. LTO needs to know they are accessed from assembler. [ tglx: Mopped up the wrecked argument alignment. Sigh.... ] Signed-off-by: Andi Kleen <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 7cf1aaa commit 80a3e39

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

arch/x86/mm/extable.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ ex_fixup_handler(const struct exception_table_entry *x)
2121
return (ex_handler_t)((unsigned long)&x->handler + x->handler);
2222
}
2323

24-
bool ex_handler_default(const struct exception_table_entry *fixup,
25-
struct pt_regs *regs, int trapnr)
24+
__visible bool ex_handler_default(const struct exception_table_entry *fixup,
25+
struct pt_regs *regs, int trapnr)
2626
{
2727
regs->ip = ex_fixup_addr(fixup);
2828
return true;
2929
}
3030
EXPORT_SYMBOL(ex_handler_default);
3131

32-
bool ex_handler_fault(const struct exception_table_entry *fixup,
33-
struct pt_regs *regs, int trapnr)
32+
__visible bool ex_handler_fault(const struct exception_table_entry *fixup,
33+
struct pt_regs *regs, int trapnr)
3434
{
3535
regs->ip = ex_fixup_addr(fixup);
3636
regs->ax = trapnr;
@@ -42,8 +42,8 @@ EXPORT_SYMBOL_GPL(ex_handler_fault);
4242
* Handler for UD0 exception following a failed test against the
4343
* result of a refcount inc/dec/add/sub.
4444
*/
45-
bool ex_handler_refcount(const struct exception_table_entry *fixup,
46-
struct pt_regs *regs, int trapnr)
45+
__visible bool ex_handler_refcount(const struct exception_table_entry *fixup,
46+
struct pt_regs *regs, int trapnr)
4747
{
4848
/* First unconditionally saturate the refcount. */
4949
*(int *)regs->cx = INT_MIN / 2;
@@ -95,8 +95,8 @@ EXPORT_SYMBOL(ex_handler_refcount);
9595
* of vulnerability by restoring from the initial state (essentially, zeroing
9696
* out all the FPU registers) if we can't restore from the task's FPU state.
9797
*/
98-
bool ex_handler_fprestore(const struct exception_table_entry *fixup,
99-
struct pt_regs *regs, int trapnr)
98+
__visible bool ex_handler_fprestore(const struct exception_table_entry *fixup,
99+
struct pt_regs *regs, int trapnr)
100100
{
101101
regs->ip = ex_fixup_addr(fixup);
102102

@@ -108,8 +108,8 @@ bool ex_handler_fprestore(const struct exception_table_entry *fixup,
108108
}
109109
EXPORT_SYMBOL_GPL(ex_handler_fprestore);
110110

111-
bool ex_handler_ext(const struct exception_table_entry *fixup,
112-
struct pt_regs *regs, int trapnr)
111+
__visible bool ex_handler_ext(const struct exception_table_entry *fixup,
112+
struct pt_regs *regs, int trapnr)
113113
{
114114
/* Special hack for uaccess_err */
115115
current->thread.uaccess_err = 1;
@@ -118,8 +118,8 @@ bool ex_handler_ext(const struct exception_table_entry *fixup,
118118
}
119119
EXPORT_SYMBOL(ex_handler_ext);
120120

121-
bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup,
122-
struct pt_regs *regs, int trapnr)
121+
__visible bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup,
122+
struct pt_regs *regs, int trapnr)
123123
{
124124
if (pr_warn_once("unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pF)\n",
125125
(unsigned int)regs->cx, regs->ip, (void *)regs->ip))
@@ -133,8 +133,8 @@ bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup,
133133
}
134134
EXPORT_SYMBOL(ex_handler_rdmsr_unsafe);
135135

136-
bool ex_handler_wrmsr_unsafe(const struct exception_table_entry *fixup,
137-
struct pt_regs *regs, int trapnr)
136+
__visible bool ex_handler_wrmsr_unsafe(const struct exception_table_entry *fixup,
137+
struct pt_regs *regs, int trapnr)
138138
{
139139
if (pr_warn_once("unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08x%08x) at rIP: 0x%lx (%pF)\n",
140140
(unsigned int)regs->cx, (unsigned int)regs->dx,
@@ -147,8 +147,8 @@ bool ex_handler_wrmsr_unsafe(const struct exception_table_entry *fixup,
147147
}
148148
EXPORT_SYMBOL(ex_handler_wrmsr_unsafe);
149149

150-
bool ex_handler_clear_fs(const struct exception_table_entry *fixup,
151-
struct pt_regs *regs, int trapnr)
150+
__visible bool ex_handler_clear_fs(const struct exception_table_entry *fixup,
151+
struct pt_regs *regs, int trapnr)
152152
{
153153
if (static_cpu_has(X86_BUG_NULL_SEG))
154154
asm volatile ("mov %0, %%fs" : : "rm" (__USER_DS));
@@ -157,7 +157,7 @@ bool ex_handler_clear_fs(const struct exception_table_entry *fixup,
157157
}
158158
EXPORT_SYMBOL(ex_handler_clear_fs);
159159

160-
bool ex_has_fault_handler(unsigned long ip)
160+
__visible bool ex_has_fault_handler(unsigned long ip)
161161
{
162162
const struct exception_table_entry *e;
163163
ex_handler_t handler;

0 commit comments

Comments
 (0)