nuttx/net
zhanghongyu 3db1654b80 net/local: remove client from server.lc_waiters when client close
if client is a noblocking socket, user can do close when server has not yet
invoke accept interface, so we need remove this socket from server.lc_waiters.
avoid server socket access the freed memory.

==936564==ERROR: AddressSanitizer: heap-use-after-free on address 0xf23071c8 at pc 0x58eaac3b bp 0xf0b9e218 sp 0xf0b9e208
READ of size 4 at 0xf23071c8 thread T0
    #0 0x58eaac3a in dq_remfirst queue/dq_remfirst.c:45
    #1 0x58fd1efe in local_accept local/local_accept.c:141
    #2 0x58f66df6 in psock_accept socket/accept.c:149
    #3 0x58f672a4 in accept4 socket/accept.c:280
    #4 0x5be9ee0c in accept net/lib_accept.c:50
    #5 0x592d6a5d in uv__accept libuv/src/unix/core.c:502
    #6 0x5930d83b in uv__server_io libuv/src/unix/stream.c:550
    #7 0x592efbde in uv__io_poll libuv/src/unix/posix-poll.c:335
    #8 0x592d649a in uv_run libuv/src/unix/core.c:387
    #9 0x5a7180f7 in service_schedule_loop service/common/service_loop.c:146
    #10 0x591f300b in pthread_startup pthread/pthread_create.c:59
    #11 0x5be8134f in pthread_start pthread/pthread_create.c:139
    #12 0x58ee2762 in pre_start sim/sim_initialstate.c:53

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-17 09:01:36 +02:00
..
arp build: add initial cmake build system 2023-07-08 13:50:48 +08:00
bluetooth build: add initial cmake build system 2023-07-08 13:50:48 +08:00
can build: add initial cmake build system 2023-07-08 13:50:48 +08:00
devif build: add initial cmake build system 2023-07-08 13:50:48 +08:00
icmp build: add initial cmake build system 2023-07-08 13:50:48 +08:00
icmpv6 build: add initial cmake build system 2023-07-08 13:50:48 +08:00
ieee802154 build: add initial cmake build system 2023-07-08 13:50:48 +08:00
igmp build: add initial cmake build system 2023-07-08 13:50:48 +08:00
inet build: add initial cmake build system 2023-07-08 13:50:48 +08:00
ipforward build: add initial cmake build system 2023-07-08 13:50:48 +08:00
ipfrag build: add initial cmake build system 2023-07-08 13:50:48 +08:00
local net/local: remove client from server.lc_waiters when client close 2023-07-17 09:01:36 +02:00
mld build: add initial cmake build system 2023-07-08 13:50:48 +08:00
nat net/nat: Fix compiler warning 2023-07-12 19:29:14 +08:00
neighbor build: add initial cmake build system 2023-07-08 13:50:48 +08:00
netdev build: add initial cmake build system 2023-07-08 13:50:48 +08:00
netfilter build: add initial cmake build system 2023-07-08 13:50:48 +08:00
netlink netlink: add some definition 2023-07-08 11:12:41 -03:00
pkt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
procfs build: add initial cmake build system 2023-07-08 13:50:48 +08:00
route build: add initial cmake build system 2023-07-08 13:50:48 +08:00
rpmsg build: add initial cmake build system 2023-07-08 13:50:48 +08:00
sixlowpan build: add initial cmake build system 2023-07-08 13:50:48 +08:00
socket build: add initial cmake build system 2023-07-08 13:50:48 +08:00
tcp net: Add msg_peek support for udp and tcp 2023-07-13 19:40:04 +08:00
udp Kconfig: Simplify the conditional default statement 2023-07-16 14:39:20 -03:00
usrsock build: add initial cmake build system 2023-07-08 13:50:48 +08:00
utils build: add initial cmake build system 2023-07-08 13:50:48 +08:00
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig net: Limit max value for Send/Recv bufsize 2023-07-05 13:57:08 +08:00
Makefile
net_initialize.c
README.txt

README
======

Directory Structure
===================

  nuttx/
   |
   `- net/
       |
       +- arp        - Address resolution protocol (IPv4)
       +- bluetooth  - PF_BLUETOOTH socket interface
       +- devif      - Stack/device interface layer
       +- ipfrag     - Fragmentation and reassembly
       +- icmp       - Internet Control Message Protocol (IPv4)
       +- icmpv6     - Internet Control Message Protocol (IPv6)
       +- ieee802154 - PF_IEEE802154 socket interface
       +- inet       - PF_INET/PF_INET6 socket interface
       +- ipforward  - IP forwarding logic
       +- local      - Unix domain (local) sockets
       +- mld        - Multicast Listener Discovery (MLD)
       +- neighbor   - Neighbor Discovery Protocol (IPv6)
       +- netdev     - Socket network device interface
       +- netlink    - Netlink IPC socket interface
       +- pkt        - "Raw" packet socket support
       +- sixlowpan  - 6LoWPAN implementation
       +- socket     - BSD socket interface
       +- route      - Routing table support
       +- tcp        - Transmission Control Protocol
       +- udp        - User Datagram Protocol
       +- usrsock    - User socket API for user-space networking stack
       `- utils      - Miscellaneous utility functions

    +-------------------------------------------------------------------++------------------------+
    |                     Application layer                             || usrsock daemon         |
    +-------------------------------------------------------------------++------------------------+
    +-------------------------------------------------------------------++----------------+ +-----+
    |                   Socket layer (socket/)                          || /dev/usrsock   | |     |
    +-------------------------------------------------------------------++----------------+ |     |
    +------------++--------------------------------------------------++-------------------+ |     |
    |  Network   || Protocol stacks (arp, ipv6, icmp, pkt, tcp, udp) || usrsock/          | |     |
    |   Device   |+--------------------------------------------------++-------------------+ |     |
    | Interface  |+------------------------------------++---------------------------------+ |     |
    | (netdev/)  ||  Network Device Interface (devif/) || Utilities                       | |     |
    +------------++------------------------------------++---------------------------------+ |     |
    +----------------------------------------------------------------+                      |     |
    |                    Network Device Drivers                      |                      | HAL |
    +----------------------------------------------------------------+                      +-----+
    +----------------------------------------------------------------+ +--------------------------+
    |                    Networking Hardware                         | |  Hardware TCP/IP Stack   |
    +----------------------------------------------------------------+ +--------------------------+