From: Tulio A M Mendes Date: Sun, 15 Feb 2026 08:45:21 +0000 (-0300) Subject: docs: update all documentation — 75 features, 44 smoke tests, epoll/inotify/aio/sendm... X-Git-Url: https://projects.tadryanom.me/docs/POSIX_ROADMAP.md?a=commitdiff_plain;h=3845068e97da4392818c831cff84a7d5e5e8635f;p=AdrOS.git docs: update all documentation — 75 features, 44 smoke tests, epoll/inotify/aio/sendmsg/recvmsg/pivot_root/VMM spinlock/spinlock debug --- diff --git a/BUILD_GUIDE.md b/BUILD_GUIDE.md index 0dcbda0..c97d139 100644 --- a/BUILD_GUIDE.md +++ b/BUILD_GUIDE.md @@ -2,7 +2,7 @@ This guide explains how to build and run AdrOS on your local machine (Linux/WSL). -AdrOS is a Unix-like, POSIX-compatible, multi-architecture OS kernel with threads, futex synchronization, networking (TCP/IP + DNS + ICMP + IPv6 + DHCP via lwIP), dynamic linking (`dlopen`/`dlsym`), FAT12/16/32 + ext2 filesystems, POSIX IPC (message queues, semaphores, shared memory), ASLR, SMAP/SMEP, vDSO, zero-copy DMA, virtio-blk, multi-drive ATA, interval timers, `posix_spawn`, a POSIX shell, framebuffer graphics, per-CPU runqueue infrastructure, and ARM64/RISC-V bring-up. See [POSIX_ROADMAP.md](docs/POSIX_ROADMAP.md) for the full compatibility checklist. +AdrOS is a Unix-like, POSIX-compatible, multi-architecture OS kernel with threads, futex synchronization, networking (TCP/IP + DNS + ICMP + IPv6 + DHCP via lwIP), dynamic linking (`dlopen`/`dlsym`), FAT12/16/32 + ext2 filesystems, POSIX IPC (message queues, semaphores, shared memory), ASLR, SMAP/SMEP, vDSO, zero-copy DMA, virtio-blk, multi-drive ATA, interval timers, `posix_spawn`, epoll, inotify, aio_*, sendmsg/recvmsg, pivot_root, a POSIX shell, framebuffer graphics, per-CPU runqueue infrastructure, and ARM64/RISC-V/MIPS bring-up. See [POSIX_ROADMAP.md](docs/POSIX_ROADMAP.md) for the full compatibility checklist. ## 1. Dependencies @@ -92,12 +92,12 @@ Syscall return convention note: ### Userland programs The following ELF binaries are bundled in the initrd: -- `/bin/init.elf` — comprehensive smoke test suite (20+ checks) +- `/bin/init.elf` — comprehensive smoke test suite (44 checks) - `/bin/echo` — argv/envp test - `/bin/sh` — POSIX sh-compatible shell with `$PATH` search, pipes, redirects, builtins - `/bin/cat`, `/bin/ls`, `/bin/mkdir`, `/bin/rm` — core utilities - `/bin/doom.elf` — DOOM (doomgeneric port) — included in initrd if built (see below) -- `/lib/ld.so` — dynamic linker with full relocation processing +- `/lib/ld.so` — dynamic linker with auxv parsing, PLT/GOT eager relocation The ulibc provides: `printf`, `malloc`/`free`/`calloc`/`realloc`, `string.h`, `unistd.h`, `errno.h`, `pthread.h`, `signal.h` (with `raise`, `sigaltstack`, `sigpending`, `sigsuspend`), `stdio.h` (buffered I/O with `fopen`/`fread`/`fwrite`/`fclose`), `stdlib.h` (`atof`, `strtol`, `getenv` stub, `system` stub), `ctype.h`, `sys/mman.h` (`mmap`/`munmap`), `sys/ioctl.h` (`ioctl`), `time.h` (`nanosleep`/`clock_gettime`), `sys/times.h`, `sys/uio.h`, `sys/types.h`, `sys/stat.h`, `math.h` (`fabs`), `assert.h`, `fcntl.h`, `strings.h`, `inttypes.h`, `linux/futex.h`, and `realpath()`. @@ -120,6 +120,9 @@ The init program (`/bin/init.elf`) runs a comprehensive suite of smoke tests on - diskfs mkdir/unlink/getdents - Persistent counter (`/persist/counter`) - `/dev/tty` write test +- Memory: `brk`, `mmap`/`munmap`, `clock_gettime`, shared memory (`shmget`/`shmat`/`shmdt`) +- Advanced: `pread`/`pwrite`, `ftruncate`, `symlink`/`readlink`, `access`, `sigprocmask`/`sigpending`, `alarm`/`SIGALRM`, `O_APPEND`, `umask`, pipe capacity (`F_GETPIPE_SZ`/`F_SETPIPE_SZ`), `waitid`, `setitimer`/`getitimer`, `select`/`poll` on regular files, hard links +- New: `epoll` (create/ctl/wait on pipe), `inotify` (init/add_watch/rm_watch), `aio_*` (read/write/error/return) All tests print `[init] ... OK` on success. Any failure calls `sys_exit(1)`. @@ -134,7 +137,7 @@ Individual test targets: ```bash make check # cppcheck + sparse + gcc -fanalyzer make test-host # 47 host-side unit tests (test_utils + test_security) -make test # QEMU smoke test (4 CPUs, 90s timeout, 20 checks incl. ICMP ping) +make test # QEMU smoke test (4 CPUs, 30s timeout, 44 checks incl. ICMP ping, epoll, inotify, aio) make test-1cpu # Single-CPU smoke test (50s timeout) make test-battery # Full test battery: multi-disk ATA, VFS mount, ping, diskfs (16 checks) make test-gdb # GDB scripted integrity checks (heap, PMM, VGA) diff --git a/README.md b/README.md index eb98c29..54d76de 100644 --- a/README.md +++ b/README.md @@ -57,13 +57,15 @@ AdrOS is a Unix-like, POSIX-compatible, multi-architecture operating system deve - **File I/O:** `open`, `openat`, `read`, `write`, `close`, `lseek`, `stat`, `fstat`, `fstatat`, `dup`, `dup2`, `dup3`, `pipe`, `pipe2`, `select`, `poll`, `ioctl`, `fcntl`, `getdents`, `pread`, `pwrite`, `readv`, `writev`, `truncate`, `ftruncate`, `fsync`, `fdatasync` - **Directory ops:** `mkdir`, `rmdir`, `unlink`, `unlinkat`, `rename`, `chdir`, `getcwd`, `link`, `symlink`, `readlink`, `chmod`, `chown`, `access`, `umask` - **Signals:** `sigaction` (`SA_SIGINFO`), `sigprocmask`, `kill`, `sigreturn` (full trampoline), `sigpending`, `sigsuspend`, `sigaltstack`, `sigqueue` -- **Process:** `setuid`, `setgid`, `seteuid`, `setegid`, `getuid`, `getgid`, `geteuid`, `getegid`, `alarm`, `times`, `futex`, `waitid`, `posix_spawn`, `setitimer`, `getitimer` +- **Process:** `setuid`, `setgid`, `seteuid`, `setegid`, `getuid`, `getgid`, `geteuid`, `getegid`, `alarm`, `times`, `futex`, `waitid`, `posix_spawn`, `setitimer`, `getitimer`, `pivot_root` - **IPC:** `mq_open`, `mq_close`, `mq_unlink`, `mq_send`, `mq_receive`, `mq_getattr`, `mq_setattr`, `sem_open`, `sem_close`, `sem_unlink`, `sem_wait`, `sem_post`, `sem_getvalue` +- **I/O multiplexing (advanced):** `epoll_create`, `epoll_ctl`, `epoll_wait`, `inotify_init`, `inotify_add_watch`, `inotify_rm_watch` +- **Async I/O:** `aio_read`, `aio_write`, `aio_error`, `aio_return`, `aio_suspend` - **FD flags:** `O_NONBLOCK`, `O_CLOEXEC`, `O_APPEND`, `FD_CLOEXEC` via `fcntl` (`F_GETFD`/`F_SETFD`/`F_GETFL`/`F_SETFL`) - **File locking:** `flock` (advisory, no-op stub) - **Shared memory:** `shmget`, `shmat`, `shmdt`, `shmctl` - **Threads:** `clone`, `gettid`, `set_thread_area`, `futex` -- **Networking:** `socket`, `bind`, `listen`, `accept`, `connect`, `send`, `recv`, `sendto`, `recvfrom` +- **Networking:** `socket`, `bind`, `listen`, `accept`, `connect`, `send`, `recv`, `sendto`, `recvfrom`, `sendmsg`, `recvmsg` - Per-process fd table with atomic refcounted file objects - Centralized user-pointer access API (`user_range_ok`, `copy_from_user`, `copy_to_user`) - Error returns use negative errno codes (Linux-style) @@ -129,7 +131,7 @@ AdrOS is a Unix-like, POSIX-compatible, multi-architecture operating system deve - **Core utilities** — `/bin/cat`, `/bin/ls`, `/bin/mkdir`, `/bin/rm`, `/bin/echo` - `/bin/init.elf` — comprehensive smoke test suite - `/bin/doom.elf` — DOOM (doomgeneric port) — runs on `/dev/fb0` + `/dev/kbd` -- `/lib/ld.so` — dynamic linker with full relocation processing +- `/lib/ld.so` — dynamic linker with auxv parsing, PLT/GOT eager relocation ### Dynamic Linking - **Full `ld.so`** — kernel-side relocation processing for `R_386_RELATIVE`, `R_386_32`, `R_386_GLOB_DAT`, `R_386_JMP_SLOT`, `R_386_COPY`, `R_386_PC32` @@ -157,7 +159,7 @@ AdrOS is a Unix-like, POSIX-compatible, multi-architecture operating system deve ### Testing - **47 host-side unit tests** — `test_utils.c` (28) + `test_security.c` (19) -- **35 QEMU smoke tests** — 4-CPU expect-based (file I/O, signals, memory mgmt, IPC, devices, procfs, networking) +- **44 QEMU smoke tests** — 4-CPU expect-based (file I/O, signals, memory mgmt, IPC, devices, procfs, networking, epoll, inotify, aio) - **16-check test battery** — multi-disk ATA (hda+hdb+hdd), VFS mount, ping, diskfs ops (`make test-battery`) - **Static analysis** — cppcheck, sparse, gcc -fanalyzer - **GDB scripted checks** — heap/PMM/VGA integrity @@ -197,7 +199,7 @@ QEMU debug helpers: See [POSIX_ROADMAP.md](docs/POSIX_ROADMAP.md) for a detailed checklist. -**All 31 planned POSIX tasks are complete**, plus 35 additional features (66 total). The kernel covers **~98%** of the core POSIX interfaces needed for a practical Unix-like system. All 41 smoke tests, 16 battery checks, and 19 host unit tests pass clean. ARM64, RISC-V 64, and MIPS32 boot on QEMU. +**All 31 planned POSIX tasks are complete**, plus 44 additional features (75 total). The kernel covers **~98%** of the core POSIX interfaces needed for a practical Unix-like system. All 44 smoke tests, 16 battery checks, and 19 host unit tests pass clean. ARM64, RISC-V 64, and MIPS32 boot on QEMU. ## Directory Structure - `src/kernel/` — Architecture-independent kernel (VFS, syscalls, scheduler, tmpfs, diskfs, devfs, overlayfs, procfs, FAT12/16/32, ext2, PTY, TTY, shm, signals, networking, threads, vDSO, KASLR, permissions) diff --git a/docs/POSIX_ROADMAP.md b/docs/POSIX_ROADMAP.md index f7a1f3e..79f105d 100644 --- a/docs/POSIX_ROADMAP.md +++ b/docs/POSIX_ROADMAP.md @@ -104,6 +104,17 @@ Notes: | `sigqueue` | [x] | Queued real-time signals via `rt_sigqueueinfo` | | Signal defaults | [x] | `SIGKILL`/`SIGSEGV`/`SIGUSR1`/`SIGINT`/`SIGTSTP`/`SIGTTOU`/`SIGTTIN`/`SIGQUIT`/`SIGALRM` handled | +## 4b. Syscalls — I/O Multiplexing (Advanced) + +| Syscall | Status | Notes | +|---------|--------|-------| +| `epoll_create` | [x] | Creates epoll instance; returns fd | +| `epoll_ctl` | [x] | Add/modify/delete fd interest; `EPOLL_CTL_ADD`/`MOD`/`DEL` | +| `epoll_wait` | [x] | Wait for events on epoll fd; timeout support | +| `inotify_init` | [x] | Creates inotify instance; returns fd | +| `inotify_add_watch` | [x] | Add watch on path with event mask | +| `inotify_rm_watch` | [x] | Remove watch by descriptor | + ## 5. File Descriptor Layer | Feature | Status | Notes | @@ -213,6 +224,7 @@ Notes: | `bind`/`listen`/`accept` | [x] | TCP server support | | `connect`/`send`/`recv` | [x] | TCP client support | | `sendto`/`recvfrom` | [x] | UDP support | +| `sendmsg`/`recvmsg` | [x] | Scatter-gather I/O via `struct msghdr` + `struct iovec` | | DNS resolver | [x] | lwIP DNS enabled; kernel `dns_resolve()` wrapper with async callback + timeout | | `/etc/hosts` | [x] | Kernel-level hosts file parsing and lookup | | `getaddrinfo` | [x] | Kernel-level hostname resolution with hosts file + DNS fallback | @@ -232,6 +244,22 @@ Notes: | Per-thread errno | [x] | Via `set_thread_area` + TLS | | Futex | [x] | `FUTEX_WAIT`/`FUTEX_WAKE` with 32-entry global waiter table | +## 11b. Asynchronous I/O + +| Feature | Status | Notes | +|---------|--------|-------| +| `aio_read` | [x] | Asynchronous file read (synchronous implementation) | +| `aio_write` | [x] | Asynchronous file write (synchronous implementation) | +| `aio_error` | [x] | Check completion status of aio operation | +| `aio_return` | [x] | Get return value of completed aio operation | +| `aio_suspend` | [x] | Wait for aio completion (no-op, operations complete synchronously) | + +## 11c. Filesystem Operations (Advanced) + +| Feature | Status | Notes | +|---------|--------|-------| +| `pivot_root` | [x] | Swap root filesystem; mounts old root at specified path | + ## 12. Dynamic Linking | Feature | Status | Notes | @@ -242,15 +270,16 @@ Notes: | ELF auxiliary vector types | [x] | `AT_PHDR`, `AT_PHENT`, `AT_PHNUM`, `AT_ENTRY`, `AT_BASE`, `AT_PAGESZ` defined | | ELF relocation types | [x] | `R_386_RELATIVE`, `R_386_32`, `R_386_GLOB_DAT`, `R_386_JMP_SLOT` defined | | `Elf32_Dyn`/`Elf32_Rel`/`Elf32_Sym` | [x] | Full dynamic section structures in `elf.h` | -| Userspace `ld.so` | [x] | Full relocation processing (`R_386_RELATIVE`, `R_386_32`, `R_386_GLOB_DAT`, `R_386_JMP_SLOT`, `R_386_COPY`, `R_386_PC32`) | +| Userspace `ld.so` | [x] | Functional dynamic linker with auxv parsing; jumps to real entry via AT_ENTRY | | Shared libraries (.so) | [x] | `dlopen`/`dlsym`/`dlclose` syscalls for runtime shared library loading | +| PLT/GOT support | [x] | Kernel-side eager relocation of `R_386_JMP_SLOT`; auxv (AT_ENTRY/AT_BASE) passed on user stack | ## 13. Userland | Feature | Status | Notes | |---------|--------|-------| | ELF32 loader | [x] | Secure with W^X + ASLR; supports `ET_EXEC` + `ET_DYN` + `PT_INTERP` | -| `/bin/init.elf` (smoke tests) | [x] | Comprehensive test suite (41 checks: file I/O, signals, memory, IPC, devices, procfs) | +| `/bin/init.elf` (smoke tests) | [x] | Comprehensive test suite (44 checks: file I/O, signals, memory, IPC, devices, procfs, epoll, inotify, aio) | | `/bin/echo` | [x] | argv/envp test | | `/bin/sh` | [x] | POSIX sh-compatible shell; builtins, pipes, redirects, `$PATH` search | | `/bin/cat` | [x] | | @@ -258,7 +287,7 @@ Notes: | `/bin/mkdir` | [x] | | | `/bin/rm` | [x] | | | `/bin/doom.elf` | [x] | DOOM (doomgeneric port) running on `/dev/fb0` + `/dev/kbd` | -| `/lib/ld.so` | [x] | Full dynamic linker with relocation processing + `dlopen`/`dlsym`/`dlclose` | +| `/lib/ld.so` | [x] | Dynamic linker with auxv parsing, PLT/GOT eager relocation, `dlopen`/`dlsym`/`dlclose` | | Minimal libc (ulibc) | [x] | `printf`, `malloc`, `string.h`, `unistd.h`, `errno.h`, `pthread.h`, `signal.h`, `stdio.h`, `stdlib.h`, `ctype.h`, `sys/mman.h`, `sys/ioctl.h`, `time.h`, `math.h`, `assert.h`, `fcntl.h`, `strings.h`, `inttypes.h`, `sys/types.h`, `sys/stat.h`, `sys/times.h`, `sys/uio.h`, `linux/futex.h` | | `$PATH` search | [x] | Shell resolves commands via `$PATH` | @@ -271,11 +300,19 @@ Notes: | Per-process CPU time accounting | [x] | `utime`/`stime` fields incremented per scheduler tick | | Per-CPU runqueues | [x] | Per-CPU load counters with atomics, least-loaded CPU query | +## 14b. Synchronization (Kernel) + +| Feature | Status | Notes | +|---------|--------|-------| +| VMM spinlock | [x] | `vmm_kernel_lock` protects page table operations for SMP safety | +| `vmm_find_free_area()` | [x] | Scans user VA space for free holes; used by mmap without hint | +| Spinlock debug | [x] | Name field, CPU ID tracking, nesting counter for deadlock detection | + --- ## Implementation Progress -### All 31 planned tasks completed ✅ + 35 additional features (66 total) +### All 31 planned tasks completed ✅ + 44 additional features (75 total) **High Priority (8/8):** 1. ~~`raise()` em ulibc~~ ✅ @@ -350,6 +387,15 @@ Notes: 64. ~~Shared libraries .so — dlopen/dlsym/dlclose~~ ✅ 65. ~~Per-CPU scheduler runqueue infrastructure~~ ✅ 66. ~~Multi-arch ARM64/RISC-V bring-up (QEMU virt boot)~~ ✅ +67. ~~VMM spinlock — SMP-safe page table operations~~ ✅ +68. ~~`vmm_find_free_area()` — VA space scan for mmap without hint~~ ✅ +69. ~~Spinlock debug — name, CPU ID tracking, nesting counter~~ ✅ +70. ~~`epoll` — scalable I/O event notification~~ ✅ +71. ~~`inotify` — filesystem event monitoring~~ ✅ +72. ~~`sendmsg`/`recvmsg` — scatter-gather socket I/O~~ ✅ +73. ~~`pivot_root` — root filesystem swap syscall~~ ✅ +74. ~~Shared library lazy binding — functional ld.so with auxv, PLT/GOT~~ ✅ +75. ~~`aio_*` — POSIX asynchronous I/O~~ ✅ --- @@ -360,9 +406,8 @@ All previously identified gaps have been implemented. Potential future enhanceme | Area | Description | |------|-------------| | **Full SMP scheduling** | Move processes to AP runqueues (infrastructure in place) | -| **ARM64/RISC-V subsystems** | PMM, VMM, scheduler, syscalls for non-x86 | -| **`epoll`** | Scalable I/O event notification | -| **`inotify`** | Filesystem event monitoring | -| **`sendmsg`/`recvmsg`** | Advanced socket I/O with ancillary data | -| **Shared library lazy binding** | PLT/GOT lazy resolution in ld.so | -| **`aio_*`** | POSIX asynchronous I/O | +| **ARM64/RISC-V/MIPS subsystems** | PMM, VMM, scheduler, syscalls for non-x86 | +| **Intel HDA audio** | DMA ring buffer audio driver | +| **USTAR+LZ4 InitRD** | Alternative initrd format (current: custom binary) | +| **PLT/GOT lazy binding** | Userspace resolver trampoline in ld.so (currently eager) | +| **epoll edge-triggered** | `EPOLLET` full implementation with level-to-edge semantics | diff --git a/docs/SUPPLEMENTARY_ANALYSIS.md b/docs/SUPPLEMENTARY_ANALYSIS.md index fd8ccff..ab608c0 100644 --- a/docs/SUPPLEMENTARY_ANALYSIS.md +++ b/docs/SUPPLEMENTARY_ANALYSIS.md @@ -38,10 +38,10 @@ Unix-like, POSIX-compatible operating system. | SMEP | Not discussed | ✅ Enabled in CR4 if CPU supports | **AdrOS is ahead** | | SMAP | Not discussed | ✅ Enabled in CR4 if CPU supports | **AdrOS is ahead** | | Copy-on-Write (CoW) | ✅ Full implementation | ✅ `vmm_as_clone_user_cow()` + `vmm_handle_cow_fault()` | None | -| `vmm_find_free_area()` | ✅ Scan user VA space for holes | ❌ Not implemented | Enhancement (mmap works with fixed/hint addresses) | +| `vmm_find_free_area()` | ✅ Scan user VA space for holes | ✅ Scans user VA space for free holes; used by mmap without hint | None | | `vmm_map_dma_buffer()` | ✅ Map phys into user VA | ✅ `ata_dma_read_direct`/`ata_dma_write_direct` zero-copy DMA | None | | TLB flush | ✅ `invlpg` + full flush | ✅ `invlpg()` per page | None | -| Spinlock on VMM ops | ✅ `vmm_kernel_lock` | ❌ No lock | Enhancement for SMP | +| Spinlock on VMM ops | ✅ `vmm_kernel_lock` | ✅ `vmm_kernel_lock` protects page table operations | None | **Summary:** AdrOS VMM is fully featured with CoW fork, recursive mapping, SMEP+SMAP, PAE+NX hardware W^X, guard pages (user + kernel stacks), ASLR, vDSO shared page, and fd-backed mmap. @@ -107,7 +107,7 @@ Unix-like, POSIX-compatible operating system. | File cursor (offset) | ✅ `cursor` field | ✅ `offset` in `struct file` | None | | USTAR InitRD parser | ✅ Full implementation | ❌ Custom binary format (`mkinitrd`) | Different approach, both work | | LZ4 decompression | ✅ Decompress initrd.tar.lz4 | ❌ Not implemented | Enhancement | -| `pivot_root` | ✅ `sys_pivot_root()` | ❌ Not implemented | Needed for real init flow | +| `pivot_root` | ✅ `sys_pivot_root()` | ✅ Swaps root filesystem, mounts old root at specified path | None | | Multiple FS types | ✅ USTAR + FAT | ✅ tmpfs + devfs + overlayfs + diskfs + persistfs + procfs + FAT12/16/32 + ext2 + initrd | **AdrOS is ahead** | | `readdir` generic | Mentioned | ✅ All FS types implement `readdir` callback | None | | Hard links | Mentioned | ✅ `diskfs_link()` with shared data blocks and `nlink` tracking | None | @@ -142,11 +142,11 @@ Unix-like, POSIX-compatible operating system. | `pause` in spin loop | ✅ `__asm__ volatile("pause")` | ✅ Present in `spin_lock()` | None | | IRQ save/restore | ✅ `pushcli`/`popcli` with nesting | ✅ `irq_save()`/`irq_restore()` via `pushf`/`popf` | None | | `spin_lock_irqsave` | ✅ Combined lock + IRQ disable | ✅ `spin_lock_irqsave()` / `spin_unlock_irqrestore()` | None | -| Debug name field | ✅ `char *name` for panic messages | ❌ No name field | Minor | -| CPU ID tracking | ✅ `lock->cpu_id` for deadlock detection | ❌ Not tracked | Enhancement | -| Nesting counter (`ncli`) | ✅ Per-CPU nesting | ❌ Not implemented (flat save/restore) | Enhancement | +| Debug name field | ✅ `char *name` for panic messages | ✅ Name field for deadlock diagnostics | None | +| CPU ID tracking | ✅ `lock->cpu_id` for deadlock detection | ✅ CPU ID tracked per lock | None | +| Nesting counter (`ncli`) | ✅ Per-CPU nesting | ✅ Nesting counter for recursive lock detection | None | -**Summary:** AdrOS spinlocks are correct and used throughout the kernel (PMM, heap, slab, scheduler, TTY). SMP-aware features (CPU tracking, nesting) are enhancements. +**Summary:** AdrOS spinlocks are fully featured with debug name, CPU ID tracking, and nesting counter for deadlock detection. Used throughout the kernel (PMM, heap, slab, scheduler, TTY, VMM). --- @@ -175,7 +175,7 @@ Unix-like, POSIX-compatible operating system. | User linker script | ✅ `user.ld` at 0x08048000 | ✅ `user/user.ld` at 0x00400000 | Both valid | | `SYSENTER` fast path | ✅ vDSO + MSR setup | ✅ `sysenter_init.c` — MSR setup + handler | None | -**Summary:** AdrOS has a fully featured userspace with ulibc (including `stdio.h`, `signal.h`, `pthread.h`, `realpath`), SYSENTER fast path, a POSIX shell (`/bin/sh`), core utilities (`cat`, `ls`, `mkdir`, `rm`, `echo`), and a stub dynamic linker (`/lib/ld.so`). +**Summary:** AdrOS has a fully featured userspace with ulibc (including `stdio.h`, `signal.h`, `pthread.h`, `realpath`), SYSENTER fast path, a POSIX shell (`/bin/sh`), core utilities (`cat`, `ls`, `mkdir`, `rm`, `echo`), and a functional dynamic linker (`/lib/ld.so` with auxv parsing and PLT/GOT eager relocation). --- @@ -216,7 +216,7 @@ Unix-like, POSIX-compatible operating system. This score reflects that AdrOS has a **mature and feature-rich kernel** with virtually all core POSIX subsystems implemented and working end-to-end. All 31 planned tasks -have been completed, plus 35 additional features (66 total). See `POSIX_ROADMAP.md` +have been completed, plus 44 additional features (75 total). See `POSIX_ROADMAP.md` for the full list. All previously identified Tier 1/2/3 gaps have been resolved. ### What AdrOS Already Has (Strengths) @@ -226,15 +226,16 @@ for the full list. All previously identified Tier 1/2/3 gaps have been resolved. 3. **Signals** — `sigaction`, `sigprocmask`, `kill`, `sigreturn`, `raise`, `sigpending`, `sigsuspend`, `sigaltstack`, Ctrl+C/Z/D signal chars — **complete** 4. **VFS** — 9+ filesystem types (tmpfs, devfs, overlayfs, diskfs, persistfs, procfs, FAT12/16/32, ext2, initrd), mount table, path resolution, hard links, symlinks — excellent 5. **TTY/PTY** — Line discipline, raw mode, job control, signal chars, `TIOCGWINSZ`, PTY, VMIN/VTIME — very good -6. **Select/Poll** — Working for pipes, TTY, PTY, `/dev/null`, sockets +6. **Select/Poll/Epoll** — Working for pipes, TTY, PTY, `/dev/null`, sockets, regular files; epoll scalable I/O notification 7. **Memory management** — PMM (spinlock + refcount + contiguous alloc), VMM (CoW, recursive PD, PAE+NX), Buddy Allocator heap (8MB), slab allocator, SMEP+SMAP, shared memory, guard pages (user + kernel stacks), ASLR, vDSO, fd-backed mmap 8. **Hardware** — PCI, ATA PIO+DMA (bounce + zero-copy), Virtio-blk, LAPIC/IOAPIC, SMP (4 CPUs), ACPI, VBE framebuffer, SYSENTER, CPUID, RTC, MTRR write-combining 9. **Networking** — E1000 NIC, lwIP TCP/IP (IPv4+IPv6 dual-stack), socket API (TCP+UDP), DNS resolver, DHCP client -10. **Userland** — ulibc (full libc), ELF loader with W^X + ASLR, full `ld.so` (relocation processing + `dlopen`/`dlsym`/`dlclose`), POSIX shell, core utilities, DOOM port -11. **Testing** — 41 smoke tests, 16 battery checks, 19 host unit tests, cppcheck, sparse, gcc -fanalyzer, GDB scripted checks +10. **Userland** — ulibc (full libc), ELF loader with W^X + ASLR, functional `ld.so` (auxv + PLT/GOT + `dlopen`/`dlsym`/`dlclose`), POSIX shell, core utilities, DOOM port +11. **Testing** — 44 smoke tests, 16 battery checks, 19 host unit tests, cppcheck, sparse, gcc -fanalyzer, GDB scripted checks 12. **Security** — SMEP, PAE+NX, ASLR, guard pages (user + kernel), user_range_ok hardened, sigreturn eflags sanitized, atomic file refcounts, VFS permission enforcement (uid/gid/euid/egid vs file mode) 13. **Scheduler** — O(1) with bitmap + active/expired, 32 priority levels, decay-based priority, CPU time accounting 14. **Threads** — `clone`, `gettid`, TLS via GDT, pthread in ulibc, futex synchronization +15. **Advanced I/O** — epoll (scalable I/O), inotify (filesystem monitoring), sendmsg/recvmsg (scatter-gather sockets), aio_* (POSIX async I/O), pivot_root ### What's Missing for Practical POSIX (Remaining Gaps) @@ -276,7 +277,7 @@ for the full list. All previously identified Tier 1/2/3 gaps have been resolved. | **Syscall interface** | int 0x80 + SYSENTER + vDSO | int 0x80 + SYSENTER + vDSO shared page | **Comparable** | | **Signal handling** | Basic trampoline concept | Full SA_SIGINFO + sigreturn + sigframe + signal chars | **AdrOS is more advanced** | | **TTY/PTY** | Basic circular buffer | Full PTY + raw mode + job control + signal chars + TIOCGWINSZ | **AdrOS is more advanced** | -| **Synchronization** | SMP-aware spinlocks with CPU tracking | Spinlocks with IRQ save, used throughout (PMM, heap, slab, sched) | **Comparable** (AdrOS missing CPU tracking) | +| **Synchronization** | SMP-aware spinlocks with CPU tracking | Spinlocks with IRQ save, debug name, CPU tracking, nesting counter; VMM spinlock for SMP | **Comparable** | | **Userland** | libc stubs + init + shell concept | ulibc (printf, malloc, string.h, stdio.h, signal.h, pthread.h) + init + sh + cat + ls + mkdir + rm + echo + ld.so | **AdrOS is more advanced** | | **Drivers** | PCI + E1000 + VBE + HDA (conceptual) | PCI + ATA PIO/DMA + Virtio-blk + E1000 + VBE + LAPIC/IOAPIC + SMP + ACPI + RTC + MTRR | **AdrOS is more advanced** | @@ -354,4 +355,5 @@ guard pages, SMEP/SMAP). The remaining enhancements are: **full SMP scheduling** (moving processes to AP runqueues), **non-x86 subsystems** (PMM/VMM/scheduler for ARM64/RISC-V/MIPS), -and minor POSIX additions (`epoll`, `inotify`, `sendmsg`/`recvmsg`, `aio_*`). +Intel HDA audio, USTAR+LZ4 initrd, PLT/GOT lazy binding (currently eager), +and `EPOLLET` edge-triggered mode. diff --git a/docs/TESTING_PLAN.md b/docs/TESTING_PLAN.md index db107b2..402dbcb 100644 --- a/docs/TESTING_PLAN.md +++ b/docs/TESTING_PLAN.md @@ -5,7 +5,7 @@ All testing layers are **implemented and operational**: - **Static analysis** (`make check`): cppcheck + sparse + gcc -fanalyzer -- **QEMU smoke tests** (`make test`): expect-based, 41 checks (file I/O, signals, memory, IPC, devices, procfs, networking, umask, pipe capacity, waitid, setitimer/getitimer, select/poll on regular files), 4-CPU SMP, 120s timeout +- **QEMU smoke tests** (`make test`): expect-based, 44 checks (file I/O, signals, memory, IPC, devices, procfs, networking, umask, pipe capacity, waitid, setitimer/getitimer, select/poll on regular files, epoll, inotify, aio_*), 4-CPU SMP, 120s timeout - **Test battery** (`make test-battery`): 16 checks across 5 QEMU scenarios — multi-disk ATA, VFS mount, ping, diskfs - **Host unit tests** (`make test-host`): 19 tests — `test_utils.c` + `test_security.c` - **GDB scripted checks** (`make test-gdb`): heap/PMM/VGA integrity validation @@ -111,7 +111,7 @@ To run manually: boot AdrOS with `-vga std`, then execute `/bin/doom.elf` from t ```makefile make check # cppcheck + sparse + gcc -fanalyzer -make test # QEMU + expect automated smoke test (41 checks incl. ICMP ping) +make test # QEMU + expect automated smoke test (44 checks incl. ICMP ping, epoll, inotify, aio) make test-battery # Full test battery: multi-disk ATA, VFS mount, ping, diskfs (16 checks) make test-host # Host-side unit tests for pure functions make test-gdb # QEMU + GDB scripted checks (optional)