[LTP] [PATCH] cve/cve-2017-2618: Check for file fscreate existence

Guangwen Feng fenggw-fnst@cn.fujitsu.com
Mon Oct 16 07:30:49 CEST 2017


Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
---
 testcases/cve/cve-2017-2618.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/testcases/cve/cve-2017-2618.c b/testcases/cve/cve-2017-2618.c
index e6b30e8..e1e94f6 100644
--- a/testcases/cve/cve-2017-2618.c
+++ b/testcases/cve/cve-2017-2618.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Fujitsu Ltd.
+ * Copyright (c) 2017 FUJITSU LIMITED
  * Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
  *
  * This program is free software: you can redistribute it and/or modify
@@ -35,6 +35,12 @@
 #define LOOPS	100
 #define PATH_ATTRFS	"/proc/self/attr/fscreate"
 
+static void setup(void)
+{
+	if (access(PATH_ATTRFS, F_OK))
+		tst_brk(TCONF, "%s does not exist", PATH_ATTRFS);
+}
+
 static void do_test(void)
 {
 	int i, fd;
@@ -55,5 +61,6 @@ static void do_test(void)
 
 static struct tst_test test = {
 	.forks_child = 1,
+	.setup = setup,
 	.test_all = do_test,
 };
-- 
2.9.5





More information about the ltp mailing list