|
Michel Lind |
de7e84 |
From bbd47f279def867b79c00e36038277d85eb374c4 Mon Sep 17 00:00:00 2001
|
|
Michel Lind |
de7e84 |
From: Pete Swain <swine@google.com>
|
|
Michel Lind |
de7e84 |
Date: Fri, 28 Jul 2023 16:34:10 -0700
|
|
Michel Lind |
de7e84 |
Subject: [PATCH 102/118] aarch64: kmod: kpatch-syscall.h: add aarch64 helper
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
Copy from kernel source tree.
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
|
|
Michel Lind |
de7e84 |
Signed-off-by: Pete Swain <swine@google.com>
|
|
Michel Lind |
de7e84 |
Signed-off-by: Mihails Strasuns <mstrasun@amazon.com>
|
|
Michel Lind |
de7e84 |
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
|
|
Michel Lind |
de7e84 |
---
|
|
Michel Lind |
de7e84 |
kmod/patch/kpatch-syscall.h | 29 ++++++++++++++++++++++++++++-
|
|
Michel Lind |
de7e84 |
1 file changed, 28 insertions(+), 1 deletion(-)
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
diff --git a/kmod/patch/kpatch-syscall.h b/kmod/patch/kpatch-syscall.h
|
|
Michel Lind |
de7e84 |
index 6ecf36f..d93d10d 100644
|
|
Michel Lind |
de7e84 |
--- a/kmod/patch/kpatch-syscall.h
|
|
Michel Lind |
de7e84 |
+++ b/kmod/patch/kpatch-syscall.h
|
|
Michel Lind |
de7e84 |
@@ -210,7 +210,34 @@
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
# endif /* LINUX_VERSION_CODE */
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
-#endif /* CONFIG_X86_64 */
|
|
Michel Lind |
de7e84 |
+#elif defined(CONFIG_ARM64)
|
|
Michel Lind |
de7e84 |
+
|
|
Michel Lind |
de7e84 |
+/* arm64/include/asm/syscall_wrapper.h versions */
|
|
Michel Lind |
de7e84 |
+
|
|
Michel Lind |
de7e84 |
+#define SC_ARM64_REGS_TO_ARGS(x, ...) \
|
|
Michel Lind |
de7e84 |
+ __MAP(x,__SC_ARGS \
|
|
Michel Lind |
de7e84 |
+ ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
|
|
Michel Lind |
de7e84 |
+ ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
|
|
Michel Lind |
de7e84 |
+
|
|
Michel Lind |
de7e84 |
+#define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \
|
|
Michel Lind |
de7e84 |
+ asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \
|
|
Michel Lind |
de7e84 |
+ ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO); \
|
|
Michel Lind |
de7e84 |
+ static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
|
|
Michel Lind |
de7e84 |
+ static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
|
|
Michel Lind |
de7e84 |
+ asmlinkage long __arm64_sys##name(const struct pt_regs *regs) \
|
|
Michel Lind |
de7e84 |
+ { \
|
|
Michel Lind |
de7e84 |
+ return __se_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__)); \
|
|
Michel Lind |
de7e84 |
+ } \
|
|
Michel Lind |
de7e84 |
+ static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
|
|
Michel Lind |
de7e84 |
+ { \
|
|
Michel Lind |
de7e84 |
+ long ret = __kpatch_do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
|
|
Michel Lind |
de7e84 |
+ __MAP(x,__SC_TEST,__VA_ARGS__); \
|
|
Michel Lind |
de7e84 |
+ __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
|
|
Michel Lind |
de7e84 |
+ return ret; \
|
|
Michel Lind |
de7e84 |
+ } \
|
|
Michel Lind |
de7e84 |
+ static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
|
|
Michel Lind |
de7e84 |
+
|
|
Michel Lind |
de7e84 |
+#endif /* which arch */
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
|
|
Michel Lind |
de7e84 |
#ifndef __KPATCH_SYSCALL_DEFINEx
|
|
Michel Lind |
de7e84 |
--
|
|
Michel Lind |
de7e84 |
2.48.1
|
|
Michel Lind |
de7e84 |
|