All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer
@ 2018-06-05  4:16 Xin Long
  2018-06-05 10:27 ` Neil Horman
  2018-06-05 14:23 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Xin Long @ 2018-06-05  4:16 UTC (permalink / raw)
  To: network dev, linux-sctp
  Cc: davem, Eric Dumazet, Marcelo Ricardo Leitner, Neil Horman,
	Dmitry Vyukov, syzkaller

syzbot reported a rcu_sched self-detected stall on CPU which is caused
by too small value set on rto_min with SCTP_RTOINFO sockopt. With this
value, hb_timer will get stuck there, as in its timer handler it starts
this timer again with this value, then goes to the timer handler again.

This problem is there since very beginning, and thanks to Eric for the
reproducer shared from a syzbot mail.

This patch fixes it by not allowing sctp_transport_timeout to return a
smaller value than HZ/5 for hb_timer, which is based on TCP's min rto.

Note that it doesn't fix this issue by limiting rto_min, as some users
are still using small rto and no proper value was found for it yet.

Reported-by: syzbot+3dcd59a1f907245f891f@syzkaller.appspotmail.com
Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/transport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 47f82bd..03fc2c4 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -634,7 +634,7 @@ unsigned long sctp_transport_timeout(struct sctp_transport *trans)
 	    trans->state != SCTP_PF)
 		timeout += trans->hbinterval;
 
-	return timeout;
+	return max_t(unsigned long, timeout, HZ / 5);
 }
 
 /* Reset transport variables to their initial values */
-- 
2.1.0

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

* Re: [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer
  2018-06-05  4:16 [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer Xin Long
@ 2018-06-05 10:27 ` Neil Horman
  2018-06-05 14:23 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2018-06-05 10:27 UTC (permalink / raw)
  To: Xin Long
  Cc: network dev, linux-sctp, davem, Eric Dumazet,
	Marcelo Ricardo Leitner, Dmitry Vyukov, syzkaller

On Tue, Jun 05, 2018 at 12:16:58PM +0800, Xin Long wrote:
> syzbot reported a rcu_sched self-detected stall on CPU which is caused
> by too small value set on rto_min with SCTP_RTOINFO sockopt. With this
> value, hb_timer will get stuck there, as in its timer handler it starts
> this timer again with this value, then goes to the timer handler again.
> 
> This problem is there since very beginning, and thanks to Eric for the
> reproducer shared from a syzbot mail.
> 
> This patch fixes it by not allowing sctp_transport_timeout to return a
> smaller value than HZ/5 for hb_timer, which is based on TCP's min rto.
> 
> Note that it doesn't fix this issue by limiting rto_min, as some users
> are still using small rto and no proper value was found for it yet.
> 
> Reported-by: syzbot+3dcd59a1f907245f891f@syzkaller.appspotmail.com
> Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/transport.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sctp/transport.c b/net/sctp/transport.c
> index 47f82bd..03fc2c4 100644
> --- a/net/sctp/transport.c
> +++ b/net/sctp/transport.c
> @@ -634,7 +634,7 @@ unsigned long sctp_transport_timeout(struct sctp_transport *trans)
>  	    trans->state != SCTP_PF)
>  		timeout += trans->hbinterval;
>  
> -	return timeout;
> +	return max_t(unsigned long, timeout, HZ / 5);
>  }
>  
>  /* Reset transport variables to their initial values */
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer
  2018-06-05  4:16 [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer Xin Long
  2018-06-05 10:27 ` Neil Horman
@ 2018-06-05 14:23 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-06-05 14:23 UTC (permalink / raw)
  To: lucien.xin
  Cc: netdev, linux-sctp, edumazet, marcelo.leitner, nhorman, dvyukov,
	syzkaller

From: Xin Long <lucien.xin@gmail.com>
Date: Tue,  5 Jun 2018 12:16:58 +0800

> syzbot reported a rcu_sched self-detected stall on CPU which is caused
> by too small value set on rto_min with SCTP_RTOINFO sockopt. With this
> value, hb_timer will get stuck there, as in its timer handler it starts
> this timer again with this value, then goes to the timer handler again.
> 
> This problem is there since very beginning, and thanks to Eric for the
> reproducer shared from a syzbot mail.
> 
> This patch fixes it by not allowing sctp_transport_timeout to return a
> smaller value than HZ/5 for hb_timer, which is based on TCP's min rto.
> 
> Note that it doesn't fix this issue by limiting rto_min, as some users
> are still using small rto and no proper value was found for it yet.
> 
> Reported-by: syzbot+3dcd59a1f907245f891f@syzkaller.appspotmail.com
> Suggested-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable, thanks Xin.

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

end of thread, other threads:[~2018-06-05 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05  4:16 [PATCH net] sctp: not allow transport timeout value less than HZ/5 for hb_timer Xin Long
2018-06-05 10:27 ` Neil Horman
2018-06-05 14:23 ` 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.