Skip to content

Conversation

@ryanbreen
Copy link
Owner

Summary

  • Add load_elf_from_ext2() helper function that loads ELF binaries from the ext2 filesystem with proper permission checks
  • Modify sys_execv_with_frame() to try ext2 filesystem first, with test disk fallback for backward compatibility

Changes

New helper function load_elf_from_ext2():

  • Resolves path to inode using ext2 driver
  • Validates file is not a directory (returns ENOTDIR)
  • Checks execute permission bit S_IXUSR (returns EACCES if not set)
  • Returns file content as Vec

Modified exec syscall behavior:

  • For paths containing / (e.g., /bin/ls): load directly from ext2 filesystem
  • For bare names (e.g., ls): try /bin/<name> on ext2 first, fall back to test disk

Test plan

  • Build completes with zero warnings
  • All 210 boot stages pass (backward compatibility verified)
  • Manual test with binaries installed to ext2 /bin directory (requires ext2 tools)

Next steps (Phase 2b)

  • Update xtask to install compiled binaries to ext2 image during build
  • Add automated test that verifies loading from ext2

🤖 Generated with Claude Code

Add load_elf_from_ext2() helper function that loads ELF binaries from
the ext2 filesystem with proper permission checks:
- Resolves path to inode using ext2 driver
- Validates file is not a directory (ENOTDIR)
- Checks execute permission bit S_IXUSR (EACCES)
- Returns file content as Vec<u8>

Modify sys_execv_with_frame() to try ext2 filesystem first:
- For paths containing '/': load directly from ext2
- For bare names: try /bin/<name> on ext2, fall back to test disk

This enables exec("/bin/ls", argv) to load programs from the ext2
filesystem, preparing for full Unix-like program execution. The
test disk fallback ensures backward compatibility during transition.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cursor
Copy link

cursor bot commented Jan 13, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 12.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants