• Dave Martin's avatar
    arm64/sve: Disentangle <uapi/asm/ptrace.h> from <uapi/asm/sigcontext.h> · 9966a05c
    Dave Martin authored
    Currently, <uapi/asm/sigcontext.h> provides common definitions for
    describing SVE context structures that are also used by the ptrace
    definitions in <uapi/asm/ptrace.h>.
    
    For this reason, a #include of <asm/sigcontext.h> was added in
    ptrace.h, but it this turns out that this can interact badly with
    userspace code that tries to include ptrace.h on top of the libc
    headers (which may provide their own shadow definitions for
    sigcontext.h).
    
    To make the headers easier for userspace to consume, this patch
    bounces the common definitions into an __SVE_* namespace and moves
    them to a backend header <uapi/asm/sve_context.h> that can be
    included by the other headers as appropriate.  This should allow
    ptrace.h to be used alongside libc's sigcontext.h (if any) without
    ill effects.
    
    This should make the situation unambiguous: <asm/sigcontext.h> is
    the header to include for the sigframe-specific definitions, while
    <asm/ptrace.h> is the header to include for ptrace-specific
    definitions.
    
    To avoid conflicting with existing usage, <asm/sigcontext.h>
    remains the canonical way to get the common definitions for
    SVE_VQ_MIN, sve_vq_from_vl() etc., both in userspace and in the
    kernel: relying on these being defined as a side effect of
    including just <asm/ptrace.h> was never intended to be safe.
    Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    9966a05c
ptrace.h 6.46 KB