Repository navigation
kpatch-syscall.h: don't redefine SC_ARM64_REGS_TO_ARGS - #1539
usebeforefree wants to merge 1 commit into
Conversation
|
The tests pass, the only thing left is to confirm the bug occurs in these integration tests:
Called 2. with this command: testing-farm request \
--no-wait \
--compose RHEL-10.4-Nightly \
--pool beaker \
--arch aarch64 \
--git-url https://gitlab.com/redhat/centos-stream/tests/kernel/test-plans.git \
--plan 'kpatch/kpatch-integration-rhel/kernel$' \
--environment KPATCH_GIT=https://github.com/usebeforefree/kpatch.git \
--environment KPATCH_REV=integration-rhel10.4 \
--environment KPATCH_UNIT=0 \
--timeout 1440 \
--environment TMT_REBOOT_TIMEOUT=1200 \
--environment TMT_SSH_ConnectionAttempts=20 \
--environment TMT_SSH_ServerAliveCountMax=180 \
--environment MAX_REBOOT_TIME=0 \
--tmt-discover '--how=fmf --insert --url=https://gitlab.com/redhat/centos-stream/tests/kernel/test-plans.git --test=/misc/machineinfo --order 1' \
--hardware 'memory=>= 50 GB' \
--hardware 'cpu.processors=>= 20'
Below is the successful run with the commit on top of |
fcdb3ad to
2d05cd4
Compare
|
Does this more closely align with how the file handles these API changes? The original design was to facilitate using a diff tool against the kernel counterpart for each respective "version". (Completely untested :) diff --git a/kmod/patch/kpatch-syscall.h b/kmod/patch/kpatch-syscall.h
index 16c5a0de3de8..3e2e910a8739 100644
--- a/kmod/patch/kpatch-syscall.h
+++ b/kmod/patch/kpatch-syscall.h
@@ -211,12 +211,33 @@
#elif defined(CONFIG_ARM64)
+# if defined(RHEL_RELEASE_CODE)
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(10, 4)
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V2
+# else
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+# endif
+# else
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0)
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V2
+# else
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+# endif
+# endif
+diff --git a/kmod/patch/kpatch-syscall.h b/kmod/patch/kpatch-syscall.h
index 16c5a0de3de8..3e2e910a8739 100644
--- a/kmod/patch/kpatch-syscall.h
+++ b/kmod/patch/kpatch-syscall.h
@@ -211,12 +211,33 @@
#elif defined(CONFIG_ARM64)
+# if defined(RHEL_RELEASE_CODE)
+# if RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(10, 4)
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V2
+# else
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+# endif
+# else
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0)
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V2
+# else
+# define KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+# endif
+# endif
+
/* arm64/include/asm/syscall_wrapper.h versions */
-#define SC_ARM64_REGS_TO_ARGS(x, ...) \
- __MAP(x,__SC_ARGS \
- ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
- ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#if KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+#define SC_ARM64_REGS_TO_ARGS(x, ...) \
+ __MAP(x,__SC_ARGS \
+ ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
+ ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#else
+#define SC_ARM64_REGS_TO_ARGS(x, ...) \
+ __MAP(x,__SC_ARGS \
+ ,,regs->orig_x0,,regs->regs[1],,regs->regs[2] \
+ ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#endif
#define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \
/* arm64/include/asm/syscall_wrapper.h versions */
-#define SC_ARM64_REGS_TO_ARGS(x, ...) \
- __MAP(x,__SC_ARGS \
- ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
- ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#if KPATCH_SC_ARM64_REGS_TO_ARGS_V1
+#define SC_ARM64_REGS_TO_ARGS(x, ...) \
+ __MAP(x,__SC_ARGS \
+ ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \
+ ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#else
+#define SC_ARM64_REGS_TO_ARGS(x, ...) \
+ __MAP(x,__SC_ARGS \
+ ,,regs->orig_x0,,regs->regs[1],,regs->regs[2] \
+ ,,regs->regs[3],,regs->regs[4],,regs->regs[5])
+#endif
#define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \ |
Upstream kernel commit 5a87e8c7f370 ("arm64: syscall: Pass 'orig_x0' as
first argument to native system call") changed the kernel's
SC_ARM64_REGS_TO_ARGS() macro.
kpatch-syscall.h defines its own copy of the macro. Until now both
copies were identical, so the second definition was harmless. Now that
they differ, any file that includes kpatch-macros.h fails to build on
arm64 kernels that have this change:
kpatch-syscall.h:216:9: error: "SC_ARM64_REGS_TO_ARGS" redefined
This fix removes the macro, since it's already defined elsewhere. All
other arches do this in the first place anyways. Works on both kernels
pre and post 5a87e8c7f370.
Signed-off-by: Marko Kostić <mkostic@redhat.com>
2d05cd4 to
8e841bc
Compare
joe-lawrence
left a comment
There was a problem hiding this comment.
LGTM and tracks with how other SC_<ARCH>_REGS_TO_ARGS macros are omitted from the header file.
This PR currently includes
usebeforefree/integration-rhel10.4commits as well, because this issue is raised only forrhel10.4for now. But if the issue is fixed by the latest commit in this PR, it would make sense to merge it only.