Skip to content

Fix sandbox on AArch64, RISC-V

Simon South requested to merge ssouth/tor:sandbox-aarch64-riscv-fixes into main

Extend the sandbox implementation to support AArch64 (ARM64) and RISC-V machines. Allows the script and sandbox unit tests to complete without issue on these systems, fixing #24454 (closed) and another part of #40465 (closed).

Note these commits depend on and include jigsaw52's fix from merge request !433 (merged), which should be applied first.

These changes extend the sandbox to support architectures on which Linux provides its newer, more standardized, "generic" syscall interface, which omits a number of legacy calls and is generally less affected by issues related to backwards compatibility with 32-bit machines. These architectures also share a common implementation within glibc, making it easy for the sandbox to target all of them simultaneously.

For these architectures, which presently include AArch64 and 64-bit RISC-V, the changes

  • Allow negative syscall parameter values to be passed without modification (where 64-bit long integers are used), as syscall parameters on these systems are uniform in length;

  • Replace legacy syscalls with their standardized equivalents to match glibc; and

  • Update the code specific to accommodating fragile hardening to match differences in AddressSanitizer's implementation on these systems.

I expect these commits will need to be squashed down before merging but have left them separate for easier review.

I've tested this with make check on x86-64 (real), AArch64 (real) and RISC-V (virtual) machines and everything appears to work fine.

Merge request reports