diff --git a/arch/x86/entry/syscall_64.c b/arch/x86/entry/syscall_64.c index 71f032504e73..337e3e53d262 100644 --- a/arch/x86/entry/syscall_64.c +++ b/arch/x86/entry/syscall_64.c @@ -9,6 +9,14 @@ #include #include +#ifdef CONFIG_CALL_PADDING +# define _pfe(x) __attribute((patchable_function_entry(x,x))) +#else +# define _pfe(x) +#endif +#define _align_func(x) __aligned(x) _pfe(x-CONFIG_FUNCTION_ALIGNMENT+CONFIG_FUNCTION_PADDING_BYTES) +#define align_func(x) _align_func((x) < CONFIG_FUNCTION_ALIGNMENT ? CONFIG_FUNCTION_ALIGNMENT : (x)) + #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *); #define __SYSCALL_NORETURN(nr, sym) extern long __noreturn __x64_##sym(const struct pt_regs *); #include @@ -32,7 +40,7 @@ const sys_call_ptr_t sys_call_table[] = { #undef __SYSCALL #define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs); -long x64_sys_call(const struct pt_regs *regs, unsigned int nr) +long align_func(32) x64_sys_call(const struct pt_regs *regs, unsigned int nr) { switch (nr) { #include @@ -41,7 +49,7 @@ long x64_sys_call(const struct pt_regs *regs, unsigned int nr) } #ifdef CONFIG_X86_X32_ABI -long x32_sys_call(const struct pt_regs *regs, unsigned int nr) +long align_func(32) x32_sys_call(const struct pt_regs *regs, unsigned int nr) { switch (nr) { #include