Skip to contentSkip to conversation

cve/cve-2017-2618: Check for file fscreate existence

PATCH New Guangwen Feng 2 participants 2 messages Oct 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cve/cve-2017-2618: Check for file fscreate existence

---
 testcases/cve/cve-2017-2618.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
testcases/cve/cve-2017-2618.c +8 -1
index e6b30e8..e1e94f6 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Fujitsu Ltd.
+ * Copyright (c) 2017 FUJITSU LIMITED
  * Author: Guangwen Feng <[email protected]>
  *
  * 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,
 };
Signature · 1 line
2.9.5