From patchwork Fri Nov 13 02:53:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11902429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD31AC2D0E4 for ; Fri, 13 Nov 2020 02:55:12 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4AF0A20B80 for ; Fri, 13 Nov 2020 02:55:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HybtdLvY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ACgIwHha" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4AF0A20B80 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=iYFHMNx0PFmuoOETaIU0YCq++zhooGSz6JJ9SDUSYmw=; b=HybtdLvYqmvUwXwTqlGNCsxaRu amV6wPbKxMeWzTr3J3Z4KrK1BZafdjHkVt3gr/FIwgCgbSXT0AcEfjwnSuBxMmp6sc5TPEbPJY/uk /1ZAOIm1ydvVC2D/JF+uob+bj5iaz32a5oXbt/OjzRadDpEo8C3Eyvh66HM/iprkjAD771BExjv+A h6avVe/vT1gve9/Zi57Tb+yxUXtQ7sHJpOcg9dZ5eeTFiAlNxtLGcWeIIE8fOQGG3TCv2DXOO2LN8 m32WSG376Fu0c+14ZlyGudRHO2JhyTnl5e/FvN3XLa/97Hhav4iI20Lg5VGilLeCKkQ82t8j2E74+ gqeaWvhg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdPDg-0004kS-Io; Fri, 13 Nov 2020 02:53:48 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdPDd-0004jH-Fr for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 02:53:46 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id j10so8698286ybl.19 for ; Thu, 12 Nov 2020 18:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=erXXDcbayGEP6l3q1rjaaVqG+nxU5UCcirwUU6AcyVs=; b=ACgIwHhaeb4gKRTR+rvkOpHYxjldtZb+m1dRSoikUXYTSr2lHm+S8fJjesFAdjME2R 3dz8WCRhRXSwHvqdhsX2wcKzyTGxP1kiWciBd/P1TTFfl1vzuzp2jHYWf9P0tR5fn0/g TRJjPbNIud63kcj+P9vRzZ98zja+eCgZ4xQkuG2NJbNVSVXfCdrida+tTN0U5O8ZNjXR 8PRF4YF7wMV/nlFKSRB5nhHFwZ8GiO+rXY+fKnYQvn8Mf4RQmHI73wXGo5/H1kRx6AnA ps2TaNhVmN8kOybEErF3CYsMMTk1B/vNzvJkBvx4YWSbGCUJ0Fj8OlxvHlLD1XwN73uG ELYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=erXXDcbayGEP6l3q1rjaaVqG+nxU5UCcirwUU6AcyVs=; b=HzBJOLpACFs5o5YpnW3MrZLCPUlhV4fRstTW6eaE/ZRjx6Gk0KVVVjwPVB/oWmhhKB OrHCxa1Nga7Bxhj62onfufPVxnXxoDW0Sy/ixgJ17PuomZiD73nHLx1xDSChUn2pKGIV faXuy65R7Y04SkJxTzE8+Af1QjDGi8JjHm+h8/kixhauf7myAZpBokTXYwdWaZX5o91P 6mR6VPAK4zTWFvQmXmepW4GLpQXgtqveUk9oV9v9mzDWZXiEsJx9Siq0ogcMf5a2TzRF P7jI7vat0votJBrCAcUwHbQN/0V3aKO3FIuR7oEBKja1IkGCoS1V4CsH+lhgb2UIYhYo Ro5g== X-Gm-Message-State: AOAM532CGThc84UHMeZwx61wXwiluV7eiHW2FVLLI4oN91rKg/Rzc7OB zzntu0Nyy3mf7b0ozACfNZN+vfc= X-Google-Smtp-Source: ABdhPJwRsp0X6ALthImiGQCTbOl4aQCGE5kZE10LOd3a3UbTSdokZxVtbPQLQw2tQeUXoyIgHOaQiFs= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a05:6902:72d:: with SMTP id l13mr117991ybt.374.1605236022340; Thu, 12 Nov 2020 18:53:42 -0800 (PST) Date: Thu, 12 Nov 2020 18:53:30 -0800 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH v16 0/6] arm64: expose FAR_EL1 tag bits in siginfo From: Peter Collingbourne To: Catalin Marinas , Evgenii Stepanov , Kostya Serebryany , Vincenzo Frascino , Dave Martin , Will Deacon , Oleg Nesterov , "Eric W. Biederman" , "James E.J. Bottomley" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201112_215345_577506_2DFE80F8 X-CRM114-Status: GOOD ( 15.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Konovalov , Helge Deller , Kevin Brodsky , linux-api@vger.kernel.org, David Spickett , Peter Collingbourne , Linux ARM Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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. In order to allow userspace to determine whether SA_EXPOSE_TAGBITS is supported, we first introduce a mechanism for userspace to detect kernel support for SA_* flags. The series can be viewed on Gerrit here: https://linux-review.googlesource.com/id/Ia8876bad8c798e0a32df7c2ce1256c4771c81446 [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Helge Deller (1): parisc: Drop parisc special case for __sighandler_t Peter Collingbourne (5): parisc: start using signal-defs.h arch: move SA_* definitions to generic headers signal: clear non-uapi flag bits when passing/returning sa_flags signal: define the SA_UNSUPPORTED bit in sa_flags arm64: expose FAR_EL1 tag bits in siginfo Documentation/arm64/tagged-pointers.rst | 25 ++++++--- arch/alpha/include/uapi/asm/signal.h | 14 ----- arch/arm/include/asm/signal.h | 2 + arch/arm/include/uapi/asm/signal.h | 27 ++-------- arch/arm64/include/asm/exception.h | 2 +- arch/arm64/include/asm/signal.h | 25 +++++++++ arch/arm64/include/asm/system_misc.h | 2 +- arch/arm64/include/asm/traps.h | 6 +-- arch/arm64/kernel/debug-monitors.c | 5 +- arch/arm64/kernel/entry-common.c | 2 - arch/arm64/kernel/ptrace.c | 7 +-- arch/arm64/kernel/sys_compat.c | 5 +- arch/arm64/kernel/traps.c | 29 ++++++----- arch/arm64/mm/fault.c | 68 ++++++++++++++----------- arch/h8300/include/uapi/asm/signal.h | 24 --------- arch/ia64/include/uapi/asm/signal.h | 24 --------- arch/m68k/include/uapi/asm/signal.h | 24 --------- arch/mips/include/uapi/asm/signal.h | 12 ----- arch/parisc/include/asm/signal.h | 2 + arch/parisc/include/uapi/asm/signal.h | 34 +------------ arch/powerpc/include/uapi/asm/signal.h | 24 --------- arch/s390/include/uapi/asm/signal.h | 24 --------- arch/sparc/include/uapi/asm/signal.h | 4 +- arch/x86/include/uapi/asm/signal.h | 24 --------- arch/x86/kernel/signal_compat.c | 7 --- arch/xtensa/include/uapi/asm/signal.h | 24 --------- include/linux/signal.h | 14 +++++ include/linux/signal_types.h | 12 +++++ include/uapi/asm-generic/signal-defs.h | 57 +++++++++++++++++++++ include/uapi/asm-generic/signal.h | 29 ----------- kernel/signal.c | 39 +++++++++++--- 31 files changed, 231 insertions(+), 366 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h