Commit Graph

4 Commits

Author SHA1 Message Date
Sumanth Korikkar cc8e030641 kpatch-syscall: update syscall macros for s390
Since linux 'commit 2213d44e140f ("s390/syscalls: get rid of system call alias
functions")', s390 syscall wrappers are modified. Adjust it accordingly
for kpatch

Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2023-04-17 17:45:30 +02:00
Joe Lawrence e707515cb1 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>
2023-01-16 09:33:55 -05:00
Joe Lawrence e921c557f9 macros: tweak syscall patching macros
Kernel version specific __KPATCH_SYSCALL_DEFINEx macros were added to
kpatch-syscall.h for x86, but only single versions for other arches.
This works out for s390x, but not ppc64le for which kpatch-build support
goes back to kernel versions that require slightly different macros.

Reorder the __KPATCH_SYSCALL_DEFINEx macros to define the arch-specific
ones first (arch/.../include/asm/syscall_wrapper.h) and then fall back
to using generic ones (include/linux/syscalls.h versions).

Fixes: #1278
Fixes: 9c0b678621b9 ("macros: add syscall patching macros")
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2022-07-13 22:30:28 -04:00
Josh Poimboeuf e9c0b67862 macros: add syscall patching macros
Attempting to patch a syscall results in an error due to a missing
fentry hook in the inner __do_sys##name() function.  The fentry hook is
missing because of the 'inline' annotation, which invokes 'notrace'.

Add some kpatch-specific syscall definition macros which can be used for
patching a syscall.

These macros are copied almost verbatim from the kernel, the main
difference being a 'kpatch' prefix added to the __do_sys##name()
function name.  This causes kpatch-build to treat it as a new function
(due to its new name), and its caller __se_sys##name() function is
inlined by its own caller __x64_sys##name() function, which has an
fentry hook.

To patch a syscall, just use replace the use of the SYSCALL_DEFINE1 (or
similar) macro with the "KPATCH_" prefixed version.

Fixes: #1171

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2022-04-19 19:11:44 -07:00