Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428834

[PATCH] Disable non-ABI-compliant optimisations for live patching

From Torsten Duwe <duwe@lst.de>
Newsgroups linux.kernel
Subject [PATCH] Disable non-ABI-compliant optimisations for live patching
Date 2016-06-22 16:30 +0200
Message-ID <rMRkd-4AB-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Live patching, as we use it, deliberately disrupts the fabric of
compile units; thus all assumptions a compiler can make about the
control flow may be invalid. As an example, it could analyse that a
callee does not touch a caller-saved register at all, so why waste
memory bandwidth saving it? The register allocations for the live
patch replacement function may however be quite different.

Starting with this example, disable all compiler optimisations that
do not strictly comply with the established calling conventions.

Signed-off-by: Torsten Duwe <duwe@suse.de>
---

Working on the arm64 ftrace-with-regs/livepatch, it struck me that
this is a general problem: with live patching, certain optimisations
must be switched off for all architectures, the new(?) IPA register
allocator in gcc6 is only one example. We should tackle this
well before it bites us.

	Torsten

---
 Makefile | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Makefile b/Makefile
index b409076..424d2e6 100644
--- a/Makefile
+++ b/Makefile
@@ -743,6 +743,13 @@ KBUILD_CFLAGS 	+= $(call cc-option, -femit-struct-debug-baseonly) \
 		   $(call cc-option,-fno-var-tracking)
 endif
 
+ifdef CONFIG_LIVEPATCH
+# The compiler might generate ABI "shortcuts" to speed up the code,
+# making assumptions which are no longer valid when live patching
+# is enabled. Disable all of them.
+KBUILD_CFLAGS	+= $(call cc-option,-fno-ipa-ra)
+endif
+
 ifdef CONFIG_FUNCTION_TRACER
 ifndef CC_FLAGS_FTRACE
 CC_FLAGS_FTRACE := -pg
-- 
2.6.6

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] Disable non-ABI-compliant optimisations for live patching Torsten Duwe <duwe@lst.de> - 2016-06-22 16:30 +0200
  Re: [PATCH] Disable non-ABI-compliant optimisations for live patching Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-22 17:20 +0200
    Re: [PATCH] Disable non-ABI-compliant optimisations for live  patching Miroslav Benes <mbenes@suse.cz> - 2016-06-23 09:50 +0200
      Re: [PATCH] Disable non-ABI-compliant optimisations for live  patching Torsten Duwe <duwe@lst.de> - 2016-06-23 12:10 +0200
        Re: [PATCH] Disable non-ABI-compliant optimisations for live  patching Jiri Kosina <jikos@kernel.org> - 2016-06-23 12:50 +0200
          Re: [PATCH] Disable non-ABI-compliant optimisations for live  patching Jiri Kosina <jikos@kernel.org> - 2016-06-23 14:50 +0200

csiph-web