macros: add v6.1 powerpc syscall macros

Kernel v6.1+ commit 7e92e01b7245 ("powerpc: Provide syscall wrapper")
introduced PowerPC specific macros.  Add them to kpatch-syscall.h.

WIP: the syscall.patch integration test required
-fno-optimize-sibling-calls for sys_newuname() ... should we move the
attribute out to the patch?

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
Joe Lawrence 2023-01-16 09:33:55 -05:00
parent 934b3b3c0c
commit e707515cb1
1 changed files with 29 additions and 2 deletions

View File

@ -38,7 +38,7 @@
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
/* x86/include/asm/syscall_wrapper.h versions */ /* arch/x86/include/asm/syscall_wrapper.h versions */
# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) # if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)
@ -81,7 +81,7 @@
#elif defined(CONFIG_S390) #elif defined(CONFIG_S390)
/* s390/include/asm/syscall_wrapper.h versions */ /* arch/s390/include/asm/syscall_wrapper.h versions */
#define __KPATCH_S390_SYS_STUBx(x, name, ...) \ #define __KPATCH_S390_SYS_STUBx(x, name, ...) \
long __s390_sys##name(struct pt_regs *regs); \ long __s390_sys##name(struct pt_regs *regs); \
@ -114,6 +114,33 @@
__diag_pop(); \ __diag_pop(); \
static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
#elif defined(CONFIG_PPC64)
/* arch/powerpc/include/asm/syscall_wrapper.h versions */
# if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
# define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \
long sys##name(const struct pt_regs *regs); \
ALLOW_ERROR_INJECTION(sys##name, ERRNO); \
static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));\
__attribute__((optimize("-fno-optimize-sibling-calls"))) \
long sys##name(const struct pt_regs *regs) \
{ \
return __se_sys##name(SC_POWERPC_REGS_TO_ARGS(x,__VA_ARGS__)); \
} \
static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
{ \
long ret = __kpatch_do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__));\
__MAP(x,__SC_TEST,__VA_ARGS__); \
__PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
return ret; \
} \
static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
# endif /* LINUX_VERSION_CODE */
#endif /* CONFIG_X86_64 */ #endif /* CONFIG_X86_64 */