[Bug 273929] AArch64 machine-dependent code clobbers X0 in SIGTRAP from capsicum violations

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 18 Sep 2023 17:37:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273929

--- Comment #2 from David Chisnall <theraven@FreeBSD.org> ---
(In reply to Kyle Evans from comment #1)

I don't have a *minimal* reproducer, but I've been porting the Verona sandbox
code to AArch64:

https://github.com/microsoft/verona-sandbox/pull/2

This works fine on FreeBSD/amd64, but on AArch64 the argument is clobbered.  I
believe x86-64 clobbers the system call register, which is why we put preserve
that in si_syscall in the signal.  AArch64 puts the syscall number in x8, which
is not clobbered.

I could work around this if the original x0 register were either provided in
the siginfo or if it were provided in another caller-save register.  The
ECAPMODE value needs to be provided after sigreturn, I presume it's not
possible to insert it there?  

Copying x0 over x9 in the syscall enter routine would be fine, I think.

-- 
You are receiving this mail because:
You are the assignee for the bug.