From patchwork Wed Nov 4 21:18:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11883127 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 57595C4742C for ; Thu, 5 Nov 2020 04:24:57 +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 CC23020795 for ; Thu, 5 Nov 2020 04:24:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1wxhqGYs"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cdcWR/f9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Q3HiY3Ox" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC23020795 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=s+OqkErmoSWMZiWuxeXNkUGin9YOT7Cp2/oGM6D4ToM=; b=1wxhqGYsz8j8U9vHrjsfpoyNuU zg+IndHyGyDu7URl/ct4iQu7LaovXd36ZU5WB6Qc1srJKSsGLIsQOAnGG/PWBsIdtnbIKeZgA3dza iWfmZdlJNej8xE6+LAOsiKVUvccdFNY7e1CPrW64Eyt7iT989pLMUAhXceKM5ybu1Dgbyah9Wi/tm qXEVrc1jSKIBzO6EkCW9/KiQ1aNhWrkyI4/IPaUNooXMUGY6R4qI11YUiIjcOnKgy/ApdcWrotn3S Cuaz1Us+d+sjzhcC+U+X5vXaXhRR/hZpZP1Vb+vJpz9MebGLaNCjXl2PZ6CiwCO0IsvcJdWSib1AS KmaZNozg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaWny-0006VL-Lx; Thu, 05 Nov 2020 04:23:22 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaW80-00016k-4N for linux-arm-kernel@merlin.infradead.org; Thu, 05 Nov 2020 03:40:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:Cc:To:From:Subject: Mime-Version:Message-Id:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=cuLwzoZx7Fk9HE0G2CFWiG+xOnjHMGBrKLR1e4PXIW0=; b=cdcWR/f9CyXxi7qz1hk7Rfo1tZ VrzUOr34wRWlV2MYa2OGNqUxp9JG0LMtBEhJ7CglK2H6R1grzXzoV/xf6xYpUyfvUILfXvTe15Lm5 cpWqOoLRrlmt34vbc9cyamqoJRqtMzQgdNtAa7UyrDdDdUoU0++DzT19MfUSqaFvxQ+p8Oul8/ZX1 KBFJoGw6I1r8dL1UeQBi3BFgEhEcES2wE9inn1tSArLLjrr81+ZQegiHo+09utoz1sa7uSfcGXl9V AqZjCuwrpB7pYy3f4jWzJol3N+59gv1DvAjiaSJ2mgzlN9HeYQcLXO6VaeHSE4jlxhqLZRzoOpG/t Vw+YyNHA==; Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by casper.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaQBe-0000od-FC for linux-arm-kernel@lists.infradead.org; Wed, 04 Nov 2020 21:19:26 +0000 Received: by mail-yb1-xb49.google.com with SMTP id b189so124844ybh.5 for ; Wed, 04 Nov 2020 13:19:21 -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=cuLwzoZx7Fk9HE0G2CFWiG+xOnjHMGBrKLR1e4PXIW0=; b=Q3HiY3Ox60/4Sh+YrXrcYC/m4poSKxf4mQC6xIEsFnOv5CTjEN1oBsjnxOQWW5fZQh nKJdrlkAQhoCiqXqYH2mh34g91jxnfvanPfaUCnbjaOON6/RSxA0LGiuUK4dJxmP1jQF G2U8Bh6Jd7ozIw6Wx77/FxkTcAlP9GXQSj3QK7PwIHAS8ssn3HwwY6Wyt2RPTbTmEsig NAUL6p8oQx6ooEoBz0bdiWFE0ryVa2icSlyyF8lI8fAfTkR/WU3K25+57pyap4/WGFaK PE6IYSLp/X9/mPf4EfNWEcv/P0spmgTmfluU/JfbMzzzMCc/xHyj5v4UF+xwOyjNv0y/ ESiQ== 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=cuLwzoZx7Fk9HE0G2CFWiG+xOnjHMGBrKLR1e4PXIW0=; b=QhYdXYm2dxZ3u785Fc33zdpqPrxi4t5iwxjLyW1tV5WZsnGAlzq6nIkiwgcNPZP1Kd nRH65XTKU0ijjvaCq/oLHp2rg6efp9p1F7KQDHeSN6qusoQvu7fZRCHvOPufX9B5lCCP Gj3kyF2+3jbo+TXni30EDK4mGYcNpipuggjmzERSWVBHZSS6A6qYR9edpVXH8HvpURI9 XJI0QzDwsp+ZYk0li54M8UQriAG5aFnR12Nng//B1oszzRAH0K40tEkCNGFDomRZnddG E3RTFwxWxDzC39Tqi8MPhrC9eq4dTfr6appvgU1AdG2vPSv3zTe5XPtvm6tsSfDLR8TL 3l+Q== X-Gm-Message-State: AOAM53314zC36n1/M2uXfPKUXUhKnXc77KgiSTKTvfjpZ+O9lKPtz51m dTGKU2ISt/5elJfA/jUVOM2ELQQ= X-Google-Smtp-Source: ABdhPJwk7uVrLU5g3VOrgOCTiWTr2GTYc9lpO92ajBOkg27LLvNuEcBtfG8EbDAqgSYd6bcRCrYv4S4= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a25:2fc3:: with SMTP id v186mr36015631ybv.448.1604524697999; Wed, 04 Nov 2020 13:18:17 -0800 (PST) Date: Wed, 4 Nov 2020 13:18:03 -0800 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.29.1.341.ge80a0c044ae-goog Subject: [PATCH v14 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-20201104_211922_777518_82DB00D9 X-CRM114-Status: GOOD ( 17.52 ) 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+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, 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: deduplicate code dealing with common _sigfault fields 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_faultflags 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 | 27 +---- arch/arm64/include/asm/exception.h | 2 +- arch/arm64/include/asm/signal.h | 31 +++++ 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/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 | 19 +-- 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 | 17 +++ include/uapi/asm-generic/signal-defs.h | 58 +++++++++ include/uapi/asm-generic/signal.h | 29 ----- include/uapi/linux/ptrace.h | 12 ++ kernel/ptrace.c | 33 ++++- kernel/signal.c | 134 +++++++++++---------- 36 files changed, 361 insertions(+), 428 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h