1.0.16 sctp_connectx() in 32 bit
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, ¶m, &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
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, ¶m, &opt_len);
Quoted 8 lines
And in kernel
net/sctp/socket.csctp_getsockopt_connectx3(), there is a check,if (len < sizeof(param)) |
return-EINVAL; |But struct
sctp_getaddrs_oldcontains a pointer . When compiled in 32 bit or 64 bit, the size ofsctp_getaddrs_oldis 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:
Quoted 3 lines
Thanks,
Dong
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, ¶m,
&opt_len);And in kernel
net/sctp/socket.csctp_getsockopt_connectx3(), there is a check,Quoted 6 lines
if (len < sizeof(param)) |
return-EINVAL; |But struct
sctp_getaddrs_oldcontains a pointer . When compiled in 32 bit or 64 bit,
the size ofsctp_getaddrs_oldis 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:
Thanks Daniel,
The patch is small, I can easily apply to my running kernel.
Dong
Quoted 3 lines
Quoted 3 lines
Thanks,
Dong