Skip to contentSkip to conversation

tst_kvercmp: Add rhel7,8 support

PATCH New Yang Xu 2 participants 3 messages Oct 29, 2020 – Oct 30, 2020 Library code

lore
Share & tools
lore

Yang Xu

author
#0 lore raw

PATCH 1/2 tst_kvercmp: Add rhel7,8 support

---
 lib/tst_kvercmp.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/tst_kvercmp.c +6 -0
index 5d56e30b9..8bf65d309 100644
@@ -146,6 +146,12 @@ const char *tst_kvcmp_distname(const char *kver)
 	if (strstr(kver, ".el6"))
 		return "RHEL6";
 
+	if (strstr(kver, ".el7"))
+		return "RHEL7";
+
+	if (strstr(kver, ".el8"))
+		return "RHEL8";
+
 	if (access(OSRELEASE_PATH, F_OK) != -1) {
 		SAFE_FILE_LINES_SCANF(NULL, OSRELEASE_PATH, "ID=%s", distname);
 
Signature · 1 line
2.18.1
author
#1 lore raw

PATCH 2/2 syscalls/ptrace08: Add exception for RHEL8 4.18 kernel

RHEL 4.18 kernel got this patch
commit bd14406b78e6d("perf/hw_breakpoint: Modify breakpoint even if the new attrhas disabled set") since 4.18.0-49.

Without this fix, this case failed as below on RHEL8:
tst_kernel.c:79: TINFO: uname.machine=x86_64 kernel is 64bit ptrace08.c:96: TINFO: Trying address 0xffff800000000000 ptrace08.c:122: TFAIL: ptrace() breakpoint with kernel addr succeeded ptrace08.c:96: TINFO: Trying address 0xffffffffffffffff ptrace08.c:122: TFAIL: ptrace() breakpoint with kernel addr succeeded ptrace08.c:96: TINFO: Trying address 0xffffbfffffffffff ptrace08.c:122: TFAIL: ptrace() breakpoint with kernel addr succeeded

---
 testcases/kernel/syscalls/ptrace/ptrace08.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/ptrace/ptrace08.c +8 -2
index 63086f1fd..2796c40e2 100644
@@ -56,6 +56,11 @@ static pid_t child_pid;
 
 static int deffered_check;
 
+static struct tst_kern_exv kvers[] = {
+	{"RHEL8", "4.18.0-49"},
+	{NULL, NULL},
+};
+
 static void setup(void)
 {
 	/*
@@ -70,9 +75,10 @@ static void setup(void)
 	 * The original fix for the kernel haven't rejected the kernel address
 	 * right away when breakpoint was modified from userspace it was
 	 * disabled instead and the EINVAL was returned when dr7 was written to
-	 * enable it again.
+	 * enable it again. On RHEL8, it has introduced the right fix since
+	 * 4.18.0-49.
 	 */
-	if (tst_kvercmp(4, 19, 0) < 0)
+	if (tst_kvercmp2(4, 19, 0, kvers) < 0)
 		deffered_check = 1;
 }
 
Signature · 1 line
2.18.1