[PATCH v16 6/6] arm64: expose FAR_EL1 tag bits in siginfo

Dave Martin Dave.Martin at arm.com
Mon Nov 16 08:36:01 EST 2020


On Sun, Nov 15, 2020 at 08:08:36AM -0600, Eric W. Biederman wrote:
> Peter Collingbourne <pcc at google.com> writes:
> 
> > The kernel currently clears the tag bits (i.e. bits 56-63) in the fault
> > address exposed via siginfo.si_addr and sigcontext.fault_address. However,
> > the tag bits may be needed by tools in order to accurately diagnose
> > memory errors, such as HWASan [1] or future tools based on the Memory
> > Tagging Extension (MTE).
> >
> > We should not stop clearing these bits in the existing fault address
> > fields, because there may be existing userspace applications that are
> > expecting the tag bits to be cleared. Instead, introduce a flag in
> > sigaction.sa_flags, SA_EXPOSE_TAGBITS, and only expose the tag bits
> > there if the signal handler has this flag set.
> 
> For future architectures that implement something similar does it make
> sense that to hide tag bits by default?

I think on arm64 this comes from the fact that the tag bits information
is not available in all scenarios.  To keep things clean, the decision
was taken early on to just zero them all the time in si_addr to avoid
software getting confused.  Possibly other arches do something similar,
but that would need digging into.

There seems to be debate on whether these bits are part of the address
or not.  For si_addr I think they probably _should_ be regarded as part
of the address in general, and arches that can always report all these
bits in si_addr should probably do so IMHO.

> I am wondering if SA_EXPOSE_TABGITS might make sense as an architecture
> specific sa bit.

Perhaps.  Peter, do you see other arches masking out bits in si_addr?

[...]

Cheers
---Dave



More information about the linux-arm-kernel mailing list