[Bug 250366] [tcp] The ioctl of socket fd should return -1 after listen to avoid misusing.

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Oct 15 12:13:57 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=250366

            Bug ID: 250366
           Summary: [tcp] The ioctl of socket fd should return -1 after
                    listen to avoid misusing.
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: yonghaoz1994 at gmail.com

The ioctl of socket fd should return -1 after listen to avoid misusing.

```
0   socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0  setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0.1 ioctl(3, SIOCINQ, [0]) = 0

+0  bind(3, ..., ...) = 0
+0.1 ioctl(3, SIOCINQ, [0]) = 0

+0  listen(3, 1) = 0
+0  < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 ~ +1  > S. 0:0(0) ack 1 <...>

+.1 < . 1:1(0) ack 1 win 32792
+0.1  accept(3, ..., ...) = 4

+0 < . 1:41(40) ack 1 win 28273 

+0.1 ioctl(4, FIONREAD, [40]) = 0
+0.1 ioctl(3, FIONREAD, [0]) = -1 // f-stack/FreeBSD return 0 here
```

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list