From patchwork Mon Oct 16 13:24:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 10008283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F553601E7 for ; Mon, 16 Oct 2017 13:25:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C16828587 for ; Mon, 16 Oct 2017 13:25:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50F562858B; Mon, 16 Oct 2017 13:25:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0788E28587 for ; Mon, 16 Oct 2017 13:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753051AbdJPNY7 (ORCPT ); Mon, 16 Oct 2017 09:24:59 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:56942 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753048AbdJPNY5 (ORCPT ); Mon, 16 Oct 2017 09:24:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3815B165C; Mon, 16 Oct 2017 06:24:57 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0175A3F53D; Mon, 16 Oct 2017 06:24:54 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, adech.fo@gmail.com, aryabinin@virtuozzo.com, catalin.marinas@arm.com, christoffer.dall@linaro.org, dvyukov@google.com, linux-kbuild@vger.kernel.org, mark.rutland@arm.com, mark.zyngier@arm.com, mmarek@suse.com, will.deacon@arm.com, yamada.masahiro@socionext.com Subject: [PATCH 2/4] arm64: prevent instrumentation of LL/SC atomics Date: Mon, 16 Oct 2017 14:24:38 +0100 Message-Id: <20171016132440.38098-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171016132440.38098-1-mark.rutland@arm.com> References: <20171016132440.38098-1-mark.rutland@arm.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While we build the LL/SC atomics as a C object file, this does not follow the AAPCS. This does not interoperate with other C code, and can only be called from special wrapper assembly. Bulding a kernel with CONFIG_KCOV and CONFIG_ARM64_LSE_ATOMICS results in the cmopiler inserting calls to __sanitizer_cov_trace_pc within the LL/SC atomics. As __sanitizer_cov_trace_pc is built per the AAPCS, these calls corrupt register values, resulting in failures at boot time. Avoid this (and other similar issues) by opting out of all compiler instrumentation. We can opt-in to specific instrumentation in future if we want to. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/lib/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/lib/Makefile b/arch/arm64/lib/Makefile index a0abc142c92b..af77516f71b2 100644 --- a/arch/arm64/lib/Makefile +++ b/arch/arm64/lib/Makefile @@ -17,5 +17,6 @@ CFLAGS_atomic_ll_sc.o := -fcall-used-x0 -ffixed-x1 -ffixed-x2 \ -fcall-saved-x10 -fcall-saved-x11 -fcall-saved-x12 \ -fcall-saved-x13 -fcall-saved-x14 -fcall-saved-x15 \ -fcall-saved-x18 +CC_INSTRUMENT_atomic_ll_sc.o := n lib-$(CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE) += uaccess_flushcache.o