Re: [PATCH v3] arm64: Expose original FAR_EL1 value in sigcontext
From: Will Deacon <will@kernel.org>
Date: 2020-05-04 17:03:31
Hi Peter, On Wed, Apr 29, 2020 at 02:42:01PM -0700, Peter Collingbourne wrote:
On Wed, Apr 29, 2020 at 2:08 PM Will Deacon [off-list ref] wrote:quoted
On Fri, Mar 27, 2020 at 12:19:15PM -0700, Peter Collingbourne wrote:quoted
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, create a far_context in sigcontext (similar to the existing esr_context), and store the original value of FAR_EL1 (including the tag bits) there. [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Signed-off-by: Peter Collingbourne <redacted> --- v3: - add documentation to tagged-pointers.rst - update comments in sigcontext.hHmm, although the code looks fine, why don't we just expose the tag in the new field, rather than duplicate the address information? I'm nervous about exposing privileged registers directly to userspace.I have no strong opinion on whether this should just contain the tag or not.
A few of us chatted about this today. Please could you spin a v4 where only the top byte is exposed in the new sigcontext record as a __u8? You'll need to think of a better name than "FAR"; perhaps something like 'si_addr_top_byte', 'si_addr_63_56' or whatever you fancy. Naming is hard. For MTE we can add a separate record later on, so as not to overload this (e.g. si_addr_mte_tag). Ta, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel