[LTP] [PATCH] syscalls/inotify: New test for IN_DELETE regression
Amir Goldstein
amir73il@gmail.com
Mon Feb 7 14:25:33 CET 2022
>
> Tested-by: Petr Vorel <pvorel@suse.cz>
> On various systems. Interesting enough on it does not reproduce on affected
> system with enabled FIPS (at least FIPS on SLES) when run as ordinary user
> (reproduces when run as root). But that's nothing we should worry about.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
Your fixes look fine to me.
> Suggest to apply with this changes (unless if worth to compare nevents ==
> CHURN_FILES).
I wouldn't worry about this - it's not related to the regression that
we are testing.
Thanks,
Amir.
>
> Kind regards,
> Petr
>
> diff --git testcases/kernel/syscalls/inotify/inotify11.c testcases/kernel/syscalls/inotify/inotify11.c
> index 88ac4d2d7d..062b92409f 100644
> --- testcases/kernel/syscalls/inotify/inotify11.c
> +++ testcases/kernel/syscalls/inotify/inotify11.c
> @@ -4,8 +4,10 @@
> *
> * Started by Amir Goldstein <amir73il@gmail.com>
> * based on reproducer from Ivan Delalande <colona@arista.com>
> - *
> - * DESCRIPTION
> + */
> +
> +/*\
> + * [Description]
> * Test opening files after receiving IN_DELETE.
> *
> * Kernel v5.13 has a regression allowing files to be open after IN_DELETE.
> @@ -18,16 +20,12 @@
>
> #include <stdio.h>
> #include <unistd.h>
> -#include <stdlib.h>
> #include <fcntl.h>
> -#include <poll.h>
> -#include <time.h>
> #include <signal.h>
> -#include <sys/time.h>
> #include <sys/wait.h>
> -#include <sys/syscall.h>
>
> #include "tst_test.h"
> +#include "tst_safe_macros.h"
> #include "inotify.h"
>
> #if defined(HAVE_SYS_INOTIFY_H)
> @@ -43,9 +41,9 @@
>
> static pid_t pid;
>
> -char event_buf[EVENT_BUF_LEN];
> +static char event_buf[EVENT_BUF_LEN];
>
> -void churn(void)
> +static void churn(void)
> {
> char path[10];
> int i;
> @@ -75,9 +73,7 @@ static void verify_inotify(void)
> while (!opened && nevents < CHURN_FILES) {
> int i, fd, len;
>
> - len = read(inotify_fd, event_buf, EVENT_BUF_LEN);
> - if (len == -1)
> - tst_brk(TBROK | TERRNO, "read failed");
> + len = SAFE_READ(0, inotify_fd, event_buf, EVENT_BUF_LEN);
>
> for (i = 0; i < len; i += EVENT_SIZE + event->len) {
> event = (struct inotify_event *)&event_buf[i];
More information about the ltp
mailing list