public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Modify the test logic of mincore.
@ 2021-03-30 10:46 zhanglianjie
  2021-04-12 14:41 ` Cyril Hrubis
  0 siblings, 1 reply; 8+ messages in thread
From: zhanglianjie @ 2021-03-30 10:46 UTC (permalink / raw)
  To: ltp

Currently mincore has a vulnerability and is easy to be attacked.
CVE has fixed the vulnerability.
Please see https://www.linuxkernelcves.com/cves/CVE-2019-5489

Signed-off-by: zhanglianjie <zhanglianjie@uniontech.com>
---
 testcases/kernel/syscalls/mincore/mincore04.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/mincore/mincore04.c b/testcases/kernel/syscalls/mincore/mincore04.c
index ed0ab7dfa..345dedd9a 100644
--- a/testcases/kernel/syscalls/mincore/mincore04.c
+++ b/testcases/kernel/syscalls/mincore/mincore04.c
@@ -95,12 +95,12 @@ static void test_mincore(void)
 	locked_pages = count_pages_in_cache();
 	tst_reap_children();

-	if (locked_pages == NUM_PAGES)
-		tst_res(TPASS, "mincore reports all %d pages locked by child process "
-			"are resident", locked_pages);
-	else
-		tst_res(TFAIL, "mincore reports %d pages resident but %d pages "
+	if (locked_pages == 0)
+		tst_res(TPASS, "mincore reports %d pages resident but %d pages "
 			"locked by child process", locked_pages, NUM_PAGES);
+	else
+		tst_res(TFAIL, "mincore reports all %d pages locked by child process "
+			"are resident", locked_pages);
 }

 static struct tst_test test = {
@@ -109,4 +109,9 @@ static struct tst_test test = {
 	.forks_child = 1,
 	.test_all = test_mincore,
 	.needs_checkpoints = 1,
+	.tags = (const struct tst_tag[]) {
+		{"linux-git", "574823bfab82"},
+		{"CVE", "2019-5489"},
+		{}
+	}
 };
--
2.20.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-26 12:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-30 10:46 [LTP] [PATCH] Modify the test logic of mincore zhanglianjie
2021-04-12 14:41 ` Cyril Hrubis
2021-04-15  7:11   ` zhanglianjie
2021-04-15 11:05     ` Cyril Hrubis
2021-04-19  6:44       ` zhanglianjie
2021-04-19  9:05         ` Cyril Hrubis
2021-04-26 12:39           ` zhanglianjie
2021-04-26 12:50             ` Cyril Hrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox