From patchwork Fri Oct 9 00:44:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11824781 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 470DA1744 for ; Fri, 9 Oct 2020 00:45:08 +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 F27AD2224B for ; Fri, 9 Oct 2020 00:45:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="giHINX5a"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="fC1SgTU+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F27AD2224B 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+patchwork-linux-arm=patchwork.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=SC2BkrOY19aEc69HylbsZHEZEE3pfB0KQWczfFyG9M8=; b=giHINX5awHVmGOSyX9PIap4c/N wGFKuzt8QtwvI8k0dwHUyHbfSzQ5x5bkbM54qT/e4/WyFiPPT36zxjpIm0LgxygsWVOdTXv3twra8 M8JDC7j4yQ7hD7aJ/Hijksn7s2wuq3DSUc0YMdHTcvu3RSxGAHYpO+eOBVhZg3YA78w/6xWmP4B1f AKLrYjhyIo0S4za//lEQmJQLpFwqnP+XgcDLkuAfbk6JjionmlxVIhWmRaycjc6rEkhTww97SYutG AxqmnGPQoWJRq2fWlJdBKDp87yRmmYuXmK0i/j8iAWGowPoOZj9TbaNwIHkJBUM9Un0bX0UTubnrZ 9xG1yIJA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQgWP-0001rH-L0; Fri, 09 Oct 2020 00:44:33 +0000 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQgWM-0001qk-OC for linux-arm-kernel@lists.infradead.org; Fri, 09 Oct 2020 00:44:31 +0000 Received: by mail-pf1-x449.google.com with SMTP id 9so5111886pfj.22 for ; Thu, 08 Oct 2020 17:44:28 -0700 (PDT) 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=wgLDmet0HQ/Xo2ByGpci+vz8VBS9/9z68p4dWkDW0X8=; b=fC1SgTU+dqQL8OvzSShRrO2Scq85nI6Xq3wmeRZWZ9JYtRCu+iZTYXS3G0oAPBovcf ddUQrG9eazCPogzxEbiqEJhBJZi2EiLu6zPRMF2bmGek9bFKPdXjwCQWLHoMO2ivwkhb 28Bf+87z+INzm23aAwDo3RKCdZq4BCwAzf5QOh3AblLB4h1NFRDtD2h05MsqUoLKgDKy JL9IyfxlCOgfM4KaXREugnJduaQDeiuEB6W/4pcD7pi3Qwz5me1vsuZhaMlJLul07led M2oD1T1vWVCVehvdHcm+wrQLPbfTcQABwd2AEOpbPNCuGvyI8vTG/060IhfS/UaXHJB/ RS9Q== 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=wgLDmet0HQ/Xo2ByGpci+vz8VBS9/9z68p4dWkDW0X8=; b=RxD/eBV9Ju5aLCf0xjtP02Nw+GqWByR3XIFy+Iezv5LjgyrkDR/Vz7zsClXysJghbO K+etAdZAF6GJgkJmOyj+XKCuwTCL22LQK3bepE+dqoRvxJlrDeMdEKXtd0RzEnIOVkfE UImSEEFS158s7SGCeQfBPGniFbEdnsKqgtA5RD6RQmi+pZU20zHxtCYwbCDrExpcGasj wDHk85dj2JKZPJfdRtpV7oKGXa/c6Jh6TuZRjIMCyp87jCmPeg8yHBmAWCxJBOSL+TBm OOBOTbUAAdqwhFoEpVWNouzr9512V21H1xLzsdQUENurGhDI8CIrZpw7W48eEMExdv3t uGbQ== X-Gm-Message-State: AOAM530/peHzUfCim4B8yiR1i9I6YomShLeL3dZ6HbEIJH3OyiGRlnYN lM1YZb01QFY8+zPeNxxKlcdklmU= X-Google-Smtp-Source: ABdhPJzrYThPrARCgXTOK3iFT+O4tYAwz1aOLL12BpI4pcGQowJXbqoXR7qHKJn+te3MZ10OGk2nNOI= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a17:90b:891:: with SMTP id bj17mr1629152pjb.44.1602204266808; Thu, 08 Oct 2020 17:44:26 -0700 (PDT) Date: Thu, 8 Oct 2020 17:44:11 -0700 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.1011.ga647a8990f-goog Subject: [PATCH v11 0/8] 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-20201008_204430_798121_8CE84EDD X-CRM114-Status: GOOD ( 17.00 ) X-Spam-Score: -7.7 (-------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-7.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:449 listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 DKIMWL_WL_MED DKIMwl.org - Medium trust sender 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 , Richard Henderson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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, create a new pair of union fields in siginfo._sigfault, and store the tag bits of FAR_EL1 there, together with a mask specifying which bits are valid. However, one does not simply add fields to siginfo, at least not without a mechanism for userspace to detect that they are present and valid. Therefore, the first seven patches in this series introduce a mechanism for userspace to detect the presence of our new siginfo fields, and the last patch uses it to advertise the presence of said fields. The series can be viewed on Gerrit here: https://linux-review.googlesource.com/q/Ia8876bad8c798e0a32df7c2ce1256c4771c81446 [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Helge Deller (1): parisc: Drop parisc special case for __sighandler_t Peter Collingbourne (7): 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 signal: deduplicate code dealing with common _sigfault fields signal: define the field siginfo.si_xflags arm64: expose FAR_EL1 tag bits in siginfo Documentation/arm64/tagged-pointers.rst | 21 +++- arch/alpha/include/uapi/asm/signal.h | 14 --- arch/arm/include/asm/signal.h | 2 + arch/arm/include/uapi/asm/signal.h | 28 +---- arch/arm64/include/asm/exception.h | 2 +- arch/arm64/include/asm/signal.h | 17 +++ 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 | 59 ++++----- 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/powerpc/platforms/powernv/vas-fault.c | 1 + 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 | 11 +- arch/xtensa/include/uapi/asm/signal.h | 24 ---- include/linux/compat.h | 4 + include/linux/signal.h | 29 +++++ include/linux/signal_types.h | 12 ++ include/uapi/asm-generic/siginfo.h | 14 +++ include/uapi/asm-generic/signal-defs.h | 58 +++++++++ include/uapi/asm-generic/signal.h | 29 ----- include/uapi/linux/ptrace.h | 12 ++ kernel/ptrace.c | 32 ++++- kernel/signal.c | 134 +++++++++++---------- 36 files changed, 328 insertions(+), 427 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h