Skip to contentSkip to conversation

pull request: SCTP updates for net-next

DISCUSSION Vlad Yasevich 3 participants 6 messages Nov 23, 2009 – Dec 7, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi David

Here is a set of SCTP patches for net-next. Please pull.

The following changes since commit dc63d3771cc6492220f53caf5fded6090d45d9ce:
Alexander Duyck (1):
ixgbe: Only set/clear VFE in ixgbe_set_rx_mode

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/vxy/lksctp-dev.git net-next

Amerigo Wang (1):
sctp: remove deprecated SCTP_GET_*_OLD stuffs

Andrei Pelinescu-Onciul (3):
sctp: allow setting path_maxrxt independent of SPP_PMTUD_ENABLE
sctp: limit maximum autoclose setsockopt value
sctp: fix integer overflow when setting the autoclose timer

Neil Horman (1):
sctp: Fix mis-ordering of user space data when multihoming in use

Vlad Yasevich (7):
sctp: Fix malformed "Invalid Stream Identifier" error
sctp: Select a working primary during sctp_connectx()
sctp: Update SWS avaoidance receiver side algorithm
sctp: Remove useless last_time_used variable
sctp: Turn the enum socket options into defines
sctp: Update max.burst implementation
sctp: prevent too-fast association id reuse

Wei Yongjun (3):
sctp: implement definition for SACK-IMMEDIATELY extension
sctp: implement the receiver side for SACK-IMMEDIATELY extension
sctp: implement the sender side for SACK-IMMEDIATELY extension

 Documentation/feature-removal-schedule.txt |   12 -
 include/linux/sctp.h                       |    1 +
 include/net/sctp/constants.h               |    4 +
 include/net/sctp/sm.h                      |    3 +-
 include/net/sctp/structs.h                 |   16 +-
 include/net/sctp/user.h                    |  132 ++++--------
 net/sctp/associola.c                       |   27 ++-
 net/sctp/chunk.c                           |   15 ++-
 net/sctp/output.c                          |   50 +---
 net/sctp/outqueue.c                        |   22 ++
 net/sctp/protocol.c                        |    3 +
 net/sctp/sm_make_chunk.c                   |   13 +-
 net/sctp/sm_sideeffect.c                   |    5 +-
 net/sctp/sm_statefuns.c                    |   26 ++-
 net/sctp/socket.c                          |  335 +---------------------------
 net/sctp/sysctl.c                          |   13 +
 net/sctp/transport.c                       |   45 ++++-
 17 files changed, 223 insertions(+), 499 deletions(-)
maintainer
#1 lore raw

From: Vlad Yasevich <[email protected]>
Date: Mon, 23 Nov 2009 16:06:50 -0500

Quoted 11 lines

Hi David

Here is a set of SCTP patches for net-next. Please pull.

The following changes since commit dc63d3771cc6492220f53caf5fded6090d45d9ce:
Alexander Duyck (1):
ixgbe: Only set/clear VFE in ixgbe_set_rx_mode

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/vxy/lksctp-dev.git net-next

Pulled, thanks a lot Vlad.

#2 lore raw
In reply to Vlad Yasevich
Quoted 4 lines · On Mon, 23 Nov 2009 16:06:50 -0500 Vlad Yasevich <[email protected]>…

Andrei Pelinescu-Onciul (3):
sctp: allow setting path_maxrxt independent of SPP_PMTUD_ENABLE
sctp: limit maximum autoclose setsockopt value
sctp: fix integer overflow when setting the autoclose timer

Problems with this one:

: commit f6778aab6ccc4b510b4dcfa770d9949b696b4545
: Author: Andrei Pelinescu-Onciul <[email protected]>
: AuthorDate: Mon Nov 23 15:54:01 2009 -0500
: Commit: Vlad Yasevich <[email protected]>
: CommitDate: Mon Nov 23 15:54:01 2009 -0500
:
: sctp: limit maximum autoclose setsockopt value
:

:     To avoid overflowing the maximum timer interval when transforming
:     the  autoclose interval from seconds to jiffies, limit the maximum
:     autoclose value to MAX_SCHEDULE_TIMEOUT/HZ.

:
: Signed-off-by: Andrei Pelinescu-Onciul <[email protected]>
: Signed-off-by: Vlad Yasevich <[email protected]>
:
: diff --git a/net/sctp/socket.c b/net/sctp/socket.c
: index d2681a6..71513b3 100644
: --- a/net/sctp/socket.c
: +++ b/net/sctp/socket.c
: @@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,

:  		return -EINVAL;
:  	if (copy_from_user(&sp->autoclose, optval, optlen))
:  		return -EFAULT;

: + /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
: + if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
: + sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
:
: return 0;
: }

a) it has two coding-style errors in two lines. Please go away, add scripts/checkpatch.pl to your patch development tools and then continue reading.

b) have you done that yet?

c) it generates this on 64-bit:

net/sctp/socket.c: In function 'sctp_setsockopt_autoclose':
net/sctp/socket.c:2090: warning: comparison is always false due to limited range of data type

but that's proving somewhat hard to fix in a nice way.

d) I'm not sure that we should fix it anyway. Is it really a good idea to take an incorrect, invalid setting from userspace, to silently modify that setting and to not inform userspace?

Bear in mind that MAX_SCHEDULE_TIMEOUT has different values on 32- and 64-bit kernels. So the same source code will have different behaviour depending on what type of kernel it is executed on.

I think.

It also means that kernel behaviour will differ as CONFIG_HZ is altered, in some way which I can't be bothered working out.

Overall, it would be way simpler and saner to clamp this value to some explicit time period, IMO.

<pulls number out of thin air>

net/sctp/socket.c renamed from net/sctp/socket.c~a +2 -3
@@ -2086,9 +2086,8 @@ static int sctp_setsockopt_autoclose(str
 		return -EINVAL;
 	if (copy_from_user(&sp->autoclose, optval, optlen))
 		return -EFAULT;
-	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
-	if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
-		sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
+	/* make sure it won't exceed one hour */
+	sp->autoclose = min_t(u32, sp->autoclose, 60 * 60);
 
 	return 0;
 }

_

#3 lore raw
Quoted 39 lines · Andrew Morton
Quoted 4 lines · On Mon, 23 Nov 2009 16:06:50 -0500 Vlad Yasevich <[email protected]>…

Andrei Pelinescu-Onciul (3):
sctp: allow setting path_maxrxt independent of SPP_PMTUD_ENABLE
sctp: limit maximum autoclose setsockopt value
sctp: fix integer overflow when setting the autoclose timer

Problems with this one:

: commit f6778aab6ccc4b510b4dcfa770d9949b696b4545
: Author: Andrei Pelinescu-Onciul <[email protected]>
: AuthorDate: Mon Nov 23 15:54:01 2009 -0500
: Commit: Vlad Yasevich <[email protected]>
: CommitDate: Mon Nov 23 15:54:01 2009 -0500
:
: sctp: limit maximum autoclose setsockopt value
:

:     To avoid overflowing the maximum timer interval when transforming
:     the  autoclose interval from seconds to jiffies, limit the maximum
:     autoclose value to MAX_SCHEDULE_TIMEOUT/HZ.

:
: Signed-off-by: Andrei Pelinescu-Onciul <[email protected]>
: Signed-off-by: Vlad Yasevich <[email protected]>
:
: diff --git a/net/sctp/socket.c b/net/sctp/socket.c
: index d2681a6..71513b3 100644
: --- a/net/sctp/socket.c
: +++ b/net/sctp/socket.c
: @@ -2086,6 +2086,9 @@ static int sctp_setsockopt_autoclose(struct sock *sk, char __user *optval,

:  		return -EINVAL;
:  	if (copy_from_user(&sp->autoclose, optval, optlen))
:  		return -EFAULT;

: + /* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
: + if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
: + sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
:
: return 0;
: }

Quoted 5 lines

a) it has two coding-style errors in two lines. Please go away, add scripts/checkpatch.pl to your patch development tools and then continue reading.

b) have you done that yet?

Gack, totally missed those spaces in the email client. Will use checkpatch from now on.

Quoted 7 lines

c) it generates this on 64-bit:

net/sctp/socket.c: In function 'sctp_setsockopt_autoclose':
net/sctp/socket.c:2090: warning: comparison is always false due to limited range of data type

but that's proving somewhat hard to fix in a nice way.

There was a patch that fixed it. I saw that you pulled it into -mm tree.

Quoted 5 lines

d) I'm not sure that we should fix it anyway. Is it really a good idea to take an incorrect, invalid setting from userspace, to silently modify that setting and to not inform userspace?

We do it with other options, that's not an issue. At the values where we change it, it becomes somewhat moot point.

Quoted 9 lines

Bear in mind that MAX_SCHEDULE_TIMEOUT has different values on 32- and 64-bit kernels. So the same source code will have different behaviour depending on what type of kernel it is executed on.

I think.

It also means that kernel behaviour will differ as CONFIG_HZ is altered, in some way which I can't be bothered working out.

This is actually OK. It allows the longest possible timeout depending on configuration. I've actually tested this in a harness and it works very well with different HZ values (to bad the harness in not 64 bit aware. :( )

Quoted 9 lines

Overall, it would be way simpler and saner to clamp this value to some explicit time period, IMO.

<pulls number out of thin air>

net/sctp/socket.c static int sctp_setsockopt_autoclose(str · line 2091

Quoted 9 lines
net/sctp/socket.c renamed from net/sctp/socket.c~a +2 -3
@@ -2086,9 +2086,8 @@ static int sctp_setsockopt_autoclose(str
 		return -EINVAL;
 	if (copy_from_user(&sp->autoclose, optval, optlen))
 		return -EFAULT;
-	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
-	if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
-		sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
+	/* make sure it won't exceed one hour */
+	sp->autoclose = min_t(u32, sp->autoclose, 60 * 60);
 

But that may not be long enough. The spec doesn't impose limits and it's really up to the application to decide how long it wants to keep idle connections open. Thus any limits shorter the maximum supported by kernel are really artificial and may not be sufficient.

Thanks
-vlad

#4 lore raw
Quoted 15 lines · On Fri, 04 Dec 2009 11:23:14 -0500 Vlad Yasevich <[email protected]>…
Quoted 15 lines

Overall, it would be way simpler and saner to clamp this value to some explicit time period, IMO.

<pulls number out of thin air>

net/sctp/socket.c renamed from net/sctp/socket.c~a +0 -3
@@ -2086,9 +2086,8 @@ static int sctp_setsockopt_autoclose(str
 		return -EINVAL;
 	if (copy_from_user(&sp->autoclose, optval, optlen))
 		return -EFAULT;
-	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
-	if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
-		sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
Quoted 8 lines

net/sctp/socket.c static int sctp_setsockopt_autoclose(str · line 2091

Quoted 3 lines
net/sctp/socket.c renamed from net/sctp/socket.c~a +2 -0
+	/* make sure it won't exceed one hour */
+	sp->autoclose = min_t(u32, sp->autoclose, 60 * 60);
 

But that may not be long enough. The spec doesn't impose limits and it's really up to the application to decide how long it wants to keep idle connections open. Thus any limits shorter the maximum supported by kernel are really artificial and may not be sufficient.

Could make ->autoclose a u64? That fixes any 32bit-vs-64bit inconsistencies and allows for an effectively infinite period.

#5 lore raw
Quoted 25 lines · Andrew Morton
Quoted 5 lines · On Fri, 04 Dec 2009 11:23:14 -0500 Vlad Yasevich <[email protected]>…
Quoted 5 lines

Overall, it would be way simpler and saner to clamp this value to some explicit time period, IMO.

<pulls number out of thin air>

Quoted 16 lines

net/sctp/socket.c static int sctp_setsockopt_autoclose(str · line 2091

Quoted 12 lines
net/sctp/socket.c renamed from net/sctp/socket.c~a +2 -3
@@ -2086,9 +2086,8 @@ static int sctp_setsockopt_autoclose(str
 		return -EINVAL;
 	if (copy_from_user(&sp->autoclose, optval, optlen))
 		return -EFAULT;
-	/* make sure it won't exceed MAX_SCHEDULE_TIMEOUT */
-	if (sp->autoclose > (MAX_SCHEDULE_TIMEOUT / HZ) )
-		sp->autoclose = MAX_SCHEDULE_TIMEOUT / HZ ;
+	/* make sure it won't exceed one hour */
+	sp->autoclose = min_t(u32, sp->autoclose, 60 * 60);
 

But that may not be long enough. The spec doesn't impose limits and it's really up to the application to decide how long it wants to keep idle connections open. Thus any limits shorter the maximum supported by kernel are really artificial and may not be sufficient.

Quoted 3 lines

Could make ->autoclose a u64? That fixes any 32bit-vs-64bit inconsistencies and allows for an effectively infinite period.

That's isn't going to help much since the timer intervals are unsigned longs, and would overflow on 32 bit systems. We would still need the limiting value to prevent that overflow, but would be able to drop the cast. Additionally, the API provides only for a 32 bit integer, thus we would waste 32 bit of space.

I don't think that's worth it. The last patch from Andrei fixed the warning with a cast to u32. It seems like the simplest solution.

-vlad