From patchwork Tue Aug 18 03:33:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11719777 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 BCF8E14E3 for ; Tue, 18 Aug 2020 03:35:41 +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 94A322053B for ; Tue, 18 Aug 2020 03:35:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="b55V8wj0"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ZzhmZpao" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94A322053B 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=njUmZHh9/b7P5/GT1+Z1E5FJ4HmVXA37fcqjMrZtS/s=; b=b55V8wj0JA3OOo7W657xrMZFxc dZrAkFWh3poGC6fyxfSX2V/yYS6OzXIsS5O2iP39ePwt/mln2YnFIa9IghL27ftC6G8Y+7nmo3dzM x+rM41vgAF4hyZCLRG1Fiw9F6XiDWiOpqjPnQdIzxY9SsEMV9i77Y6wGyfr1Lvb6A7bdl8CjVsiXD +D+nvVg3ESpjM4j5OmdSyWAJABU5n47UODfSGGtiXkU8lugtbndahc2jzSTnpJYQTx5eb/lgcaOSN 4aWo16cZ/8UvqDKbTEi5ISoqOcE6Bqi6UCLs/SkOlZ3BmAYC1pMCjbhYuVoV9cCzgNAfVtkHp+Unz cWwtNo6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7sO0-0002Q7-CP; Tue, 18 Aug 2020 03:34:08 +0000 Received: from mail-qv1-xf4a.google.com ([2607:f8b0:4864:20::f4a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7sNx-0002PJ-KO for linux-arm-kernel@lists.infradead.org; Tue, 18 Aug 2020 03:34:06 +0000 Received: by mail-qv1-xf4a.google.com with SMTP id v5so12373216qvr.1 for ; Mon, 17 Aug 2020 20:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=I6DOB6OCHVtcBnphcSa29MMaJF442XKQMk52U/1RC+0=; b=ZzhmZpaoOxtncOzeWKYsi4/jDjbjwi9gDikzcdHrNeTztQ1vuzJfTeqPCl53ftDQBK Iao0rT+515AU0UB+KhIMuzAyio7SmYih3+sYNif8Q9R4e1cPI+KzOtQv7tkpkP+kRa0k SPpdxcIN5PDMVRTHrkveL92MxPKD00ApgTXCxiXqBpfFdoPqgo3gCAsI0E+0km/wDYG6 zVRGSIrocO0NE0ojebETygFyJlalhbTxbI8ozaZHUMMxyeisk39fsF9sYxB9v0xkkH4p 2pFIPrcSlTpbujapEBAqGTA8BHd6n7/19tSpt65+UaFBy5pJ2sUXiaEuKnM+Oi306ViS Q5Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=I6DOB6OCHVtcBnphcSa29MMaJF442XKQMk52U/1RC+0=; b=mkrOAsezBuE3lhjEa8xZgsL+ts01XZSr6+/PCfdl+BDC5LZ1a8LCfcq0P/ZS7MvR3P uQ6e6ZTnbGTTQFMGVV8gYBnMlkPZJe0bIuwnRTloJOOvv4srZBmWbx7TzF2WwF2fGEjR hgAgfRO57YpoGLIzAopnYHfgnkGuUooPNaY8AtT0qc3yMHJ9R07UjzqFTKLUbNoinlgP 0lOs0DJMPikJVczx8NcG2M4jLb3KzUT1Dm8t6/cEaKs/i5HcKBXPYJY4pae/0mzfXBJr cDvNNWNVYRGwMMJlLznTpLSgab5172/XhXKTeIB60SCt5/gDzN1lhIjWdWul3kt+oExB h4pQ== X-Gm-Message-State: AOAM532y/om++Y4dkt17Yxs8J1jPs61il3Zf+9iOK13ABI8TScgnRqQ5 jquqb5ZkQwAUObieBIEmFZAR4NY= X-Google-Smtp-Source: ABdhPJwsGI+sNs94Ofrco+J81pp2KvZEjJERYjCUozSUIGKt67XI/stlC827tloJ1X+jwI+P5Il9rBU= X-Received: by 2002:ad4:478c:: with SMTP id z12mr17667928qvy.145.1597721641911; Mon, 17 Aug 2020 20:34:01 -0700 (PDT) Date: Mon, 17 Aug 2020 20:33:45 -0700 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.220.ged08abb693-goog Subject: [PATCH v9 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-20200817_233405_703428_8FB3EE41 X-CRM114-Status: GOOD ( 15.34 ) 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:f4a listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 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: linux-parisc@vger.kernel.org, Andrey Konovalov , Kevin Brodsky , 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, especially since userspace would have no way to detect that they are present and valid. Therefore, the first five 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 Peter Collingbourne (6): 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: 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 | 5 ++ arch/arm/include/uapi/asm/signal.h | 28 +------- arch/arm64/include/asm/exception.h | 2 +- arch/arm64/include/asm/traps.h | 7 +- arch/arm64/kernel/debug-monitors.c | 4 +- arch/arm64/kernel/entry-common.c | 2 - arch/arm64/kernel/ptrace.c | 2 +- arch/arm64/kernel/traps.c | 15 +++-- arch/arm64/mm/fault.c | 54 ++++++++------- 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/mips/kernel/traps.c | 2 +- arch/parisc/include/asm/signal.h | 4 ++ arch/parisc/include/uapi/asm/signal.h | 22 +------ arch/parisc/kernel/ptrace.c | 2 +- arch/parisc/mm/fault.c | 2 +- arch/powerpc/include/uapi/asm/signal.h | 24 ------- arch/powerpc/mm/fault.c | 2 +- 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 | 7 -- arch/x86/mm/fault.c | 3 +- arch/xtensa/include/uapi/asm/signal.h | 24 ------- include/linux/compat.h | 4 ++ include/linux/sched/signal.h | 12 +++- include/linux/signal_types.h | 12 ++++ include/uapi/asm-generic/siginfo.h | 13 ++++ include/uapi/asm-generic/signal-defs.h | 64 ++++++++++++++++++ include/uapi/asm-generic/signal.h | 29 -------- kernel/signal.c | 77 ++++++++++++++++++++-- mm/memory-failure.c | 2 +- 37 files changed, 261 insertions(+), 335 deletions(-)