- Update TTY session checks to ensure proper session leader and controlling TTY conditions during open.
- Modify stdio initialization to prevent init process from acquiring a controlling TTY, aligning with Linux semantics.
- Add a new test case to validate behavior of tcgetpgrp without a controlling TTY.
Signed-off-by: longjin <longjin@DragonOS.org>
- Add flock syscall support with shared/exclusive locks and nonblocking mode
- Introduce open file description ID for flock owner tracking
- Add flock manager with sharded hashmap for lock state management
- Support lock inheritance across dup/fork and release on last close
- Add comprehensive test suite covering basic operations and edge cases
- Fix SCM_RIGHTS fd passing to share open file description instead of cloning
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(netlink): harden route segment parsing and accept short GET payloads
Prevent kernel panics on malformed netlink route messages by adding strict length
validation before reading segment body CType bytes. Add compatibility handling for
short RTM_GETLINK/RTM_GETADDR/RTM_GETROUTE payloads (rtgenmsg-sized) and keep
parsing bounded by nlmsg_len. Add a c_unitest regression test that covers truncated
and rtgen-sized netlink route requests.
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(vfs): make dup/dup2/dup3 share open file description and move close_on_exec to per-fd
Previously, dup/dup2/dup3 used try_clone() which created independent
File objects, violating the POSIX requirement that duplicated fds share
the same open file description (file offset, status flags). Also,
close_on_exec was stored inside File instead of being a per-fd attribute
in the fd table.
This commit:
- Move close_on_exec from File to FileDescriptorVec as a per-fd bitmap,
matching Linux's fdtable.close_on_exec semantics
- Add alloc_fd_arc() to install a shared Arc<File> for dup operations
- Make dup/dup2/dup3 share Arc<File> instead of cloning
- Adapt all 26 call sites (open, pipe, socket, epoll, bpf, kvm, etc.)
to pass explicit cloexec parameter to alloc_fd()
- Fix CLONE_PIDFD to unconditionally set close-on-exec on pidfd
- Fix pidfd_open to unconditionally set close-on-exec on pidfd
- Fix do_dup3 to allow fd table expansion for high newfd values and
return EBADF (not EMFILE) when newfd >= RLIMIT_NOFILE
- Add unit tests covering shared offset, shared flags, per-fd cloexec,
high fd dup2, dup3 EINVAL on same fd, and refcount after close
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(filesystem): propagate O_CLOEXEC flag to file descriptor allocation
- Update`create_epoll`and`perf_event_open`
to pass the O_CLOEXEC flag from file flags to`alloc_fd`
- Ensure`FileDescriptorVec`properly reserves capacity for the`cloexec`
vector when expanding
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
feat(ext4): add device node support with mknod system call
- Implement device inode creation with proper device number encoding in i_block
- Add mknod system call handling for character/block devices and FIFOs
- Support both old (major/minor < 256) and new format device number encoding
- Add comprehensive test suite for mknod functionality
- Fix stat system call to properly handle device nodes
- Add device number utilities compatible with Linux ext4 format
Signed-off-by: xboHodx <xbohodx2024@gmail.com>
- Add atomic rename operation with proper POSIX semantics (no-op when source and
target refer to same inode, atomic replace when target exists)
- Implement rename_exchange for atomic swapping of directory entries
- Add directory entry replacement in place for atomic operations
- Add comprehensive test suite for rename operations
- Fix directory link count handling during rename operations
- Add cycle detection to prevent moving directories into their own
subdirectories
- Update VFS layer to support RENAME_EXCHANGE flag
Signed-off-by: xboHodx <xbohodx2024@gmail.com>
* feat(net): implement netlink socket sendmsg/recvmsg and improve address handling
- Add sendmsg and recvmsg implementations for netlink sockets
- Implement NEWADDR and DELADDR operations for netlink route protocol
- Refactor get_ephemeral_iface to follow Linux-like source address selection
- Fix error propagation in netlink route message sending
- Add socket_ip_unbound_netlink_test to gvisor whitelist
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(net): enhance network interface binding and loopback handling
- Add smoltcp features for increased address and route limits
- Improve error handling for address binding with specific error messages
- Enhance subnet-directed broadcast and loopback interface matching logic
- Add broadcast delivery support for UDP sockets
- Refactor netlink socket to return original message length for TRUNC flag
- Fix route addition to include local routes and proper rollback on failure
- Add batch polling for network interfaces to improve performance
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
- Add kobject uevent netlink protocol support with new socket type
- Implement socket options (SO_TYPE, SO_DOMAIN, SO_PROTOCOL, SO_SNDTIMEO,
SO_RCVTIMEO) for netlink sockets
- Fix SockAddrNl nl_family field type from AddressFamily to u16
- Add timeout handling for send and receive operations
- Improve error handling in remote_endpoint() method
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(procfs): add /proc/sys/net/ipv4/ip_local_port_range interface
- Add net module to procfs sys directory with IPv4 support
- Implement ip_local_port_range file for reading/writing port range
configuration
- Update PortManager to support configurable local port range with atomic
operations
- Extend ephemeral port allocation to use configured range instead of hardcoded
values
- Add gvisor test cases for IPv4 UDP socket functionality
Signed-off-by: longjin <longjin@DragonOS.org>
- Fix signal reentrancy bug by preventing nested SIGSEGV delivery during rseq
fault handling
- Change rseq error handling from sending SIGSEGV to disabling rseq and
returning error
- Add test case to demonstrate and verify the fix for rseq+signal reentrancy
Signed-off-by: longjin <longjin@DragonOS.org>
* refactor(dma): centralize DMA memory management and integrate with block layer
- Introduce unified DMA allocator with pooling support and DmaBuffer abstraction
- Replace ad-hoc DMA allocations in block layer with DmaBuffer
- Remove duplicate DMA implementations from virtio and network drivers
- Add DMA direction and cache policy configuration options
Signed-off-by: longjin <longjin@DragonOS.org>
- Enable multicast features in smoltcp dependency
- Add multicast group management with proper cleanup on socket close
- Implement UDP port binding with SO_REUSEADDR/SO_REUSEPORT support
- Add multicast loopback delivery for local multicast packets
- Support IP_PKTINFO and IP_ORIGDSTADDR control messages
- Improve UDP socket binding/unbinding with interface tracking
- Add raw socket support for UDP loopback packet delivery
- Fix UDP receive filtering for multicast/broadcast addresses
- Implement proper ephemeral port allocation with atomic operations
Signed-off-by: longjin <longjin@DragonOS.org>
- Replace unwrap() with ok_or() for safer error handling in downcast_arc
- Use sysfs_emit_str to simplify string output in show methods
- Remove redundant buffer copy operations for cleaner code
Signed-off-by: longjin <longjin@DragonOS.org>
Implement proper mknod syscall support in DevFS and TmpFS by adding
logic to create character devices, block devices, and FIFO pipes
based on the mode parameter.
- DevFS: Add mknod method to create device nodes
- TmpFS: Enhance mknod to correctly set file type and device number
- Remove ENOSYS error for block/char device creation in TmpFS
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
- return ECHILD when no matching children exist
- handle PGID WNOHANG scanning correctly
- add WNOTHREAD wait test for thread-created child
Signed-off-by: longjin <longjin@DragonOS.org>