[LTP] [PATCH 1/1] Add pty07 test for use-after-free in vt_ioctl()

Cyril Hrubis chrubis@suse.cz
Fri Mar 4 11:21:06 CET 2022


Hi!
Pushed with two minor changes, thanks.

- we do not use inline variable defintion since we are trying to be
  compatible with very old toolchains

- As the test has no CVE assigned the failure message cannot say
  "vunerable"

Full diff:

diff --git a/testcases/kernel/pty/pty07.c b/testcases/kernel/pty/pty07.c
index acd26f62e..462569c4a 100644
--- a/testcases/kernel/pty/pty07.c
+++ b/testcases/kernel/pty/pty07.c
@@ -42,9 +42,11 @@ static struct tst_fzsync_pair fzp;
 
 static void *open_close(void *unused)
 {
+	int i;
+
 	while (tst_fzsync_run_b(&fzp)) {
 		tst_fzsync_start_race_b(&fzp);
-		for (int i = test_tty_port; i < MAX_NR_CONSOLES; i++) {
+		for (i = test_tty_port; i < MAX_NR_CONSOLES; i++) {
 			ioctl(fd, VT_ACTIVATE, i);
 			ioctl(fd, VT_DISALLOCATE, i);
 		}
@@ -65,7 +67,7 @@ static void do_test(void)
 		ioctl(fd, VT_RESIZEX, &sz);
 		tst_fzsync_end_race_a(&fzp);
 		if (tst_taint_check()) {
-			tst_res(TFAIL, "Kernel is vulnerable");
+			tst_res(TFAIL, "Kernel is buggy");
 			break;
 		}
 	}

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list