nuttx/net
ligd 00c0801743 local socket: fix accept used after free
==1729315==ERROR: AddressSanitizer: heap-use-after-free on address 0xf0501d60 at pc 0x032ffe43 bp 0xef4ed158 sp 0xef4ed148
READ of size 2 at 0xf0501d60 thread T0
    #0 0x32ffe42 in nxsem_wait semaphore/sem_wait.c:94
    #1 0x3548cf5 in _net_timedwait utils/net_lock.c:97
    #2 0x3548f48 in net_sem_timedwait utils/net_lock.c:236
    #3 0x3548f8c in net_sem_wait utils/net_lock.c:318
    #4 0x350124d in local_accept local/local_accept.c:246
    #5 0x3492719 in psock_accept socket/accept.c:149
    #6 0x3492bcc in accept4 socket/accept.c:280
    #7 0x662dc04 in accept net/lib_accept.c:50
    #8 0x55c81ab in kvdb_loop kvdb/server.c:415
    #9 0x55c860a in kvdbd_main kvdb/server.c:458
    #10 0x33d968b in nxtask_startup sched/task_startup.c:70
    #11 0x32ec039 in nxtask_start task/task_start.c:134
    #12 0x34109be in pre_start sim/sim_initialstate.c:52

0xf0501d60 is located 288 bytes inside of 420-byte region [0xf0501c40,0xf0501de4)
freed by thread T0 here:
    #0 0xf7aa6a3f in __interceptor_free ../../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:127
    #1 0x73aa06e in host_free sim/posix/sim_hostmemory.c:192
    #2 0x34131d6 in mm_free sim/sim_heap.c:230
    #3 0x3409388 in free umm_heap/umm_free.c:49
    #4 0x35631f3 in local_free local/local_conn.c:225
    #5 0x3563f75 in local_release local/local_release.c:129
    #6 0x34f5a32 in local_close local/local_sockif.c:785
    #7 0x3496ee8 in psock_close socket/net_close.c:102
    #8 0x36500bc in sock_file_close socket/socket.c:115
    #9 0x3635f6c in file_close vfs/fs_close.c:74
    #10 0x3632439 in nx_close_from_tcb inode/fs_files.c:670
    #11 0x36324f3 in nx_close inode/fs_files.c:697
    #12 0x3632557 in close inode/fs_files.c:735
    #13 0x55be289 in property_set_ kvdb/client.c:210
    #14 0x55c0309 in property_set_int32_ kvdb/common.c:226
    #15 0x55c03f5 in property_set_int32_oneway kvdb/common.c:236

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-09-24 10:42:35 +08:00
..
arp net/arp: arp should depends on MM_IOB 2023-09-12 16:24:52 +08:00
bluetooth net/assert: remove all unnecessary check for psock/conn 2023-08-30 20:36:49 +08:00
can net/can: add missing FAR specifier 2023-09-16 14:17:47 +08:00
devif devif_callback: modify the code logic to conform to the comment 2023-09-14 18:21:32 +08:00
icmp cmake:complete missing changes during reforming for net 2023-09-13 21:51:20 +08:00
icmpv6 cmake:complete missing changes during reforming for net 2023-09-13 21:51:20 +08:00
ieee802154 net/assert: remove all unnecessary check for psock/conn 2023-08-30 20:36:49 +08:00
igmp mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
inet inet_sendto: correct error messages and remove the comment 2023-09-09 00:16:52 +08:00
ipforward build: add initial cmake build system 2023-07-08 13:50:48 +08:00
ipfrag net/ipfrag:Fixed ref not initializing warning issue 2023-07-26 08:36:04 -03:00
local local socket: fix accept used after free 2023-09-24 10:42:35 +08:00
mld MLD: add byte order conversion for ipv6 address printing 2023-09-09 00:23:35 +08:00
nat mm/alloc: remove all unnecessary cast for alloc 2023-08-30 14:34:20 +08:00
neighbor build: add initial cmake build system 2023-07-08 13:50:48 +08:00
netdev socket can : support ioctl cmd SIOCCANRECOVERY 2023-08-21 13:18:51 +08:00
netfilter build: add initial cmake build system 2023-07-08 13:50:48 +08:00
netlink net/assert: remove all unnecessary check for psock/conn 2023-08-30 20:36:49 +08:00
pkt net/assert: remove all unnecessary check for psock/conn 2023-08-30 20:36:49 +08:00
procfs cmake:complete missing changes during reforming for net 2023-09-13 21:51:20 +08:00
route build: add initial cmake build system 2023-07-08 13:50:48 +08:00
rpmsg rpmsg socket: add return value check. 2023-09-19 09:33:30 +08:00
sixlowpan nxstyle: cleanup UTF-8 Unicode to ASCII 2023-09-18 11:54:17 -04:00
socket net: Create fallback option for usrsock 2023-09-21 01:08:11 +08:00
tcp net/usrsock: Can enable TCP/UDP IP stack with Usrsock enabled 2023-09-21 01:08:11 +08:00
udp net/usrsock: Can enable TCP/UDP IP stack with Usrsock enabled 2023-09-21 01:08:11 +08:00
usrsock net/usrsock: Can enable TCP/UDP IP stack with Usrsock enabled 2023-09-21 01:08:11 +08:00
utils refine: set file mode when oflags contains O_CREAT 2023-09-23 15:20:51 +08:00
CMakeLists.txt build: add initial cmake build system 2023-07-08 13:50:48 +08:00
Kconfig arch: Remove up_netinitialize 2023-08-20 14:33:17 +03:00
Makefile Support fragmentation and reassembly 2023-01-17 14:01:37 +08:00
net_initialize.c net: Reoder the initialize sequence(mac->ip->tcp/udp) 2022-03-12 19:24:17 +02:00
README.txt Support fragmentation and reassembly 2023-01-17 14:01:37 +08:00

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   |
    +----------------------------------------------------------------+ +--------------------------+