Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packetdrill segfault #23

Closed
cpaasch opened this issue May 25, 2014 · 3 comments
Closed

packetdrill segfault #23

cpaasch opened this issue May 25, 2014 · 3 comments

Comments

@cpaasch
Copy link
Contributor

cpaasch commented May 25, 2014

I have the following segfault (seen in dmesg):

934.129310] packetdrill[1530]: segfault at 8 ip 080749ba sp bfb02230 error 4 in packetdrill[8048000+1e3000]

with the script:

0       `sysctl -w net.ipv4.tcp_keepalive_intvl=1`
+0      `sysctl -w net.ipv4.tcp_keepalive_probes=5`
+0      `sysctl -w net.ipv4.tcp_keepalive_time=10`
+0      `ip tcp_metrics flush`

+0      socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0      setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0      bind(3, ..., ...) = 0
+0      listen(3, 1) = 0

+0      setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0

+0      < S 0:0(0) win 32792 <mss 1460,mp_capable a> sock(3)
+0      > S. 0:0(0) ack 1 <mss 1460,mp_capable b> sock(3)
+0      < . 1:1(0) ack 1 win 29200 <mp_capable a b> sock(3)

+0      accept(3, ..., ...) = 4

/* Client send 1000 bytes */
+0      < . 1:1001(1000) ack 1 win 32792 <dss dack4 dsn4> sock(4)
+0      > . 1:1(0) ack 1001 <dss dack4> sock(4)

+0      read(4, ..., 1000) = 1000

/* establish an additional subflow */
+0      socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0      setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0      bind(5, {sa_family = AF_INET, sin_port = htons(13001), sin_addr = inet_addr("192.168.0.1")}, ...) = 0
+0      listen(5,1) = 0

+0      < S 0:0(0) win 32792 <mss 1460,mp_join_syn backup=0 address_id=0 token=sha1_32(b)> sock(5)
+0      > S. 0:0(0) ack 1 <mss 1460,mp_join_syn_ack backup=0 address_id=0 sender_hmac=trunc_l64_hmac(key_b key_a) > sock(5)
+0.1    < . 1:1(0) ack 1 win 32792 <mp_join_ack sender_hmac=full_160_hmac(key_a key_b)> sock(5)
+0      > . 1:1(0) ack 1 <...> sock(6)

+0      mp_join_accept(5) = 6

/* Keepalives are sent on all subflows */
+9.9    > . 0:0(0) ack 1 <dss dack4> sock(6)
+0      > . 0:0(0) ack 1001 <dss dack4> sock(4)
/* And repeat the probe every 3 seconds if there are no response. */
+1      > . 0:0(0) ack 1 <dss dack4> sock(6)
+0      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+1      > . 0:0(0) ack 1 <dss dack4> sock(6)
+0      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+1      > . 0:0(0) ack 1 <dss dack4> sock(6)
+0      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+1      > . 0:0(0) ack 1 <dss dack4> sock(6)
+0      > . 0:0(0) ack 1001 <dss dack4> sock(4)

/* should fastclose */
+1      > . 1:1(0) ack 1001 <mp_fastclose> sock(4)
+0      > R. 1:1(0) ack 1 <dss dack4> sock(6)
+0      < R. 1001:1001(0) ack 1 win 32792 sock(4)

+0.1    `sysctl -w net.ipv4.tcp_keepalive_intvl=75`
+0      `sysctl -w net.ipv4.tcp_keepalive_probes=9`
+0      `sysctl -w net.ipv4.tcp_keepalive_time=7200`

Seems to happen when it sends (or receives) the reset at the end.

@redward
Copy link
Collaborator

redward commented May 26, 2014

I got the next message when I run it:

net.ipv4.tcp_keepalive_intvl = 1
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 10
Object "tcp_metrics" is unknown, try "ip help".
examples/tests/bugs/reset_seg_fault.pkt:4: error executing `ip tcp_metrics flush` command: non-zero status 1

@cpaasch
Copy link
Contributor Author

cpaasch commented May 27, 2014

Just remove the 'ip tcp_metrics flush' command from the script.

@redward
Copy link
Collaborator

redward commented Jul 7, 2014

This issue is now corrected. I didn't close it at right time, sorry.
The example I modified to expect the right socket is as following:

0       `sysctl -w net.ipv4.tcp_keepalive_intvl=1`
+0      `sysctl -w net.ipv4.tcp_keepalive_probes=5`
+0      `sysctl -w net.ipv4.tcp_keepalive_time=10`
+0      `ip tcp_metrics flush`

+0      socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0      setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0      bind(3, ..., ...) = 0
+0      listen(3, 1) = 0

+0      setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0

+0      < S 0:0(0) win 32792 <mss 1460,mp_capable a> sock(3)
+0      > S. 0:0(0) ack 1 <mss 1460,mp_capable b> sock(3)
+0      < . 1:1(0) ack 1 win 29200 <mp_capable a b> sock(3)

+0      accept(3, ..., ...) = 4

/* Client send 1000 bytes */
+0      < . 1:1001(1000) ack 1 win 32792 <dss dack4 dsn4> sock(4)
+0      > . 1:1(0) ack 1001 <dss dack4> sock(4)

+0      read(4, ..., 1000) = 1000

/* establish an additional subflow */
+0      socket(..., SOCK_STREAM, IPPROTO_TCP) = 5
+0      setsockopt(5, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0      bind(5, {sa_family = AF_INET, sin_port = htons(13001), sin_addr = inet_addr("192.168.0.1")}, ...) = 0
+0      listen(5,1) = 0

+0      < S 0:0(0) win 32792 <mss 1460,mp_join_syn backup=0 address_id=0 token=sha1_32(b)> sock(5)
+0      > S. 0:0(0) ack 1 <mss 1460,mp_join_syn_ack backup=0 address_id=0 sender_hmac=trunc_l64_hmac(key_b key_a) > sock(5)
+0.1    < . 1:1(0) ack 1 win 32792 <mp_join_ack sender_hmac=full_160_hmac(key_a key_b)> sock(5)
+0      > . 1:1(0) ack 1 <...> sock(6)

+0      mp_join_accept(5) = 6

/* Keepalives are sent on all subflows */
+9.9      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+0    > . 0:0(0) ack 1 <dss dack4> sock(6)

/* And repeat the probe every 3 seconds if there are no response. */

+1      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+0      > . 0:0(0) ack 1 <dss dack4> sock(6)

+1      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+0      > . 0:0(0) ack 1 <dss dack4> sock(6)

+1      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+0      > . 0:0(0) ack 1 <dss dack4> sock(6)

+1      > . 0:0(0) ack 1001 <dss dack4> sock(4)
+0      > . 0:0(0) ack 1 <dss dack4> sock(6)

/* should fastclose */
+1      > . 1:1(0) ack 1001 <mp_fastclose> sock(4)
+0      > R. 1:1(0) ack 1 <dss dack4> sock(6)
+0      < R. 1001:1001(0) ack 1 win 32792 sock(4)

+0.1    `sysctl -w net.ipv4.tcp_keepalive_intvl=75`
+0      `sysctl -w net.ipv4.tcp_keepalive_probes=9`
+0      `sysctl -w net.ipv4.tcp_keepalive_time=7200`

I ran it with :
$ sudo ./packetdrill examples/corrections/data_fin.pkt --tolerance_usecs=100000 -v

and got

net.ipv4.tcp_keepalive_intvl = 1
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_time = 10
inbound injected packet:  0.025234 S 0:0(0) win 32792 <mss 1460,mp_capable sender_key: 153199658677876282, flags: 129>
outbound sniffed packet:  0.026556 S. 3300006548:3300006548(0) ack 1 win 28800 <mss 1460,mp_capable sender_key: 4858591269394488144, flags: 129>
inbound injected packet:  0.026604 . 1:1(0) ack 3300006549 win 29200 <mp_capable sender_key: 153199658677876282 receiver_key: 4858591269394488144, flags 129>
inbound injected packet:  0.026690 . 1:1001(1000) ack 3300006549 win 32792 <dss dack4 4102526830 dsn4 2070503321 ssn 1 dll 1000 checksum 57145 flags: MA>
outbound sniffed packet:  0.026718 . 3300006549:3300006549(0) ack 1001 win 59000 <dss dack4 2070504321 flags: A>
inbound injected packet:  0.027104 S 0:0(0) win 32792 <mss 1460,mp_join_syn flags: 0, address id: 0, receiver token: 143956527, sender random number: 590657082>
outbound sniffed packet:  0.027132 S. 1885174322:1885174322(0) ack 1 win 28800 <mss 1460,mp_join_syn_ack flags: 0, address id: 0, sender hmac: 8484337386671086230, sender random number: 845585034>
inbound injected packet:  0.127791 . 1:1(0) ack 1885174323 win 32792 <mp_join_ack sender hmac (160) bits, by 32bits bloc from [0] to [4]: 3127187271, 3807341752, 4065235748, 2785452501, 141418444>
outbound sniffed packet:  0.127937 . 1885174323:1885174323(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 10.036222 . 3300006548:3300006548(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 10.132214 . 1885174322:1885174322(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 11.036273 . 3300006548:3300006548(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 11.132249 . 1885174322:1885174322(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 12.036301 . 3300006548:3300006548(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 12.132297 . 1885174322:1885174322(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 13.036336 . 3300006548:3300006548(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 13.132342 . 1885174322:1885174322(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 14.036394 . 3300006548:3300006548(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 14.132403 . 1885174322:1885174322(0) ack 1 win 65535 <dss dack4 2070504321 flags: A>
outbound sniffed packet: 15.036453 R. 3300006549:3300006549(0) ack 1001 win 65535 <dss dack4 2070504321 flags: A>

@redward redward closed this as completed Jul 7, 2014
matttbe pushed a commit to multipath-tcp/packetdrill_mptcp that referenced this issue Mar 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants