Skip to contentSkip to conversation

fanotify10: Skip non zero ignored_onchild tests for < v5.9

PATCH New Petr Vorel 2 participants 3 messages Sep 11, 2020

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v2 1/1 fanotify10: Skip non zero ignored_onchild tests for < v5.9

ignored mask in combination with flag FAN_EVENT_ON_CHILD has undefined behavior on kernel < 5.9.

Also remove wrong kernel commit (left in e8189ff3c).

---
 testcases/kernel/syscalls/fanotify/fanotify10.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify10.c +8 -3
index 2c4401f61..64426b876 100644
@@ -20,10 +20,10 @@
  *
  *     2f02fd3fa13e fanotify: fix ignore mask logic for events on child...
  *
- * Test cases #17-#23 are regression tests for commit:
+ * Test cases #17-#23 are regression tests for commit (from v5.9, unlikely to be
+ * backported thus not in .tags):
  *
  *     497b0c5a7c06 fsnotify: send event to parent and child with single...
- *     eca4784cbb18 fsnotify: send event to parent and child with single...
  */
 #define _GNU_SOURCE
 #include "config.h"
@@ -451,6 +451,12 @@ static void test_fanotify(unsigned int n)
 
 	tst_res(TINFO, "Test #%d: %s", n, tc->tname);
 
+	if (tc->ignored_onchild && tst_kvercmp(5, 9, 0) < 0) {
+		tst_res(TCONF, "ignored mask in combination with flag FAN_EVENT_ON_CHILD"
+				" has undefined behavior on kernel < 5.9");
+		return;
+	}
+
 	if (create_fanotify_groups(n) != 0)
 		goto cleanup;
 
@@ -567,7 +573,6 @@ static struct tst_test test = {
 	.tags = (const struct tst_tag[]) {
 		{"linux-git", "9bdda4e9cf2d"},
 		{"linux-git", "2f02fd3fa13e"},
-		{"linux-git", "497b0c5a7c06"},
 		{}
 	}
 };
Signature · 1 line
2.28.0
#1 lore raw

PATCH v2 1/1 fanotify10: Skip non zero ignored_onchild tests for < v5.9

Quoted 8 lines · Petr Vorel

ignored mask in combination with flag FAN_EVENT_ON_CHILD has undefined behavior on kernel < 5.9.

Also remove wrong kernel commit (left in e8189ff3c).

Quoted 9 lines
---
 testcases/kernel/syscalls/fanotify/fanotify10.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify10.c +0 -0
index 2c4401f61..64426b876 100644

testcases/kernel/syscalls/fanotify/fanotify10.c line 24

Quoted 6 lines
testcases/kernel/syscalls/fanotify/fanotify10.c +2 -1
@@ -20,10 +20,10 @@
  *
  *     2f02fd3fa13e fanotify: fix ignore mask logic for events on child...
  *
- * Test cases #17-#23 are regression tests for commit:
+ * Test cases #17-#23 are regression tests for commit (from v5.9, unlikely to be
+ * backported thus not in .tags):

If we are being accurate, it is only the 4 test cases with non zero ignored_onchild
that are regression tests for this commit. The other 3 test cases are just completing
the test matrix of possible combinations of marks.

So you may rephrase above as "Test cases with 'ignored_onchild'..." or what not.

Thanks,
Amir.

Quoted 30 lines
testcases/kernel/syscalls/fanotify/fanotify10.c +6 -3
  *
  *     497b0c5a7c06 fsnotify: send event to parent and child with single...
- *     eca4784cbb18 fsnotify: send event to parent and child with single...
  */
 #define _GNU_SOURCE
 #include "config.h"
@@ -451,6 +451,12 @@ static void test_fanotify(unsigned int n)
 
        tst_res(TINFO, "Test #%d: %s", n, tc->tname);
 
+       if (tc->ignored_onchild && tst_kvercmp(5, 9, 0) < 0) {
+               tst_res(TCONF, "ignored mask in combination with flag FAN_EVENT_ON_CHILD"
+                               " has undefined behavior on kernel < 5.9");
+               return;
+       }
+
        if (create_fanotify_groups(n) != 0)
                goto cleanup;
 
@@ -567,7 +573,6 @@ static struct tst_test test = {
        .tags = (const struct tst_tag[]) {
                {"linux-git", "9bdda4e9cf2d"},
                {"linux-git", "2f02fd3fa13e"},
-               {"linux-git", "497b0c5a7c06"},
                {}
        }
 };
--

2.28.0

author
#2 lore raw

PATCH v2 1/1 fanotify10: Skip non zero ignored_onchild tests for < v5.9

Hi Amir,

Quoted 11 lines · Petr Vorel
Quoted 8 lines

ignored mask in combination with flag FAN_EVENT_ON_CHILD has undefined behavior on kernel < 5.9.

Also remove wrong kernel commit (left in e8189ff3c).

Thanks!

...

Quoted 4 lines
Quoted 3 lines

- * Test cases #17-#23 are regression tests for commit:
+ * Test cases #17-#23 are regression tests for commit (from v5.9, unlikely to be
+ * backported thus not in .tags):

Quoted 8 lines

If we are being accurate, it is only the 4 test cases with non zero ignored_onchild
that are regression tests for this commit. The other 3 test cases are just completing
the test matrix of possible combinations of marks.

So you may rephrase above as "Test cases with 'ignored_onchild'..." or what not.

Good point, I'll fix it before merge.

Kind regards,
Petr