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

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

            Bug ID: 273929
           Summary: AArch64 machine-dependent code clobbers X0 in SIGTRAP
                    from capsicum violations
           Product: Base System
           Version: CURRENT
          Hardware: arm64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: theraven@FreeBSD.org

X0 is used as both the first argument register and as the return value.  If
SIGTRAP is delivered to a process for a Capsicum violation, the mcontext_t in
the signal should contain the arguments so that software can trap and emulate
the system calls.  This works on x86[-64] but on AArch64 X0 is overwritten
before the system call handler is entered.  When emulating `open`, for example,
the signal frame always sees the path as `(char*)94`, which makes this
impossible.

It would be nice if this could be fixed before 14.0 or be subject to an EN
afterwards, since it makes capsicum trap-and-emulate behaviour unusable
currently.

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