All of lore.kernel.org
 help / color / mirror / Atom feed
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 5/5] fanotify21: Test reporting fd open errors with FAN_REPORT_FD_ERROR
Date: Fri, 24 Jan 2025 09:09:03 +0100	[thread overview]
Message-ID: <20250124080903.GC159953@pevik> (raw)
In-Reply-To: <20250122172440.506677-6-amir73il@gmail.com>

Hi Amir,

> Expect to get -EROFS as event->fd.
> Expect to get -ESRCH instead of FAN_NOPIDFD.

Reviewed-by: Petr Vorel <pvorel@suse.cz>
LGTM.

> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  .../kernel/syscalls/fanotify/fanotify21.c     | 61 ++++++++++++++++---
>  1 file changed, 51 insertions(+), 10 deletions(-)

> diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
> index 4324019fa..8765767f2 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify21.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify21.c
> @@ -57,7 +57,7 @@ static struct test_case_t {
>  	{
>  		"return invalid pidfd for event created by terminated child",
>  		1,
> -		FAN_NOPIDFD,
> +		1,
>  		0,
>  	},
>  	{
> @@ -72,6 +72,8 @@ static int fanotify_fd;
>  static char event_buf[BUF_SZ];
>  static struct pidfd_fdinfo_t *self_pidfd_fdinfo;

> +static int fd_error_unsupported;
> +
>  static struct pidfd_fdinfo_t *read_pidfd_fdinfo(int pidfd)
>  {
>  	char *fdinfo_path;
> @@ -121,6 +123,15 @@ static void do_fork(void)
>  static void do_setup(void)
>  {
>  	int pidfd;
> +	int init_flags = FAN_REPORT_PIDFD;
> +
> +	if (tst_variant) {
> +		fanotify_fd = -1;
> +		fd_error_unsupported = fanotify_init_flags_supported_on_fs(FAN_REPORT_FD_ERROR, ".");
> +		if (fd_error_unsupported)
> +			return;
> +		init_flags |= FAN_REPORT_FD_ERROR;
> +	}

>  	SAFE_TOUCH(TEST_FILE, 0666, NULL);

> @@ -132,7 +143,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_RDWR);
> +	fanotify_fd = SAFE_FANOTIFY_INIT(init_flags, O_RDWR);
>  	SAFE_FANOTIFY_MARK(fanotify_fd, FAN_MARK_ADD, FAN_OPEN, AT_FDCWD,
>  			   TEST_FILE);

> @@ -150,8 +161,17 @@ static void do_test(unsigned int num)
>  {
>  	int i = 0, len;
>  	struct test_case_t *tc = &test_cases[num];
> +	int nopidfd_err = tc->want_pidfd_err ?
> +			  (tst_variant ? -ESRCH : FAN_NOPIDFD) : 0;
> +	int fd_err = (tc->remount_ro && tst_variant) ? -EROFS : 0;

> -	tst_res(TINFO, "Test #%d: %s", num, tc->name);
> +	tst_res(TINFO, "Test #%d.%d: %s %s", num, tst_variant, tc->name,
> +			tst_variant ? "(FAN_REPORT_FD_ERROR)" : "");
Thanks for printing also tst_variant, it helps reviewing the test
(number of the results increased from 20 to 110).

...

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-01-24  8:09 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
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 [this message]
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=20250124080903.GC159953@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.