All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
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	[thread overview]
Message-ID: <20171016132440.38098-3-mark.rutland@arm.com> (raw)
In-Reply-To: <20171016132440.38098-1-mark.rutland@arm.com>

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 <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 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
-- 
2.11.0

WARNING: multiple messages have this Message-ID (diff)
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] arm64: prevent instrumentation of LL/SC atomics
Date: Mon, 16 Oct 2017 14:24:38 +0100	[thread overview]
Message-ID: <20171016132440.38098-3-mark.rutland@arm.com> (raw)
In-Reply-To: <20171016132440.38098-1-mark.rutland@arm.com>

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 <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
 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
-- 
2.11.0

  parent reply	other threads:[~2017-10-16 13:25 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 13:24 [PATCH 0/4] Cleanup instrumentation avoidance Mark Rutland
2017-10-16 13:24 ` Mark Rutland
2017-10-16 13:24 ` [PATCH 1/4] kbuild: allow global override of CC instrumentation Mark Rutland
2017-10-16 13:24   ` Mark Rutland
2017-10-17 10:37   ` Will Deacon
2017-10-17 10:37     ` Will Deacon
2017-10-16 13:24 ` Mark Rutland [this message]
2017-10-16 13:24   ` [PATCH 2/4] arm64: prevent instrumentation of LL/SC atomics Mark Rutland
2017-10-17 10:03   ` Will Deacon
2017-10-17 10:03     ` Will Deacon
2017-10-17 10:54     ` Mark Rutland
2017-10-17 10:54       ` Mark Rutland
2017-10-17 10:58       ` Will Deacon
2017-10-17 10:58         ` Will Deacon
2017-10-17 11:10         ` Mark Rutland
2017-10-17 11:10           ` Mark Rutland
2017-10-17 11:38           ` Will Deacon
2017-10-17 11:38             ` Will Deacon
2017-10-17 12:55             ` Mark Rutland
2017-10-17 12:55               ` Mark Rutland
2017-10-18 14:16               ` Will Deacon
2017-10-18 14:16                 ` Will Deacon
2017-10-16 13:24 ` [PATCH 3/4] kvm/arm64: simplify CC instrumentation opt-out Mark Rutland
2017-10-16 13:24   ` Mark Rutland
2017-10-17 14:50   ` Christoffer Dall
2017-10-17 14:50     ` Christoffer Dall
2017-10-16 13:24 ` [PATCH 4/4] arm64: vdso: remove pointless gcov option Mark Rutland
2017-10-16 13:24   ` Mark Rutland
2017-10-17 13:56   ` Mark Rutland
2017-10-17 13:56     ` Mark Rutland
2017-10-16 13:35 ` [PATCH 0/4] Cleanup instrumentation avoidance Mark Rutland
2017-10-16 13:35   ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171016132440.38098-3-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=adech.fo@gmail.com \
    --cc=aryabinin@virtuozzo.com \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=dvyukov@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.zyngier@arm.com \
    --cc=mmarek@suse.com \
    --cc=will.deacon@arm.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.