diff --git a/test/integration/linux-5.10.11/syscall-LOADED.test b/test/integration/linux-5.10.11/syscall-LOADED.test new file mode 100755 index 0000000..3a2fd88 --- /dev/null +++ b/test/integration/linux-5.10.11/syscall-LOADED.test @@ -0,0 +1,3 @@ +#!/bin/bash + +uname -s | grep -q kpatch diff --git a/test/integration/linux-5.10.11/syscall.patch b/test/integration/linux-5.10.11/syscall.patch new file mode 100644 index 0000000..f86d695 --- /dev/null +++ b/test/integration/linux-5.10.11/syscall.patch @@ -0,0 +1,21 @@ +diff --git a/kernel/sys.c b/kernel/sys.c +index 2e2e3f378d97..05271fe26c89 100644 +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -1250,13 +1250,15 @@ static int override_release(char __user *release, size_t len) + return ret; + } + +-SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) ++#include "kpatch-syscall.h" ++KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) + { + struct new_utsname tmp; + + down_read(&uts_sem); + memcpy(&tmp, utsname(), sizeof(tmp)); + up_read(&uts_sem); ++ strcat(tmp.sysname, ".kpatch"); + if (copy_to_user(name, &tmp, sizeof(tmp))) + return -EFAULT; + diff --git a/test/integration/rhel-7.9/syscall-LOADED.test b/test/integration/rhel-7.9/syscall-LOADED.test new file mode 100755 index 0000000..3a2fd88 --- /dev/null +++ b/test/integration/rhel-7.9/syscall-LOADED.test @@ -0,0 +1,3 @@ +#!/bin/bash + +uname -s | grep -q kpatch diff --git a/test/integration/rhel-7.9/syscall.patch b/test/integration/rhel-7.9/syscall.patch new file mode 100644 index 0000000..729340d --- /dev/null +++ b/test/integration/rhel-7.9/syscall.patch @@ -0,0 +1,26 @@ +diff --git a/kernel/sys.c b/kernel/sys.c +index 1fbf388279832..b5186aa83adfa 100644 +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -1392,14 +1392,18 @@ static int override_release(char __user *release, size_t len) + return ret; + } + +-SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) ++#include "kpatch-syscall.h" ++KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) + { ++ struct new_utsname tmp; + int errno = 0; + + down_read(&uts_sem); +- if (copy_to_user(name, utsname(), sizeof *name)) +- errno = -EFAULT; ++ memcpy(&tmp, utsname(), sizeof(tmp)); + up_read(&uts_sem); ++ strcat(tmp.sysname, ".kpatch"); ++ if (copy_to_user(name, &tmp, sizeof(tmp))) ++ errno = -EFAULT; + + if (!errno && override_release(name->release, sizeof(name->release))) + errno = -EFAULT; diff --git a/test/integration/rhel-8.4/syscall-LOADED.test b/test/integration/rhel-8.4/syscall-LOADED.test new file mode 100755 index 0000000..3a2fd88 --- /dev/null +++ b/test/integration/rhel-8.4/syscall-LOADED.test @@ -0,0 +1,3 @@ +#!/bin/bash + +uname -s | grep -q kpatch diff --git a/test/integration/rhel-8.4/syscall.patch b/test/integration/rhel-8.4/syscall.patch new file mode 100644 index 0000000..4679d01 --- /dev/null +++ b/test/integration/rhel-8.4/syscall.patch @@ -0,0 +1,26 @@ +diff --git a/kernel/sys.c b/kernel/sys.c +index 871c0848f05c8..479bf8725d2e6 100644 +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -1241,14 +1241,18 @@ static int override_release(char __user *release, size_t len) + return ret; + } + +-SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) ++#include "kpatch-syscall.h" ++KPATCH_SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) + { ++ struct new_utsname tmp; + int errno = 0; + + down_read(&uts_sem); +- if (copy_to_user(name, utsname(), sizeof *name)) +- errno = -EFAULT; ++ memcpy(&tmp, utsname(), sizeof(tmp)); + up_read(&uts_sem); ++ strcat(tmp.sysname, ".kpatch"); ++ if (copy_to_user(name, &tmp, sizeof(tmp))) ++ errno = -EFAULT; + + if (!errno && override_release(name->release, sizeof(name->release))) + errno = -EFAULT;