Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase of aarch64 PR #1414

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "test/unit/objs"]
path = test/unit/objs
url = https://github.com/dynup/kpatch-unit-test-objs.git
url = https://github.com/mihails-strasuns/kpatch-unit-test-objs.git
branch = arm64
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Supported Architectures

- [x] x86-64
- [x] ppc64le
- [ ] arm64
- [x] arm64 [upstream prerequisites](doc/arm64-upstream-prerequisites.md)
- [x] s390 [upstream prerequisites](doc/s390-upstream-prerequisites.md)

Installation
Expand Down
11 changes: 11 additions & 0 deletions doc/arm64-upstream-prerequisites.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### arm64 backporting

**Prerequisite kernel patches:**
**v5.19:**
- [Madhavan Venkataraman's [RFC PATCH v2 00/20] arm64: livepatch: Use ORC for dynamic frame pointer validation](https://lore.kernel.org/linux-arm-kernel/[email protected]/)
- also tested against madvenka's earlier pre-objtool series up to v15

**v5.15 and v5.10:**
- under development, both known to work with backports of madvenka's v15,
but the objtool-using version above is likely to be the approach that
finally merges into upstream kernel
29 changes: 28 additions & 1 deletion kmod/patch/kpatch-syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,34 @@

# endif /* LINUX_VERSION_CODE */

#endif /* CONFIG_X86_64 */
#elif defined(CONFIG_ARM64)

/* 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])

#define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \
asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \
ALLOW_ERROR_INJECTION(__arm64_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__)); \
asmlinkage long __arm64_sys##name(const struct pt_regs *regs) \
{ \
return __se_sys##name(SC_ARM64_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 /* which arch */


#ifndef __KPATCH_SYSCALL_DEFINEx
Expand Down
2 changes: 1 addition & 1 deletion kpatch-build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PLUGIN_CFLAGS := $(filter-out -Wconversion, $(CFLAGS))
PLUGIN_CFLAGS += -shared -I$(GCC_PLUGINS_DIR)/include \
-Igcc-plugins -fPIC -fno-rtti -O2 -Wall
endif
ifeq ($(filter $(ARCH),s390x x86_64 ppc64le),)
ifeq ($(filter $(ARCH),aarch64 s390x x86_64 ppc64le),)
$(error Unsupported architecture ${ARCH}, check https://github.com/dynup/kpatch/#supported-architectures)
endif

Expand Down
Loading
Loading