From: Petr Vorel <pvorel@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 4/5] fanotify21: Test reporting event with RDWR fd on RO mount
Date: Fri, 24 Jan 2025 09:01:21 +0100 [thread overview]
Message-ID: <20250124080121.GB159953@pevik> (raw)
In-Reply-To: <20250122172440.506677-5-amir73il@gmail.com>
Hi Amir, all,
> When event_f_flags request to open O_RDWR files for event->fd, the
> event listener should not get events with fd on a read-only mount.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
LGTM.
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> .../kernel/syscalls/fanotify/fanotify21.c | 34 +++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
> index d54930f05..4324019fa 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify21.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify21.c
> @@ -21,6 +21,7 @@
> #include <ctype.h>
> #include <stdlib.h>
> #include <string.h>
> +#include <sys/mount.h>
> #include "tst_test.h"
> #include "tst_safe_stdio.h"
> #include "tst_safe_macros.h"
> @@ -45,16 +46,25 @@ static struct test_case_t {
> char *name;
> int fork;
> int want_pidfd_err;
> + int remount_ro;
> } test_cases[] = {
> {
> "return a valid pidfd for event created by self",
> 0,
> 0,
> + 0,
nit: given how many parameters fanotify tests get over time I would use
designated initializers. I can do it after the release.
> },
> {
> "return invalid pidfd for event created by terminated child",
> 1,
> FAN_NOPIDFD,
> + 0,
> + },
> + {
> + "fail to open rw fd for event created on read-only mount",
> + 0,
> + 0,
> + 1,
> },
> };
> @@ -122,7 +132,7 @@ static void do_setup(void)
> REQUIRE_FANOTIFY_INIT_FLAGS_SUPPORTED_ON_FS(FAN_REPORT_PIDFD,
> TEST_FILE);
> - fanotify_fd = SAFE_FANOTIFY_INIT(FAN_REPORT_PIDFD, O_RDONLY);
> + fanotify_fd = SAFE_FANOTIFY_INIT(FAN_REPORT_PIDFD, O_RDWR);
> SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD,
> TEST_FILE);
> @@ -143,6 +153,16 @@ static void do_test(unsigned int num)
> tst_res(TINFO, "Test #%d: %s", num, tc->name);
> + if (tc->remount_ro) {
> + /* SAFE_MOUNT fails to remount FUSE */
> + if (mount(tst_device->dev, MOUNT_PATH, tst_device->fs_type,
> + MS_REMOUNT|MS_RDONLY, NULL) != 0) {
> + tst_brk(TFAIL,
> + "filesystem %s failed to remount readonly",
> + tst_device->fs_type);
> + }
> + }
nit: I would join two if into single one.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-01-24 8:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 17:24 [LTP] [PATCH 0/5] LTP fanotify tests for v6.13 Amir Goldstein
2025-01-22 17:24 ` [LTP] [PATCH 1/5] fanotify13: Verify that we did not get an extra event Amir Goldstein
2025-01-23 17:18 ` Petr Vorel
2025-01-24 10:11 ` Petr Vorel
2025-01-24 10:33 ` Amir Goldstein
2025-01-24 12:45 ` Petr Vorel
2025-01-22 17:24 ` [LTP] [PATCH 2/5] fanotify13: Add test case for FAN_DELETE_SELF Amir Goldstein
2025-01-22 17:24 ` [LTP] [PATCH 3/5] fanotify05: Test reporting overflow event with FAN_REPORT_FD_ERROR Amir Goldstein
2025-01-24 7:44 ` Petr Vorel
2025-01-22 17:24 ` [LTP] [PATCH 4/5] fanotify21: Test reporting event with RDWR fd on RO mount Amir Goldstein
2025-01-24 8:01 ` Petr Vorel [this message]
2025-01-22 17:24 ` [LTP] [PATCH 5/5] fanotify21: Test reporting fd open errors with FAN_REPORT_FD_ERROR Amir Goldstein
2025-01-24 8:09 ` Petr Vorel
2025-01-22 20:50 ` [LTP] [PATCH 0/5] LTP fanotify tests for v6.13 Petr Vorel
2025-01-23 13:09 ` Amir Goldstein
2025-01-23 13:31 ` Cyril Hrubis
2025-01-24 10:46 ` Cyril Hrubis
2025-01-24 11:32 ` Petr Vorel
2025-01-30 20:07 ` Petr Vorel
2025-01-31 14:16 ` Amir Goldstein
2025-01-31 16:42 ` Petr Vorel
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=20250124080121.GB159953@pevik \
--to=pvorel@suse.cz \
--cc=amir73il@gmail.com \
--cc=jack@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