Skip to content

kpatch-syscall.h: don't redefine SC_ARM64_REGS_TO_ARGS - #1539

Open
usebeforefree wants to merge 3 commits into
dynup:masterfrom
usebeforefree:arm-macro-redef-fix
Open

usebeforefree wants to merge 3 commits into
dynup:masterfrom
usebeforefree:arm-macro-redef-fix

Conversation

@usebeforefree

Copy link
Copy Markdown
Contributor

This PR currently includes usebeforefree/integration-rhel10.4 commits as well, because this issue is raised only for rhel10.4 for now. But if the issue is fixed by the latest commit in this PR, it would make sense to merge it only.

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 makes sure the macro is defined only if it's not defined
already, so it should work with both kernels pre and post 5a87e8c7f370

Signed-off-by: Marko Kostić <[email protected]>

Added rebased kernel-6.12.0-282.el10 tests for rhel-10.4 and
invoke them through packit.

Signed-off-by: Marko Kostić <[email protected]>
When the -s|--sourcedir option is not provided, kpatch-build sources
/etc/os-release.  On Fedora that file defines a variable called VARIANT,
which in turn overwrites kpatch-build's user provided -V|--variant
VARIANT value, producing a bug.

Fixes: 5adfdd4 ("kpatch-build, lib.sh, man: add kernel variant support")
Signed-off-by: Marko Kostić <[email protected]>
Signed-off-by: Joe Lawrence <[email protected]> (commit msg)
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 makes sure the macro is defined only if it's not defined
already, so it should work with both kernels pre and post 5a87e8c7f370

Signed-off-by: Marko Kostić <[email protected]>
@usebeforefree

usebeforefree commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

The tests pass, the only thing left is to confirm the bug occurs in these integration tests:

  1. Original failure (kpatch-tier2): https://artifacts.osci.redhat.com/testing-farm/6dc555f6-a8dd-4ed6-86f8-86b9c7787486/

  2. Integration test run that should fail: https://artifacts.osci.redhat.com/testing-farm/18131912-294d-4bdd-9919-77b54f89841e/

Called 2. with this command:

testing-farm request \
    --no-wait \
    --compose RHEL-10.4-20261126.0 \
    --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 \
    --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' \

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant