From patchwork Tue Nov 17 03:17:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Collingbourne X-Patchwork-Id: 11911393 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=-11.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,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 59CACC388F9 for ; Tue, 17 Nov 2020 03:19:24 +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 DF63C24694 for ; Tue, 17 Nov 2020 03:19:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LBDOcoC8"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="eeQ/GIEG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF63C24694 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=vGI5czFXloa3BzKReO3RF+6o7jdLP403BOSZa7Z/pv4=; b=LBDOcoC8d8793XbywE94o1SWYM gvAKUOLqGtTKg+whC9HEbQ5zsbGXtJtRI+6eBzvNrGzpIBNAjX43gRIFivwWN0I4bwQLTb6UgvZt8 CcGDh8Ivi9Ou/8ySxvTqv7ObSrO979j7PVLB0irzx2SIYHBE0hIi5Vn54fPys/VKyGjltxzldIdho DXDhVnKYtUjVfvPhojUEmk2huOywYQDUMQMoQOxEiUi7xCO8LoURQ0ldTm8d0y4bZvfwAlRES4Gfh ziqgR1nq+qwFwWnW5CD+TY+Uszpman5aGXc5D0Wv0FPM7TcLhqQNhigg2dgJE1SFKXsEYBsDJZv4x 8lEbQSYQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kerV5-00049v-6L; Tue, 17 Nov 2020 03:17:47 +0000 Received: from mail-pg1-x54a.google.com ([2607:f8b0:4864:20::54a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kerUy-000489-2M for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2020 03:17:41 +0000 Received: by mail-pg1-x54a.google.com with SMTP id z130so13113771pgz.19 for ; Mon, 16 Nov 2020 19:17:35 -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=Tec8Lof2v7sCzgTi+uz64P+bwXpg3L4Na0+h8yPWlGE=; b=eeQ/GIEGHcztECgqZcrMx1iH24LR1SUqZXwTV8OLBa7Dx6PoIVOjWsBpxnLeJMbTzd IMe+nTSb0aZi6Iymbz5L5+u4muChUb7hLVvAtsI9BuDpw/1MciYAiqcs+utnai+Hxa7W j/zeuiP/8APTSXVFM77BykQLf63h7O3YlpU79CxxwskNXwUDg/tsN9ab32SKQDMY8eoz uLLK+j68ft1h6wWRXGA7dD7MXrUPcoTGBW+2RiR/TBOzbsYWSQ8BoQk+IhEWatOnm/gg UVGGXD5htwd8TX9LF1PkGjOnlr6KiyKvzs4QlCrTL2FLRaML230KvwGG3BOXxvtalxx6 J2Hg== 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=Tec8Lof2v7sCzgTi+uz64P+bwXpg3L4Na0+h8yPWlGE=; b=pmxsfbsRfBmhSY96AyV2O1+TkfpZQnKK+jboAIE9ppaIni0nE/8N+wBhQAhHXMdgjo ySNNrQT8jNjerH5rb67SSL8dwdKK5pXuzvjjX7AHltCZEs2HqZ4/7UPY2R+YhsPUKNJ1 I0d1aAAUbxHcl5vWmJzVFYJDPU6HEchj3REETkYxoITIuw3N1kOuwnMSyEt+oLoLGmN8 zgmuWcQAJmt0zFNfQiS995GdT02PZAhXH7EYQSX0GYWxlqbEw4VzewpIP90ItHub/KcS Fl+EpZWg+mfWntsq0/Og0bWzy3UvCVMO5KJwbBbv9OyPJ0Gnkp0GlBL91YPYFJs5AabB QJyA== X-Gm-Message-State: AOAM531BAt6Lkt5GwQRrvkmqjD32IeB6h5fDWXEwukazLSH9DJwHgfla 0jAM3658xIomY3v96pRZyuws/FY= X-Google-Smtp-Source: ABdhPJxR8h1isZVelOQvnng0IcYVwRvytNDUNLT9OX9mEylOn78LUPwnMgtesoqYVjElf1g6zdRmF8A= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a17:902:c20a:b029:d6:b2d6:8006 with SMTP id 10-20020a170902c20ab02900d6b2d68006mr15677426pll.31.1605583053317; Mon, 16 Nov 2020 19:17:33 -0800 (PST) Date: Mon, 16 Nov 2020 19:17:23 -0800 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH v17 0/3] 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-20201116_221740_121350_8080B05B X-CRM114-Status: GOOD ( 14.32 ) 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. These patches need to be applied on top of: https://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git signal-for-v5.11 The series can be viewed on Gerrit here: https://linux-review.googlesource.com/id/Ia8876bad8c798e0a32df7c2ce1256c4771c81446 [1] http://clang.llvm.org/docs/HardwareAssistedAddressSanitizerDesign.html Peter Collingbourne (3): arch: provide better documentation for the arch-specific 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/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 ++++++++++++++----------- include/linux/signal.h | 14 +++++ include/linux/signal_types.h | 2 +- include/uapi/asm-generic/signal-defs.h | 32 +++++++++--- kernel/signal.c | 29 ++++++++--- 15 files changed, 168 insertions(+), 85 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h