lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y/zSA+eSjJityj1/@casper.infradead.org>
Date:   Mon, 27 Feb 2023 15:53:39 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     David Howells <dhowells@...hat.com>
Cc:     Jens Axboe <axboe@...e.de>, Miklos Szeredi <miklos@...redi.hu>,
        Amit Shah <amit@...nel.org>, linux-fsdevel@...r.kernel.org,
        virtualization@...ts.linux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH v2] splice: Prevent gifting of multipage folios

On Mon, Feb 27, 2023 at 03:51:03PM +0000, David Howells wrote:
>     
> Don't let parts of compound pages/multipage folios be gifted by (vm)splice
> into a pipe as the other end may only be expecting single-page gifts (fuse
> and virtio console for example).
> 
> replace_page_cache_folio(), for example, will do the wrong thing if it
> tries to replace a single paged folio with a multipage folio.
> 
> Try to avoid this by making add_to_pipe() remove the gift flag on multipage
> folios.
> 
> Fixes: 7afa6fd037e5 ("[PATCH] vmsplice: allow user to pass in gift pages")
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Matthew Wilcox <willy@...radead.org>

Reviewed-by: Matthew Wilcox (Oracle) <willy@...radead.org>
Cc: stable@...r.kernel.org

> cc: Jens Axboe <axboe@...e.de>
> cc: Miklos Szeredi <miklos@...redi.hu>
> cc: Amit Shah <amit@...nel.org>
> cc: linux-fsdevel@...r.kernel.org
> cc: virtualization@...ts.linux-foundation.org
> cc: linux-mm@...ck.org
> ---
>  fs/splice.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/splice.c b/fs/splice.c
> index 2e76dbb81a8f..8bbd7794d9f0 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -240,6 +240,8 @@ ssize_t add_to_pipe(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
>  	} else if (pipe_full(head, tail, pipe->max_usage)) {
>  		ret = -EAGAIN;
>  	} else {
> +		if (PageCompound(buf->page))
> +			buf->flags &= ~PIPE_BUF_FLAG_GIFT;
>  		pipe->bufs[head & mask] = *buf;
>  		pipe->head = head + 1;
>  		return buf->len;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ