fwsGonzo / libriscv

The fastest RISC-V sandbox
BSD 3-Clause "New" or "Revised" License
522 stars 46 forks source link

Zig's ELF writer puts executable data outside of .text #171

Open fwsGonzo opened 1 week ago

fwsGonzo commented 1 week ago

This is a problem because the .text section can be used to find the correct alignment of instructions, which is a necessary check for proper sandboxing. I could not find a way to support both .text and ignore-.text at the same time, so I added a new option to MachineOptions called ignore_text_section.

The emulator can now run these Zig programs using the -I or --ignore-text argument. I will still file it as a bug as perhaps there is a way without needing an option.

fwsGonzo commented 1 week ago

The work-around is implemented here: https://github.com/fwsGonzo/libriscv/pull/172