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: 115917 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3683378qgn; Mon, 16 Oct 2017 06:25:03 -0700 (PDT) X-Google-Smtp-Source: AOwi7QCHh3m0bTMc7FsnGWP4QA38xHjFIo8HJUhB+R+AsC2MY7Ds1Tqt71U2igCokDQZh3ZhqzSw X-Received: by 10.98.158.66 with SMTP id s63mr8679080pfd.293.1508160303539; Mon, 16 Oct 2017 06:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508160303; cv=none; d=google.com; s=arc-20160816; b=yIDcOYIsI6RAimQ7DNUcT5u+4eoVkW+V4AkstrjivE9mj6TalVl+EVHF/HYqTklxA8 DOz43u9jZ7o3qSYNB8yorakKIHTxrRwx3SvYPLbftq4DSBTZoik5NJr7VjlOx+pWuSgy vcdlOH8aLz9jglWvBbrK1R9jNqqjGHcnIGMZRPxoB8f1wmNyXrTKsrhXNGgNOMt5lpu9 T53X02W3H2sB5CvP1AL8zsfD7Bw3+XDV9h8TtcV6QjMc2dGGRDxr2xEc++DERnjf6fGK AIaEUnmT526Krd5fYe0DRm2iuwGax8W1M8kRw98CeDkxplg9D+nHD5HbFWkOIHfOo47R oSvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=KJqLHUIk9vAmdVKxjTsAt0ngfbB7iv2R60vYp4cwVHo=; b=vhKaGxEESBn2lu36tv4PjA/cmHMJNell2q77zidvYQtuQ/Tvnz921hlVhBdL63Y0s3 9Z0TKOFZLGKVU8/TD81f4gdTO827bNxItwE+x6XjhhyH3rsBUS6xlKOP+6BNWbA7zfAL J9t1C21ZRVAw/uRZq6fZZpd61t5d1Sl3xAc8BjcscMipFz4hIJwqdvNf/GS5ccnj1Krz TZN71X6MYUGgjfEpGw0zpaMfhdjJPBhB2uuWErscINd3M56H3i7RzH7UQ7YeVpe0oKFN vMaGg86zEOoAmltmeM3/HnxkSJEIsHLkPF477ZCKGvKyvmuH+BIyJdVxb0cdpVgqYvCQ wsrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19si4092776pgd.755.2017.10.16.06.25.03; Mon, 16 Oct 2017 06:25:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753069AbdJPNZB (ORCPT + 27 others); Mon, 16 Oct 2017 09:25:01 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) -- 2.11.0 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