From mboxrd@z Thu Jan 1 00:00:00 1970 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.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,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 C1DA7C433E1 for ; Sat, 22 Aug 2020 05:10:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E6052072D for ; Sat, 22 Aug 2020 05:10:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="LfA08uNQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725863AbgHVFK2 (ORCPT ); Sat, 22 Aug 2020 01:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgHVFK1 (ORCPT ); Sat, 22 Aug 2020 01:10:27 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 998D4C061573 for ; Fri, 21 Aug 2020 22:10:27 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id e12so4362567ybc.18 for ; Fri, 21 Aug 2020 22:10:27 -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=SqGhWwmcmm9obmK6NkU0bTPgP6SFJh16pvDcjsuRl/k=; b=LfA08uNQbqKpNsdC6C0zFBXUKxysEbY7/pd2E8SKumjyn7nrNN+wtdTLdHvGeP4MoJ wiuNPRwrIoZ1BVsjsTL+UcND6doV6pbD/saJ0w97GcZl7noaqwiaYU3zO2rwOU8Z/Vgv Q9pzaOOqLcLZMECN0Vwd8GsXrBNndDoiIdnEIsDW1aL0qPiQQ7Ge5WIyaV7LgWt7MRCD pfAjV83RVAd6YzKmPbPGvpNDqlxZEkYUfVbi1TXKNArst62YYtUbz0JtFrKZyMGt/Fvr n1qUcU1SrOfrkq8cyUHKIj65OvqppFUM1/w4s316FG1Pe6sATLdowEzH7AKofhHTTiZx BQ+g== 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=SqGhWwmcmm9obmK6NkU0bTPgP6SFJh16pvDcjsuRl/k=; b=ti4fTDRxekEO5VScQrwlRjMB5tmc21KIhO5CjQSV5s540N5o/CeGTmKXC3SJAAU0dR hjblsgW27js9Aw21HrbXR6pl6GnBJTvVtY5+jHUCI7d3wYZvv2yPdgJK3LD31Hv8CCI9 kZ4YL1t/tAK2ujU5W2nTGckqIxEQAV7gsTNZohNXIPABSSdUzDjNE37H7pTf6SqEDBJV juizG5FbECOhS5Tk2sZJOTUmBfbyeR6UAbSk2lHNd+fRi/V92V3ZKRO7XbJw3AdBusas Zc7mwFdwIH9uAQOPgnjks8qogn3USkzhiudnnv+S9DwgGnErFZgASbLaF1/4kRb1XFkO 5FrQ== X-Gm-Message-State: AOAM531gweAizSpjO2lS9rzJnkqXvk+lB1EQEn3XbxO+pbjWiV/c51ug yuWQq/ptCAwUkSmhc+Vn48Z+2to= X-Google-Smtp-Source: ABdhPJweXokc3TQ72lH9+WLBlXCauBaaTMpCSHnrI1oNnJXvhwNSOZge9c51Ok7N7jb7F8OLOu2BdjM= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a25:f304:: with SMTP id c4mr7061481ybs.209.1598073026748; Fri, 21 Aug 2020 22:10:26 -0700 (PDT) Date: Fri, 21 Aug 2020 22:10:10 -0700 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog Subject: [PATCH v10 0/7] 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" Cc: Peter Collingbourne , Linux ARM , Kevin Brodsky , Andrey Konovalov , Richard Henderson , linux-parisc@vger.kernel.org, David Spickett Content-Type: text/plain; charset="UTF-8" Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.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 (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 | 22 +--- 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 | 21 ++++ include/linux/signal_types.h | 12 ++ include/uapi/asm-generic/siginfo.h | 14 +++ include/uapi/asm-generic/signal-defs.h | 64 ++++++++++ include/uapi/asm-generic/signal.h | 29 ----- include/uapi/linux/ptrace.h | 2 + kernel/ptrace.c | 29 +++++ kernel/signal.c | 130 +++++++++++---------- 36 files changed, 315 insertions(+), 409 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h -- 2.28.0.297.g1956fa8f8d-goog From mboxrd@z Thu Jan 1 00:00:00 1970 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.8 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 5CF71C433E1 for ; Sat, 22 Aug 2020 05:12:11 +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 2909C2072D for ; Sat, 22 Aug 2020 05:12:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kWa0D2XC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="LfA08uNQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2909C2072D 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=LfHqkz+1a+5U/DyaILdDDqouKWDvlHUTIjMgJaoBvnc=; b=kWa0D2XCvOghoZlnT2gdfvPcM4 SN7xXoHDoESRO1WgD0fMEFgj/HOfDH9BJOd5fAQS565/kkwJvIdDAhqOU2Qz4gt4/xbtqa52OyE75 P1ehOeHguVp3l1whNv02lTTsiStok4do5QdknHFIXieQParbh4TGqFfEgInNtw/ViVL0wfNgX0uPf GRsJkb+vuAvpCQkduVJbqEPRKf7LuwuspPBA5OLTq3bvVxPp0HfWSroFltHufm2VQga2MxO6mpEsZ b1SbmAfONuROyCI4T9lfmUwlJDjCmsGv2sJ4EgTjedZ49e1mqcoMIPMd+fNsNkJc9h+UVBB8OVlKH cmfYqE/Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9LnW-0007T8-9Y; Sat, 22 Aug 2020 05:10:34 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9LnT-0007Si-GU for linux-arm-kernel@lists.infradead.org; Sat, 22 Aug 2020 05:10:32 +0000 Received: by mail-yb1-xb49.google.com with SMTP id p138so4368696yba.12 for ; Fri, 21 Aug 2020 22:10: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=SqGhWwmcmm9obmK6NkU0bTPgP6SFJh16pvDcjsuRl/k=; b=LfA08uNQbqKpNsdC6C0zFBXUKxysEbY7/pd2E8SKumjyn7nrNN+wtdTLdHvGeP4MoJ wiuNPRwrIoZ1BVsjsTL+UcND6doV6pbD/saJ0w97GcZl7noaqwiaYU3zO2rwOU8Z/Vgv Q9pzaOOqLcLZMECN0Vwd8GsXrBNndDoiIdnEIsDW1aL0qPiQQ7Ge5WIyaV7LgWt7MRCD pfAjV83RVAd6YzKmPbPGvpNDqlxZEkYUfVbi1TXKNArst62YYtUbz0JtFrKZyMGt/Fvr n1qUcU1SrOfrkq8cyUHKIj65OvqppFUM1/w4s316FG1Pe6sATLdowEzH7AKofhHTTiZx BQ+g== 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=SqGhWwmcmm9obmK6NkU0bTPgP6SFJh16pvDcjsuRl/k=; b=rNsVlfXHoUF9YAMGB8ayLAHXNz6wfBeTcQpGjKtefNGfLuGcvERBZJ/IHzO0xxj26L Tp/aLjDneslk6cOBNkBpuHaI4jE+0jgqckE8bR/PUGGdmx4NDQdSttAWpmhDKjJQNo1K kYXbViqyAusAeJJZlaCs9VhkE8Q3pnWJ3Vrx91YcFAnLHMNkkeZNmM2avHSahS46uSuj ZHQQEHyWvic+Eg2Fk6tt0kg0BQOMDCFfnDrgCEbUcsqEC8PvaLjSkGyyrha1okmiHN9v oBHw36Lh8PA7erkxt4g6Krr1w3yxI3KH14058xEg/NB9n2mG/LudHDCmsA2LovSVKHhU WN6A== X-Gm-Message-State: AOAM531uMP6U701AE7MiwdXKqjTqGYxPl91itwUT+/wUrOKGhSQukA9o iTG1amNv+m4jb7yKrjwcIGAGY6E= X-Google-Smtp-Source: ABdhPJweXokc3TQ72lH9+WLBlXCauBaaTMpCSHnrI1oNnJXvhwNSOZge9c51Ok7N7jb7F8OLOu2BdjM= X-Received: from pcc-desktop.svl.corp.google.com ([2620:15c:2ce:0:7220:84ff:fe09:385a]) (user=pcc job=sendgmr) by 2002:a25:f304:: with SMTP id c4mr7061481ybs.209.1598073026748; Fri, 21 Aug 2020 22:10:26 -0700 (PDT) Date: Fri, 21 Aug 2020 22:10:10 -0700 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog Subject: [PATCH v10 0/7] 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-20200822_011031_596973_420503F6 X-CRM114-Status: GOOD ( 15.72 ) 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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, 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 (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 | 22 +--- 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 | 21 ++++ include/linux/signal_types.h | 12 ++ include/uapi/asm-generic/siginfo.h | 14 +++ include/uapi/asm-generic/signal-defs.h | 64 ++++++++++ include/uapi/asm-generic/signal.h | 29 ----- include/uapi/linux/ptrace.h | 2 + kernel/ptrace.c | 29 +++++ kernel/signal.c | 130 +++++++++++---------- 36 files changed, 315 insertions(+), 409 deletions(-) create mode 100644 arch/arm64/include/asm/signal.h -- 2.28.0.297.g1956fa8f8d-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel