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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Aug 2020 00:33:37 +0800
From:   Coly Li <colyli@...e.de>
To:     Christoph Hellwig <hch@....de>
Cc:     linux-block@...r.kernel.org, linux-nvme@...ts.infradead.org,
        netdev@...r.kernel.org, open-iscsi@...glegroups.com,
        linux-scsi@...r.kernel.org, ceph-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Chaitanya Kulkarni <chaitanya.kulkarni@....com>,
        Hannes Reinecke <hare@...e.de>, Jan Kara <jack@...e.com>,
        Jens Axboe <axboe@...nel.dk>,
        Mikhail Skorzhinskii <mskorzhinskiy@...arflare.com>,
        Philipp Reisner <philipp.reisner@...bit.com>,
        Sagi Grimberg <sagi@...mberg.me>,
        Vlastimil Babka <vbabka@...e.com>, stable@...r.kernel.org
Subject: Re: [PATCH v7 1/6] net: introduce helper sendpage_ok() in
 include/linux/net.h

On 2020/8/19 00:24, Christoph Hellwig wrote:
> I think we should go for something simple like this instead:

This idea is fine to me. Should a warning message be through here? IMHO
the driver still sends an improper page in, fix it in silence is too
kind or over nice to the buggy driver(s).

And maybe the fix in nvme-tcp driver and do_tcp_sendpages() are still
necessary. I am not network expert, this is my opinion for reference.

Coly Li

> ---
> From 4867e158ee86ebd801b4c267e8f8a4a762a71343 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@....de>
> Date: Tue, 18 Aug 2020 18:19:23 +0200
> Subject: net: bypass ->sendpage for slab pages
> 
> Sending Slab or tail pages into ->sendpage will cause really strange
> delayed oops.  Prevent it right in the networking code instead of
> requiring drivers to work around the fact.
> 
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
>  net/socket.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/net/socket.c b/net/socket.c
> index dbbe8ea7d395da..fbc82eb96d18ce 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -3638,7 +3638,12 @@ EXPORT_SYMBOL(kernel_getpeername);
>  int kernel_sendpage(struct socket *sock, struct page *page, int offset,
>  		    size_t size, int flags)
>  {
> -	if (sock->ops->sendpage)
> +	/*
> +	 * sendpage does manipulates the refcount of the passed in page, which
> +	 * does not work for Slab pages, or for tails of non-__GFP_COMP
> +	 * high order pages.
> +	 */
> +	if (sock->ops->sendpage && !PageSlab(page) && page_count(page) > 0)
>  		return sock->ops->sendpage(sock, page, offset, size, flags);
>  
>  	return sock_no_sendpage(sock, page, offset, size, flags);
> 

Powered by blists - more mailing lists