All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: Jan Kara <jack@suse.cz>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/1] splice07: Whitelist /dev/zero on pipe write
Date: Fri, 26 Jan 2024 13:00:18 +0100	[thread overview]
Message-ID: <ZbOe0gNjcyZCPi1H@yuki> (raw)
In-Reply-To: <20240125155107.430656-1-pvorel@suse.cz>

Hi!
> /dev/zero on pipe write started to succeeded on kernel 6.7.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
> 
> @Jan could you please check the problem is a kernel 6.7 bug
> or just wanted change and we should whitelist /dev/zero on pipe write?
> 
> Thanks!
> 
> Kind regards,
> Petr
> 
>  testcases/kernel/syscalls/splice/splice07.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/testcases/kernel/syscalls/splice/splice07.c b/testcases/kernel/syscalls/splice/splice07.c
> index 135c42e47..1fa13b3e6 100644
> --- a/testcases/kernel/syscalls/splice/splice07.c
> +++ b/testcases/kernel/syscalls/splice/splice07.c
> @@ -38,6 +38,7 @@ static void check_splice(struct tst_fd *fd_in, struct tst_fd *fd_out)
>  	if (fd_out->type == TST_FD_PIPE_WRITE) {
>  		switch (fd_in->type) {
>  		/* While these combinations succeeed */
> +		case TST_FD_DEV_ZERO:

long as the reading end is open and there is a space in the pipe. So I
suppose that we got EINVAL because the /dev/zero didn't support splice.

And indeed looking at git log drivers/char/mem.c shows:

commit 1b057bd800c3ea0c926191d7950cd2365eddc9bb
Author: Max Kellermann <max.kellermann@ionos.com>
Date:   Tue Sep 19 09:37:42 2023 +0200

    drivers/char/mem: implement splice() for /dev/zero, /dev/full

    This allows splicing zeroed pages into a pipe, and allows discarding
    pages from a pipe by splicing them to /dev/zero.  Writing to /dev/zero
    should have the same effect as writing to /dev/null, and a
    "splice_write" implementation exists only for /dev/null.

    (The /dev/zero splice_read implementation could be optimized by
    pushing references to the global zero page to the pipe, but that's an
    optimization for another day.)

    Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
    Link: https://lore.kernel.org/r/20230919073743.1066313-1-max.kellermann@ionos.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

With that I guess that we may want to skip the test only on newer
kernels and possibly implement splice test for these two special files
later on.


>  		case TST_FD_FILE:
>  		case TST_FD_MEMFD:
>  			return;
> -- 
> 2.43.0
> 

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2024-01-26 12:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 15:51 [LTP] [PATCH 1/1] splice07: Whitelist /dev/zero on pipe write Petr Vorel
2024-01-26 12:00 ` Cyril Hrubis [this message]
2024-01-29  9:58 ` Martin Doucha
2024-01-29 10:07   ` Cyril Hrubis
2024-01-29 10:08   ` 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=ZbOe0gNjcyZCPi1H@yuki \
    --to=chrubis@suse.cz \
    --cc=jack@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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.