E Eric W. Biederman #
Message details and related content
Peter Collingbourne [off-list ref] 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 am wondering if SA_EXPOSE_TABGITS might make sense as an architecture specific sa bit. Otherwise this patch looks good to me. Eric
[1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Signed-off-by: Peter Collingbourne <redacted> Link: https://linux-review.googlesource.com/id/Ia8876bad8c798e0a32df7c2ce1256c4771c81446 --- v16: - add missing file v15: - switched to the SA_EXPOSE_TAGBITS approach proposed by Eric - rebased to 5.10-rc3 v14: - fix an inaccuracy in the commit message - add some comments to arch_addr_tag_bits_mask v13: - renamed si_xflags to si_faultflags - rebased to 5.10-rc2 v12: - add new fields to signal_compat.c test cases - rebased to 5.10-rc1 - mask out bits 63:60 for tag check faults v11: - add a comment explaining what the arch hook should do - rename ignored bits to tag bits v10: - rename the flag to SIFAULTFLAG_ADDR_IGNORED_BITS - use an arch hook to specify which bits are ignored, instead of passing them explicitly - while refactoring for the arch hook, noticed that my previous patches missed a case involving cache maintenance instructions, so expose the tag bits for that signal as well v9: - make the ignored bits fields generic