From patchwork Tue Nov 3 12:17:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 11877311 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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 B33F1C2D0A3 for ; Tue, 3 Nov 2020 12:19:30 +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 35D8A21D40 for ; Tue, 3 Nov 2020 12:19:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gL6QkoWC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z/QB7ey8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35D8A21D40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:MIME-Version:Message-Id:Date:Subject:To:From: 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=tjTF90ycO0bwz3DRFoxLzrQRqWBXKZMAOIfN8tAMQOc=; b=gL6QkoWC6Xun1DgJyYXdHQoEXU w1fzx1hfcrF9RixPcRK99ZkM9gXBtmAW0SLMZHmwqLzWFYdRLfkMIsECjEpxt4rF88074T8bz4sfL auRyz4IoHZ/OaXYpRTOqDTmQHF3toKKjmDmNHAiAU5O7/wwxVkrDC9ZcK+cEu1fcRz/JpouMj6RuL ndpfJkmkrIxvCgDKqVpI9znuST2+eSAfuuWTuHsDdsp4acS8mmQ3s3MX2Ng2ODGKkkRKxoqciyp0m NbqmJRNchdHV0hjfhHWi6W/GXegcvjxiTnA0qcuzqg15NJLNHK4KNxmFl2ct28AEBKgvfY3QWfpvZ gmQmD+tQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvFz-0008DP-GJ; Tue, 03 Nov 2020 12:17:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZvFl-00087a-CF for linux-arm-kernel@lists.infradead.org; Tue, 03 Nov 2020 12:17:35 +0000 Received: from localhost.localdomain (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2247A22243; Tue, 3 Nov 2020 12:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604405847; bh=1yG+ugvbyY332aQcWxBv875AgHKiSKEXSCfbLB3xw2E=; h=From:To:Cc:Subject:Date:From; b=Z/QB7ey89hqG6c6HYei4ONj3+sYiXpfrd/BDSI16g+huhHXs9hVaoZEbXW/yAjjku 6gpgHF5UEBd5IgSs5rjaUFeC3OoEi80sJpOX/pv14bUSlena/IVqtVWPe+mORPIp0K 516mV9okKyG5r2uFhmcirQgemUlQKx1vjOKDFUig= From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 0/4] Upgrade READ_ONCE() to RCpc acquire on arm64 with LTO Date: Tue, 3 Nov 2020 12:17:17 +0000 Message-Id: <20201103121721.5166-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201103_071734_097707_C5859A1B X-CRM114-Status: GOOD ( 16.12 ) 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: Kees Cook , Peter Zijlstra , Catalin Marinas , Masahiro Yamada , linux-kernel@vger.kernel.org, Sami Tolvanen , Will Deacon Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, These patches were previously posted as part of a larger series enabling architectures to override __READ_ONCE(): v3: https://lore.kernel.org/lkml/20200710165203.31284-1-will@kernel.org/ With the bulk of that merged, the four patches here override READ_ONCE() so that it gains RCpc acquire semantics on arm64 when LTO is enabled. We can revisit this as and when the compiler provides a means for us to reason about the result of dependency-breaking optimisations. In the meantime, this unblocks LTO for arm64, which I would really like to see merged so that we can focus on enabling CFI. I plan to queue these on their own branch in the arm64 tree for 5.11 at -rc3. Cheers, Will Cc: Kees Cook Cc: Catalin Marinas Cc: Sami Tolvanen Cc: Masahiro Yamada Cc: Peter Zijlstra Cc: linux-kernel@vger.kernel.org --->8 Will Deacon (4): arm64: alternatives: Split up alternative.h arm64: cpufeatures: Add capability for LDAPR instruction arm64: alternatives: Remove READ_ONCE() usage during patch operation arm64: lto: Strengthen READ_ONCE() to acquire when CONFIG_LTO=y arch/arm64/Kconfig | 3 + arch/arm64/include/asm/alternative-macros.h | 276 ++++++++++++++++++++ arch/arm64/include/asm/alternative.h | 267 +------------------ arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/insn.h | 3 +- arch/arm64/include/asm/rwonce.h | 63 +++++ arch/arm64/kernel/alternative.c | 7 +- arch/arm64/kernel/cpufeature.c | 10 + arch/arm64/kernel/vdso/Makefile | 2 +- arch/arm64/kernel/vdso32/Makefile | 2 +- arch/arm64/kernel/vmlinux.lds.S | 2 +- 11 files changed, 364 insertions(+), 274 deletions(-) create mode 100644 arch/arm64/include/asm/alternative-macros.h create mode 100644 arch/arm64/include/asm/rwonce.h