All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tcp: detecting the misuse of .sendpage for Slab objects
@ 2019-03-06 11:10 Vasily Averin
  2019-03-06 16:31 ` Eric Dumazet
  2019-03-06 18:48 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Vasily Averin @ 2019-03-06 11:10 UTC (permalink / raw)
  To: Eric Dumazet, netdev

sendpage was not designed for processing of the Slab pages,
in some situations it can trigger BUG_ON on receiving side.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/ipv4/tcp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index ad07dd71063d..dbb08140cdc9 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -943,6 +943,10 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
 	ssize_t copied;
 	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
 
+	if (IS_ENABLED(CONFIG_DEBUG_VM) &&
+	    WARN_ONCE(PageSlab(page), "page must not be a Slab one"))
+		return -EINVAL;
+
 	/* Wait for a connection to finish. One exception is TCP Fast Open
 	 * (passive side) where data is allowed to be sent before a connection
 	 * is fully established.
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcp: detecting the misuse of .sendpage for Slab objects
  2019-03-06 11:10 [PATCH] tcp: detecting the misuse of .sendpage for Slab objects Vasily Averin
@ 2019-03-06 16:31 ` Eric Dumazet
  2019-03-06 18:48 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2019-03-06 16:31 UTC (permalink / raw)
  To: Vasily Averin, Eric Dumazet, netdev



On 03/06/2019 03:10 AM, Vasily Averin wrote:
> sendpage was not designed for processing of the Slab pages,
> in some situations it can trigger BUG_ON on receiving side.
> 
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
>  net/ipv4/tcp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index ad07dd71063d..dbb08140cdc9 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -943,6 +943,10 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
>  	ssize_t copied;
>  	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
>  
> +	if (IS_ENABLED(CONFIG_DEBUG_VM) &&
> +	    WARN_ONCE(PageSlab(page), "page must not be a Slab one"))
> +		return -EINVAL;
> +
>  	/* Wait for a connection to finish. One exception is TCP Fast Open
>  	 * (passive side) where data is allowed to be sent before a connection
>  	 * is fully established.
> 

SGTM

David, this probably can be merged into net tree.

Signed-off-by: Eric Dumazet <edumazet@google.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tcp: detecting the misuse of .sendpage for Slab objects
  2019-03-06 11:10 [PATCH] tcp: detecting the misuse of .sendpage for Slab objects Vasily Averin
  2019-03-06 16:31 ` Eric Dumazet
@ 2019-03-06 18:48 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-06 18:48 UTC (permalink / raw)
  To: vvs; +Cc: edumazet, netdev

From: Vasily Averin <vvs@virtuozzo.com>
Date: Wed, 6 Mar 2019 14:10:22 +0300

> sendpage was not designed for processing of the Slab pages,
> in some situations it can trigger BUG_ON on receiving side.
> 
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-06 18:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-06 11:10 [PATCH] tcp: detecting the misuse of .sendpage for Slab objects Vasily Averin
2019-03-06 16:31 ` Eric Dumazet
2019-03-06 18:48 ` David Miller

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.