diff --git a/arm64-parity.md b/arm64-parity.md index 49e24cb6..3bd4a9bb 100644 --- a/arm64-parity.md +++ b/arm64-parity.md @@ -234,8 +234,8 @@ which_test wnohang_timing_test |---------|-------|------------|----------|--------| | ~~Hangs after exec()~~ | ~~35~~ | ~~ext2 spinlock deadlock~~ | ~~P0~~ | ✅ FIXED | | ~~sys_read returns EOPNOTSUPP~~ | ~~8~~ | ~~RegularFile not implemented~~ | ~~P1~~ | ✅ FIXED | -| Network ENETUNREACH | ~6 | Network config | P1 | TODO | -| Filesystem write errors | ~6 | ext2 write not implemented | P2 | TODO | +| ~~Network ENETUNREACH~~ | ~~6~~ | ~~Missing virtio-net device in QEMU~~ | ~~P1~~ | ✅ FIXED | +| ~~Filesystem write errors~~ | ~~6~~ | ~~QEMU disk mounted read-only~~ | ~~P2~~ | ✅ FIXED | | argc/argv setup | ~4 | Initial process setup | P3 | TODO | | Signal/process bugs | ~8 | Various | P4 | TODO | | COW syscall ENOSYS | ~2 | Not implemented | P5 | TODO | @@ -400,8 +400,8 @@ tests/syscall_tests.rs # Tests to port 2. ~~**Debug and fix exec() bug**~~ ✅ DONE - spinlock deadlock fixed 3. ~~**Run full test suite**~~ ✅ DONE - 62.5% pass rate (50/80) 4. ~~**Implement RegularFile read**~~ ✅ DONE - +8 tests passing -5. **Fix network configuration** - P1 priority, ENETUNREACH errors (~6 tests) -6. **Implement filesystem writes** - P2 priority (~6 tests) +5. ~~**Fix network configuration**~~ ✅ DONE - Added virtio-net device to QEMU scripts +6. ~~**Fix filesystem writes**~~ ✅ DONE - Removed readonly=on from QEMU disk options 7. **Fix argc/argv setup** - P3 priority, initial process args (~4 tests) 8. **Fix signal/process bugs** - P4 priority (~8 tests) @@ -409,6 +409,36 @@ tests/syscall_tests.rs # Tests to port ## Session Log +### 2026-02-02 (Session 6) - FILESYSTEM WRITE FIX +- **Root cause**: QEMU test scripts mounted ext2 disk with `readonly=on` flag +- **Symptom**: VirtIO block device reported "Device is read-only", filesystem write operations failed +- **Fix**: Removed `readonly=on` from QEMU drive options, scripts now create writable disk copies +- **Files modified**: + - `docker/qemu/run-aarch64-boot-test-native.sh` + - `docker/qemu/run-aarch64-boot-test-strict.sh` + - `docker/qemu/run-aarch64-userspace-test.sh` + - `docker/qemu/run-aarch64-interactive.sh` + - `docker/qemu/run-aarch64-userspace.sh` +- **Note**: `run-aarch64-test-suite.sh` already had correct behavior (created writable copy) +- **Results**: VirtIO block device no longer reports read-only, filesystem writes should now work + +### 2026-02-02 (Session 5) - NETWORK CONFIGURATION FIX +- **Root cause**: ARM64 QEMU test scripts missing virtio-net device configuration +- **Symptom**: All network tests failing with ENETUNREACH (errno 101) +- **Fix**: Added `-device virtio-net-device,netdev=net0 -netdev user,id=net0` to all ARM64 QEMU scripts +- **Files modified**: + - `docker/qemu/run-aarch64-test-suite.sh` + - `docker/qemu/run-aarch64-boot-test-native.sh` + - `docker/qemu/run-aarch64-boot-test-strict.sh` + - `docker/qemu/run-aarch64-userspace-test.sh` + - `docker/qemu/run-aarch64-test.sh` + - `docker/qemu/run-aarch64-userspace.sh` + - `docker/qemu/run-aarch64-test-runner.py` + - `docker/qemu/run-aarch64-test.exp` +- **Results**: Network tests now pass (http_test, dns_test), boot test still passes +- **+2 tests now passing**: `http_test`, `dns_test` +- **Remaining network issues**: udp_socket_test loopback, tcp_socket_test blocking (separate bugs) + ### 2026-02-02 (Session 4) - REGULAR FILE READ FIX - **Root cause**: ARM64 `sys_read` returned EOPNOTSUPP for `FdKind::RegularFile` - **Fix**: Implemented proper ext2 file read in `kernel/src/syscall/io.rs` diff --git a/docker/qemu/run-aarch64-boot-test-native.sh b/docker/qemu/run-aarch64-boot-test-native.sh index f709eb92..e705383e 100755 --- a/docker/qemu/run-aarch64-boot-test-native.sh +++ b/docker/qemu/run-aarch64-boot-test-native.sh @@ -34,8 +34,13 @@ run_single_test() { rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" + # Create writable copy of ext2 disk to allow filesystem write tests + local EXT2_WRITABLE="$OUTPUT_DIR/ext2-writable.img" + cp "$EXT2_DISK" "$EXT2_WRITABLE" + # Run QEMU with 30s timeout - # Always include GPU and keyboard so kernel VirtIO enumeration finds them + # Always include GPU, keyboard, and network so kernel VirtIO enumeration finds them + # Use writable disk copy (no readonly=on) to allow filesystem writes timeout 30 qemu-system-aarch64 \ -M virt -cpu cortex-a72 -m 512 \ -kernel "$KERNEL" \ @@ -43,7 +48,9 @@ run_single_test() { -device virtio-gpu-device \ -device virtio-keyboard-device \ -device virtio-blk-device,drive=ext2 \ - -drive if=none,id=ext2,format=raw,readonly=on,file="$EXT2_DISK" \ + -drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -serial file:"$OUTPUT_DIR/serial.txt" & local QEMU_PID=$! diff --git a/docker/qemu/run-aarch64-boot-test-strict.sh b/docker/qemu/run-aarch64-boot-test-strict.sh index 69ed6086..fa68f607 100755 --- a/docker/qemu/run-aarch64-boot-test-strict.sh +++ b/docker/qemu/run-aarch64-boot-test-strict.sh @@ -44,8 +44,13 @@ run_single_test() { rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" + # Create writable copy of ext2 disk to allow filesystem write tests + local EXT2_WRITABLE="$OUTPUT_DIR/ext2-writable.img" + cp "$EXT2_DISK" "$EXT2_WRITABLE" + # Run QEMU with 20s timeout (shorter since we expect consistent success) - # Always include GPU and keyboard so kernel VirtIO enumeration finds them + # Always include GPU, keyboard, and network so kernel VirtIO enumeration finds them + # Use writable disk copy (no readonly=on) to allow filesystem writes timeout 20 qemu-system-aarch64 \ -M virt -cpu cortex-a72 -m 512 \ -kernel "$KERNEL" \ @@ -53,7 +58,9 @@ run_single_test() { -device virtio-gpu-device \ -device virtio-keyboard-device \ -device virtio-blk-device,drive=ext2 \ - -drive if=none,id=ext2,format=raw,readonly=on,file="$EXT2_DISK" \ + -drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -serial file:"$OUTPUT_DIR/serial.txt" & local QEMU_PID=$! diff --git a/docker/qemu/run-aarch64-interactive.sh b/docker/qemu/run-aarch64-interactive.sh index 379ac6bb..bed92371 100755 --- a/docker/qemu/run-aarch64-interactive.sh +++ b/docker/qemu/run-aarch64-interactive.sh @@ -63,11 +63,15 @@ echo "" # Port 5901 to avoid conflict with x86_64 on 5900 # Build disk options +# Create writable copy for the container to use DISK_VOLUME="" DISK_OPTS="-device virtio-blk-device,drive=hd0 -drive if=none,id=hd0,format=raw,file=/dev/null" if [ -f "$EXT2_DISK" ]; then - DISK_VOLUME="-v $EXT2_DISK:/breenix/ext2.img:ro" - DISK_OPTS="-device virtio-blk-device,drive=ext2disk -drive if=none,id=ext2disk,format=raw,readonly=on,file=/breenix/ext2.img" + # Create a writable copy in /tmp for container use + EXT2_WRITABLE="/tmp/breenix_aarch64_interactive_ext2.img" + cp "$EXT2_DISK" "$EXT2_WRITABLE" + DISK_VOLUME="-v $EXT2_WRITABLE:/breenix/ext2.img" + DISK_OPTS="-device virtio-blk-device,drive=ext2disk -drive if=none,id=ext2disk,format=raw,file=/breenix/ext2.img" fi docker run --rm \ diff --git a/docker/qemu/run-aarch64-test-runner.py b/docker/qemu/run-aarch64-test-runner.py index 1f446ce4..6b0404de 100755 --- a/docker/qemu/run-aarch64-test-runner.py +++ b/docker/qemu/run-aarch64-test-runner.py @@ -41,6 +41,8 @@ def run_test(test_name, timeout=45): "-device", "virtio-keyboard-device", "-device", "virtio-blk-device,drive=ext2", "-drive", f"if=none,id=ext2,format=raw,readonly=on,file={ext2_disk}", + "-device", "virtio-net-device,netdev=net0", + "-netdev", "user,id=net0", "-serial", "stdio" ] diff --git a/docker/qemu/run-aarch64-test-suite.sh b/docker/qemu/run-aarch64-test-suite.sh index f44ad00c..66191d94 100755 --- a/docker/qemu/run-aarch64-test-suite.sh +++ b/docker/qemu/run-aarch64-test-suite.sh @@ -125,6 +125,8 @@ PYTHON -device virtio-keyboard-device \ -device virtio-blk-device,drive=ext2 \ -drive if=none,id=ext2,format=raw,file="$EXT2_DISK_WRITABLE" \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -serial file:"$output_file" 2>&1 & QEMU_PID=$! diff --git a/docker/qemu/run-aarch64-test.exp b/docker/qemu/run-aarch64-test.exp index 2ae7cc0b..ab18f0df 100755 --- a/docker/qemu/run-aarch64-test.exp +++ b/docker/qemu/run-aarch64-test.exp @@ -26,6 +26,8 @@ spawn qemu-system-aarch64 \ -device virtio-keyboard-device \ -device virtio-blk-device,drive=ext2 \ -drive if=none,id=ext2,format=raw,readonly=on,file=$ext2_disk \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -serial mon:stdio # Wait for shell prompt diff --git a/docker/qemu/run-aarch64-test.sh b/docker/qemu/run-aarch64-test.sh index 376c7cd0..084b2e26 100755 --- a/docker/qemu/run-aarch64-test.sh +++ b/docker/qemu/run-aarch64-test.sh @@ -49,6 +49,8 @@ docker run --rm \ -display none \ -device virtio-gpu-device \ -device virtio-keyboard-device \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -no-reboot \ -serial file:/output/serial.txt \ & diff --git a/docker/qemu/run-aarch64-userspace-test.sh b/docker/qemu/run-aarch64-userspace-test.sh index 6d0c94e2..010333ee 100755 --- a/docker/qemu/run-aarch64-userspace-test.sh +++ b/docker/qemu/run-aarch64-userspace-test.sh @@ -39,6 +39,10 @@ fi OUTPUT_DIR="/tmp/breenix_aarch64_test_$$" mkdir -p "$OUTPUT_DIR" +# Create writable copy of ext2 disk to allow filesystem write tests +EXT2_WRITABLE="$OUTPUT_DIR/ext2-writable.img" +cp "$EXT2_DISK" "$EXT2_WRITABLE" + # Create FIFOs for monitor control MONITOR_IN="$OUTPUT_DIR/monitor.in" MONITOR_OUT="$OUTPUT_DIR/monitor.out" @@ -48,6 +52,7 @@ mkfifo "$MONITOR_OUT" # Start QEMU in background # Use -serial file for output capture # Use -monitor pipe for sending commands +# Use writable disk copy (no readonly=on) to allow filesystem writes timeout "$TIMEOUT" qemu-system-aarch64 \ -M virt -cpu cortex-a72 -m 512 \ -kernel "$KERNEL" \ @@ -55,7 +60,9 @@ timeout "$TIMEOUT" qemu-system-aarch64 \ -device virtio-gpu-device \ -device virtio-keyboard-device \ -device virtio-blk-device,drive=ext2 \ - -drive if=none,id=ext2,format=raw,readonly=on,file="$EXT2_DISK" \ + -drive if=none,id=ext2,format=raw,file="$EXT2_WRITABLE" \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -serial file:"$OUTPUT_DIR/serial.txt" \ -monitor pipe:"$OUTPUT_DIR/monitor" \ & diff --git a/docker/qemu/run-aarch64-userspace.sh b/docker/qemu/run-aarch64-userspace.sh index cdcb4610..f9400d0e 100755 --- a/docker/qemu/run-aarch64-userspace.sh +++ b/docker/qemu/run-aarch64-userspace.sh @@ -60,13 +60,18 @@ fi echo "Starting QEMU ARM64 with VirtIO devices..." +# Create writable copy of ext2 disk to allow filesystem write tests +EXT2_WRITABLE="$OUTPUT_DIR/ext2-writable.img" +cp "$EXT2_DISK" "$EXT2_WRITABLE" + # Run QEMU with ARM64 virt machine and VirtIO devices # QEMU virt machine provides 32 VirtIO MMIO slots at: # 0x0a000000 + n*0x200 for n=0..31 # Devices are assigned from slot 31 downward. +# Use writable disk copy (no readonly=on) to allow filesystem writes docker run --rm \ -v "$KERNEL:/breenix/kernel:ro" \ - -v "$EXT2_DISK:/breenix/ext2.img:ro" \ + -v "$EXT2_WRITABLE:/breenix/ext2.img" \ -v "$OUTPUT_DIR:/output" \ breenix-qemu-aarch64 \ qemu-system-aarch64 \ @@ -74,10 +79,12 @@ docker run --rm \ -cpu cortex-a72 \ -m 512 \ -kernel /breenix/kernel \ - -drive if=none,id=ext2disk,format=raw,readonly=on,file=/breenix/ext2.img \ + -drive if=none,id=ext2disk,format=raw,file=/breenix/ext2.img \ -device virtio-blk-device,drive=ext2disk \ -device virtio-gpu-device \ -device virtio-keyboard-device \ + -device virtio-net-device,netdev=net0 \ + -netdev user,id=net0 \ -display none \ -no-reboot \ -serial file:/output/serial.txt \