From 1f2e910d96d24ded30d7a58f0bb7e2ed02bc62f0 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 10:00:50 -0400 Subject: [PATCH 1/7] Fix GitHub Actions workflow - upgrade upload-artifact to v4 --- .github/workflows/ring3-enosys.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index 22b4f38..c3a8a02 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -68,7 +68,7 @@ jobs: - name: Upload test artifacts if: always() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: enosys-test-output-${{ github.run_number }} path: | From 212d41a8e37d12328c834e63f88c6ba6f394a055 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 13:16:21 -0400 Subject: [PATCH 2/7] Fix GitHub Actions workflow: Add NASM installation step The workflow was failing with 'Failed to run nasm: No such file or directory' because nasm wasn't installed on the GitHub Actions runner. Added the ilammy/setup-nasm@v1 action to install NASM before building the kernel. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index c3a8a02..a1c91fc 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -27,6 +27,9 @@ jobs: with: components: rust-src, llvm-tools-preview + - name: Install NASM + uses: ilammy/setup-nasm@v1 + - name: Install QEMU run: | sudo apt-get update From 42d08a3090bf537c9ea7a1c6e149e1abbd46a520 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 13:23:01 -0400 Subject: [PATCH 3/7] Fix workflow: Build all userspace tests before kernel The kernel build was failing because it requires all userspace test ELF files to be present. Changed workflow to run build_all.sh which builds all required userspace test binaries. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index a1c91fc..61614be 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -38,8 +38,8 @@ jobs: - name: Build userspace tests run: | cd userspace/tests - cargo build --release --target=x86_64-unknown-none --bin syscall_enosys || true - # Allow failure since userspace/ may not exist yet + # Build all userspace test binaries required by the kernel + ./build_all.sh || echo "Warning: Some userspace tests failed to build" - name: Build kernel with test features run: cargo build --all --release --features "testing,external_test_bins" From ffd355d7dde899814e20396ab4fa7e8be899867d Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 13:41:52 -0400 Subject: [PATCH 4/7] Fix workflow: Use correct build.sh script and target specific package Fixed two critical issues: 1. Changed build_all.sh to build.sh (the actual script that exists) 2. Changed 'cargo build --all' to 'cargo build --package kernel' to avoid building host-side tools which was causing std library conflicts with the no_std kernel This should resolve the duplicate lang item panic_impl error and properly build just the kernel package. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index 61614be..0573e15 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -39,10 +39,10 @@ jobs: run: | cd userspace/tests # Build all userspace test binaries required by the kernel - ./build_all.sh || echo "Warning: Some userspace tests failed to build" + ./build.sh || echo "Warning: Some userspace tests failed to build" - name: Build kernel with test features - run: cargo build --all --release --features "testing,external_test_bins" + run: cargo build --package kernel --release --features "testing,external_test_bins" - name: Run ENOSYS integration test run: | From f54a4d3c1fb3e5cf6b554a762cf3ddbf5d2ec376 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 13:46:28 -0400 Subject: [PATCH 5/7] Add rust-objcopy installation to workflow The userspace build script requires rust-objcopy to convert ELF files to flat binaries. Added step to install cargo-binutils and ensure rust-objcopy is available in PATH. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index 0573e15..384d58a 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -29,6 +29,16 @@ jobs: - name: Install NASM uses: ilammy/setup-nasm@v1 + + - name: Install rust-objcopy + run: | + # Install llvm-tools-preview which includes rust-objcopy + rustup component add llvm-tools-preview + # Add cargo binutils for easier access to rust-objcopy + cargo install cargo-binutils || true + # Ensure rust-objcopy is in PATH + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "$(rustc --print sysroot)/lib/rustlib/$(rustc -vV | sed -n 's|host: ||p')/bin" >> $GITHUB_PATH - name: Install QEMU run: | From 751707b146dced4ca55af8660a36a2762ee8caac Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 13:55:29 -0400 Subject: [PATCH 6/7] Fix kernel build: Add target specification for cross-compilation The kernel was failing to build because it was trying to compile for the host (Linux) target instead of the bare metal x86_64-unknown-none target. Added rustup target add and --target flag to cargo build command. This fixes errors like 'could not find x86_64 in arch' and 'unknown register' which occur when trying to compile x86 assembly for the wrong target. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index 384d58a..28d47d1 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -52,7 +52,9 @@ jobs: ./build.sh || echo "Warning: Some userspace tests failed to build" - name: Build kernel with test features - run: cargo build --package kernel --release --features "testing,external_test_bins" + run: | + rustup target add x86_64-unknown-none + cargo build --package kernel --target x86_64-unknown-none --release --features "testing,external_test_bins" - name: Run ENOSYS integration test run: | From c1639c4006d8322eeace101cfdbd59aba0d96da0 Mon Sep 17 00:00:00 2001 From: Ryan Breen Date: Wed, 10 Sep 2025 14:02:12 -0400 Subject: [PATCH 7/7] Simplify ENOSYS workflow to match ring3-smoke pattern Following the existing ring3-smoke.yml pattern exactly instead of overcomplicating things. The workflow now: 1. Installs same toolchain and dependencies as ring3-smoke 2. Builds userspace tests with proper PATH for rust-objcopy 3. Runs the xtask command to boot kernel and test ENOSYS This matches the proven pattern that works for ring3-smoke test. Co-authored-by: Ryan Breen Co-authored-by: Claude --- .github/workflows/ring3-enosys.yml | 101 +++++++++-------------------- 1 file changed, 32 insertions(+), 69 deletions(-) diff --git a/.github/workflows/ring3-enosys.yml b/.github/workflows/ring3-enosys.yml index 28d47d1..9110aae 100644 --- a/.github/workflows/ring3-enosys.yml +++ b/.github/workflows/ring3-enosys.yml @@ -1,93 +1,56 @@ name: Ring-3 ENOSYS Test on: - pull_request: - paths: - - 'kernel/**' - - 'userspace/**' - - 'tests/**' - - 'xtask/**' - - '.github/workflows/ring3-enosys.yml' push: - branches: [ main ] - workflow_dispatch: + branches: [ "**" ] + pull_request: jobs: ring3-enosys: - name: Test ENOSYS syscall handling runs-on: ubuntu-latest - timeout-minutes: 15 - + timeout-minutes: 20 + + env: + CARGO_UNSTABLE_BINDEPS: true + steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 - - name: Install Rust nightly toolchain - uses: dtolnay/rust-toolchain@nightly + - name: Install Rust + uses: actions-rs/toolchain@v1 with: + toolchain: nightly-2025-06-24 + override: true + target: x86_64-unknown-none components: rust-src, llvm-tools-preview - - name: Install NASM - uses: ilammy/setup-nasm@v1 - - - name: Install rust-objcopy - run: | - # Install llvm-tools-preview which includes rust-objcopy - rustup component add llvm-tools-preview - # Add cargo binutils for easier access to rust-objcopy - cargo install cargo-binutils || true - # Ensure rust-objcopy is in PATH - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - echo "$(rustc --print sysroot)/lib/rustlib/$(rustc -vV | sed -n 's|host: ||p')/bin" >> $GITHUB_PATH - - - name: Install QEMU + - name: Install build dependencies run: | sudo apt-get update - sudo apt-get install -y qemu-system-x86 qemu-utils + sudo apt-get install -y qemu-system-x86 ovmf nasm + + - name: Cache cargo registry + build + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build userspace tests run: | + # Add LLVM tools to PATH + export PATH="$PATH:$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin" cd userspace/tests - # Build all userspace test binaries required by the kernel - ./build.sh || echo "Warning: Some userspace tests failed to build" + ./build.sh - - name: Build kernel with test features - run: | - rustup target add x86_64-unknown-none - cargo build --package kernel --target x86_64-unknown-none --release --features "testing,external_test_bins" - - - name: Run ENOSYS integration test - run: | - cargo test --test ring3_enosys_test --release - echo "Integration test completed" - - - name: Build and run xtask ENOSYS test - run: | - cd xtask - cargo build --release - timeout 60 cargo run --release -- ring3-enosys || true - # Allow failure but capture output - - - name: Check for test evidence in logs - if: always() - run: | - echo "=== Checking for ENOSYS test evidence ===" - if [ -f target/xtask_ring3_enosys_output.txt ]; then - echo "Found xtask output file" - grep -E "ENOSYS|Invalid syscall|999" target/xtask_ring3_enosys_output.txt || echo "No ENOSYS markers found" - fi - if [ -d logs ]; then - echo "Found logs directory" - grep -E "ENOSYS|Invalid syscall|999" logs/*.log 2>/dev/null | head -20 || echo "No ENOSYS markers in logs" - fi + - name: Run Ring-3 ENOSYS test + run: cargo run -p xtask -- ring3-enosys - - name: Upload test artifacts - if: always() + - name: Upload QEMU log if failure + if: failure() uses: actions/upload-artifact@v4 with: - name: enosys-test-output-${{ github.run_number }} - path: | - target/xtask_ring3_enosys_output.txt - target/shared_kernel_test_output.txt - logs/*.log - if-no-files-found: warn \ No newline at end of file + name: qemu-serial-log + path: target/xtask_ring3_enosys_output.txt \ No newline at end of file