[LTP] [PATCH 4/4] Add taint check to syscalls/ptrace08

Martin Doucha mdoucha@suse.cz
Tue Aug 11 15:05:02 CEST 2020


The test may pass on some kernels despite triggering a kernel segfault. Check
for kernel taint just in case.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/ptrace/ptrace08.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/ptrace/ptrace08.c b/testcases/kernel/syscalls/ptrace/ptrace08.c
index 448bc72e3..591aa0dd2 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace08.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace08.c
@@ -48,7 +48,8 @@ static void setup(void)
 
 		if (fcount < 2) {
 			fclose(fr);
-			tst_brk(TBROK, "Unexpected data in /proc/kallsyms %d", fcount);
+			tst_brk(TBROK, "Unexpected data in /proc/kallsyms %d",
+				fcount);
 		}
 
 		if (fcount >= 3 && endl != '\n')
@@ -89,9 +90,8 @@ static void run(void)
 
 	child = child_pid = SAFE_FORK();
 
-	if (!child_pid) {
+	if (!child_pid)
 		child_main();
-	}
 
 	if (SAFE_WAITPID(child_pid, &status, WUNTRACED) != child_pid)
 		tst_brk(TBROK, "Received event from unexpected PID");
@@ -133,6 +133,7 @@ static struct tst_test test = {
 	.setup = setup,
 	.cleanup = cleanup,
 	.forks_child = 1,
+	.taint_check = TST_TAINT_W | TST_TAINT_D,
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "f67b15037a7a"},
 		{"CVE", "2018-1000199"},
-- 
2.27.0



More information about the ltp mailing list