Skip to contentSkip to conversation

1.0.16 sctp_connectx() in 32 bit

DISCUSSION Dong Liu 2 participants 3 messages Mar 13, 2014 SCTP protocol

lore
Share & tools
lore

Dong Liu

author
#0 lore raw

Hi,

I think I found a problem in the new sctp_connectx() code.

in sctp_connectx3() there are,

     struct sctp_getaddrs_old param;
     socklen_t opt_len = sizeof(param);
     status getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX3, &param, 

&opt_len);

And in kernel net/sctp/socket.c sctp_getsockopt_connectx3(), there is a check,

if (len < sizeof(param)) |
return
-EINVAL; |

But struct sctp_getaddrs_old contains a pointer . When compiled in 32 bit or 64 bit, the size of sctp_getaddrs_old is different. So if the kernel is in 64 bit mode but the libsctp is in 32 bit mode. sctp_connectx() will fail with EINVAL.

Thanks,

Dong

#1 lore raw
Quoted 10 lines · Dong Liu

Hi,

I think I found a problem in the new sctp_connectx() code.

in sctp_connectx3() there are,

     struct sctp_getaddrs_old param;
     socklen_t opt_len = sizeof(param);
     status getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX3, &param, &opt_len);
Quoted 8 lines

And in kernel net/sctp/socket.c sctp_getsockopt_connectx3(), there is a check,

if (len < sizeof(param)) |
return -EINVAL; |

But struct sctp_getaddrs_old contains a pointer . When compiled in 32 bit or 64 bit, the size of sctp_getaddrs_old is different. So if the kernel is in 64 bit mode but the libsctp is in 32 bit mode. sctp_connectx() will fail with EINVAL.

Kernel issue already fixed in:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?idÿd5939381c609056b33b7585fb05a77b4c695f3

Quoted 3 lines

Thanks,

Dong

author
#2 lore raw
In reply to Dong Liu
Quoted 21 lines · Daniel Borkmann
Quoted 14 lines · Dong Liu

Hi,

I think I found a problem in the new sctp_connectx() code.

in sctp_connectx3() there are,

     struct sctp_getaddrs_old param;
     socklen_t opt_len = sizeof(param);
     status getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX3, &param, 

&opt_len);

And in kernel net/sctp/socket.c sctp_getsockopt_connectx3(), there is a check,

Quoted 6 lines

if (len < sizeof(param)) |
return -EINVAL; |

But struct sctp_getaddrs_old contains a pointer . When compiled in 32 bit or 64 bit,
the size of sctp_getaddrs_old is different. So if the kernel is in

Quoted 8 lines

64 bit mode but

Quoted 1 line

the libsctp is in 32 bit mode. sctp_connectx() will fail with EINVAL.

Kernel issue already fixed in:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?idÿd5939381c609056b33b7585fb05a77b4c695f3

Thanks Daniel,

The patch is small, I can easily apply to my running kernel.

Dong

Quoted 3 lines
Quoted 3 lines

Thanks,

Dong