From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 4/5] syscalls/fanotify03: add test for FAN_MARK_FILESYSTEM permission events
Date: Wed, 21 Nov 2018 14:14:48 +0100 [thread overview]
Message-ID: <20181121131448.GE2954@rei> (raw)
In-Reply-To: <20181116065119.6912-5-amir73il@gmail.com>
Hi!
> -static void setup_mark(unsigned int n)
> +static int setup_mark(unsigned int n)
> {
> struct tcase *tc = &tcases[n];
> struct fanotify_mark_type *mark = &tc->mark;
> @@ -144,7 +149,12 @@ static void setup_mark(unsigned int n)
> if (fanotify_mark(fd_notify, FAN_MARK_ADD | mark->flag,
> FAN_ACCESS_PERM | FAN_OPEN_PERM,
> AT_FDCWD, fname) < 0) {
> - if (errno == EINVAL) {
> + if (errno == EINVAL && support_perm_events &&
> + mark->flag == FAN_MARK_FILESYSTEM) {
> + tst_res(TCONF,
> + "FAN_MARK_FILESYSTEM not supported in kernel?");
> + return -1;
> + } else if (errno == EINVAL) {
> tst_brk(TCONF | TERRNO,
> "CONFIG_FANOTIFY_ACCESS_PERMISSIONS not "
> "configured in kernel?");
> @@ -155,9 +165,16 @@ static void setup_mark(unsigned int n)
> "AT_FDCWD, %s) failed.",
> fd_notify, mark->name, fname);
> }
> + } else {
> + /*
> + * To distigouish between perm event not supported and
> + * filesystem mark not supported.
> + */
> + support_perm_events = 1;
I'm a bit puzzled here, so we attempted to cache if perm_events are
supported here?
I guess that we depend on the order of the tcases[] array here, which is
not very nice.
Also it does not have to be in else branch, if we get EINVAL the first
time we call fanotify_mark() tst_brk() is called, which exits the test,
so if we ever get to this point in the program, we did at least one
successful mark.
> tst_res(TINFO, "Test #%d: %s", n, tc->tname);
> + return 0;
> }
>
> static void test_fanotify(unsigned int n)
> @@ -165,7 +182,9 @@ static void test_fanotify(unsigned int n)
> int tst_count;
> int ret, len = 0, i = 0, test_num = 0;
>
> - setup_mark(n);
> + if (setup_mark(n) != 0)
> + return;
> +
> run_child();
>
> tst_count = 0;
> --
> 2.17.1
>
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2018-11-21 13:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 6:51 [LTP] [PATCH 0/5] fanotify filesystem mark tests Amir Goldstein
2018-11-16 6:51 ` [LTP] [PATCH 1/5] syscalls/fanotify01: check events also on mountpoint mark Amir Goldstein
2018-11-21 12:01 ` Cyril Hrubis
2018-11-21 16:18 ` Amir Goldstein
2018-11-22 16:06 ` Cyril Hrubis
2018-11-22 16:57 ` Amir Goldstein
2018-11-16 6:51 ` [LTP] [PATCH 2/5] syscalls/fanotify03: check permission " Amir Goldstein
2018-11-21 12:26 ` Cyril Hrubis
2018-11-16 6:51 ` [LTP] [PATCH 3/5] syscalls/fanotify01: add test for FAN_MARK_FILESYSTEM events Amir Goldstein
2018-11-21 13:00 ` Cyril Hrubis
2018-11-16 6:51 ` [LTP] [PATCH 4/5] syscalls/fanotify03: add test for FAN_MARK_FILESYSTEM permission events Amir Goldstein
2018-11-21 13:14 ` Cyril Hrubis [this message]
2018-11-21 16:36 ` Amir Goldstein
2018-11-21 17:10 ` Amir Goldstein
2018-11-22 16:03 ` Cyril Hrubis
2018-11-16 6:51 ` [LTP] [PATCH 5/5] syscalls/fanotify10: add tests for FAN_MARK_FILESYSTEM and ignore mask Amir Goldstein
2018-11-21 13:27 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121131448.GE2954@rei \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox