Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-02-07 14:13:00 +0100
committerMiroslav Benes <mbenes@suse.cz>2019-02-13 13:01:45 +0100
commit4c9eb70c86cceee420856573ea1e21835c92980b (patch)
tree5bb8585b9be4b455ee9dd327a375db332f0ba306
parente3a42b78ba0dfd71fa8f3c430ca0bf3bf68f4061 (diff)
uname_patch: Use klp-convert macros and rely on klp-convert where
possible Signed-off-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Nicolai Stange <nstange@suse.de>
-rw-r--r--uname_patch/livepatch_uname.c10
-rw-r--r--uname_patch/livepatch_uname.h5
2 files changed, 12 insertions, 3 deletions
diff --git a/uname_patch/livepatch_uname.c b/uname_patch/livepatch_uname.c
index 4ca603a..84a12f4 100644
--- a/uname_patch/livepatch_uname.c
+++ b/uname_patch/livepatch_uname.c
@@ -33,6 +33,8 @@
#include <linux/string.h>
#include <asm/uaccess.h>
+#include "klp_convert.h"
+
#ifdef COMPAT_UTS_MACHINE
#define override_architecture(name) \
(personality(current->personality) == PER_LINUX32 && \
@@ -76,7 +78,7 @@ static int override_release(char __user *release, size_t len)
char *klp_tag="/lp-@@GITREV@@";
-static struct rw_semaphore *klp_uts_sem;
+KLP_SYM_LINKAGE struct rw_semaphore KLP_SYM(uts_sem);
static int override_version(char __user *version, size_t len, char *klp_version)
{
@@ -111,10 +113,10 @@ asmlinkage long klp_sys_newuname(struct new_utsname __user *name)
struct new_utsname tmp;
char klp_version[65] = { 0 };
- down_read(klp_uts_sem);
+ down_read(&KLP_SYM(uts_sem));
memcpy(&tmp, utsname(), sizeof(tmp));
memcpy(klp_version, utsname()->version, sizeof(utsname()->version));
- up_read(klp_uts_sem);
+ up_read(&KLP_SYM(uts_sem));
if (copy_to_user(name, &tmp, sizeof(tmp)))
return -EFAULT;
@@ -127,6 +129,7 @@ asmlinkage long klp_sys_newuname(struct new_utsname __user *name)
return 0;
}
+#ifndef USE_KLP_CONVERT
int klp_patch_uname_init(void)
{
unsigned long addr;
@@ -140,3 +143,4 @@ int klp_patch_uname_init(void)
return 0;
}
+#endif
diff --git a/uname_patch/livepatch_uname.h b/uname_patch/livepatch_uname.h
index ccfd6c5..eecbcac 100644
--- a/uname_patch/livepatch_uname.h
+++ b/uname_patch/livepatch_uname.h
@@ -3,7 +3,12 @@
#include <linux/utsname.h>
+#ifdef USE_KLP_CONVERT
+static inline int klp_patch_uname_init(void) { return 0; }
+#else
extern int klp_patch_uname_init(void);
+#endif
+
extern asmlinkage long klp_sys_newuname(struct new_utsname __user *name);
#endif