Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Stange <nstange@suse.de>2019-09-07 18:53:16 +0200
committerMiroslav Benes <mbenes@suse.cz>2019-09-24 11:21:55 +0200
commitb5af38e1d9936a18754518939823262facb4dc76 (patch)
treecd5a777e069a3e5c7e362ff96ba70df5467f3bc7
parentda7b9a5c91d0f300c88dc190083ad7bde626674f (diff)
uname_patch: convert to the syscall stub wrapper macros from klp_syscalls.h
In order to make the live patch to the newuname() syscall work on kernels >= 4.17 again, convert it to the KLP_SYSCALL_*() wrapper macros provided by klp_syscalls.h. References: bsc#1149841 Signed-off-by: Nicolai Stange <nstange@suse.de> Signed-off-by: Miroslav Benes <mbenes@suse.cz>
-rwxr-xr-xscripts/register-patches.sh13
-rw-r--r--uname_patch/livepatch_uname.c2
-rw-r--r--uname_patch/livepatch_uname.h9
3 files changed, 19 insertions, 5 deletions
diff --git a/scripts/register-patches.sh b/scripts/register-patches.sh
index 8859ca9..ba55d6a 100755
--- a/scripts/register-patches.sh
+++ b/scripts/register-patches.sh
@@ -155,9 +155,16 @@ KLP_PATCHES_OBJS=$(
echo -n '\t\t.funcs = (struct klp_func[]) {\n'
if [ x"$o" = xvmlinux ]; then
- echo -n '\t\t\t{ .old_name = "SyS_newuname", '
- echo -n '.new_func = klp_sys_newuname, '
- echo -n '},\n'
+ echo -n '\t\t\t{\n'
+ echo -n '\t\t\t .old_name = __stringify(KLP_SYSCALL_SYM(newuname)),\n'
+ echo -n '\t\t\t .new_func = KLP_SYSCALL_SYM(klp_newuname),\n'
+ echo -n '\t\t\t},\n'
+ echo -n '#ifdef KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS\n'
+ echo -n '\t\t\t{\n'
+ echo -n '\t\t\t .old_name = __stringify(KLP_SYSCALL_COMPAT_STUB_SYM(newuname)),\n'
+ echo -n '\t\t\t .new_func = KLP_SYSCALL_COMPAT_STUB_SYM(klp_newuname),\n'
+ echo -n '\t\t\t},\n'
+ echo -n '#endif\n'
fi
last_cond=
diff --git a/uname_patch/livepatch_uname.c b/uname_patch/livepatch_uname.c
index 84a12f4..4d13421 100644
--- a/uname_patch/livepatch_uname.c
+++ b/uname_patch/livepatch_uname.c
@@ -108,7 +108,7 @@ out:
return ret;
}
-asmlinkage long klp_sys_newuname(struct new_utsname __user *name)
+__SYSCALL_DEFINEx(1, _klp_newuname, struct new_utsname __user *, name)
{
struct new_utsname tmp;
char klp_version[65] = { 0 };
diff --git a/uname_patch/livepatch_uname.h b/uname_patch/livepatch_uname.h
index eecbcac..5a5c468 100644
--- a/uname_patch/livepatch_uname.h
+++ b/uname_patch/livepatch_uname.h
@@ -2,6 +2,7 @@
#define _LIVEPATCH_UNAME_H
#include <linux/utsname.h>
+#include "../klp_syscalls.h"
#ifdef USE_KLP_CONVERT
static inline int klp_patch_uname_init(void) { return 0; }
@@ -9,6 +10,12 @@ static inline int klp_patch_uname_init(void) { return 0; }
extern int klp_patch_uname_init(void);
#endif
-extern asmlinkage long klp_sys_newuname(struct new_utsname __user *name);
+extern KLP_SYSCALL_DECLx(1, KLP_SYSCALL_SYM(klp_newuname),
+ struct new_utsname __user *, name);
+
+#ifdef KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS
+extern KLP_SYSCALL_DECLx(1, KLP_SYSCALL_COMPAT_STUB_SYM(klp_newuname),
+ struct new_utsname __user *, name);
+#endif /* KLP_ARCH_HAS_SYSCALL_COMPAT_STUBS */
#endif