LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/mm: Disable various instrumentations of mem_encrypt.c
@ 2017-10-10 19:45 Tom Lendacky
  2017-10-11  9:57 ` Borislav Petkov
  2017-10-11 18:15 ` [tip:x86/urgent] x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c tip-bot for Tom Lendacky
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Lendacky @ 2017-10-10 19:45 UTC (permalink / raw)
  To: x86
  Cc: Peter Zijlstra, linux-kernel, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, Thomas Gleixner

Some routines in mem_encrypt.c are called very early in the boot process,
e.g. sme_enable().  When CONFIG_KCOV is defined the resulting code added
to sme_enable() (and others) for KCOV instrumentation results in a kernel
crash.  Disable the KCOV instrumentation for mem_encrypt.c by adding
KCOV_INSTRUMENT_mem_encrypt.o := n to arch/x86/mm/Makefile.

In order to avoid other possible early boot issues, model mem_encrypt.c
after head64.c in regards to tools. In addition to disabling KCOV as
stated above and a previous patch that disables branch profiling, also
remove the "-pg" CFLAG if CONFIG_FUNCTION_TRACER is enabled and set
KASAN_SANITIZE to "n", each of which are done on a file basis.

Reported-by: kernel test robot <lkp@01.org>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 arch/x86/mm/Makefile |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 72bf8c0..e1f0958 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -1,5 +1,12 @@
-# Kernel does not boot with instrumentation of tlb.c.
-KCOV_INSTRUMENT_tlb.o	:= n
+# Kernel does not boot with instrumentation of tlb.c and mem_encrypt.c
+KCOV_INSTRUMENT_tlb.o		:= n
+KCOV_INSTRUMENT_mem_encrypt.o	:= n
+
+KASAN_SANITIZE_mem_encrypt.o	:= n
+
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_mem_encrypt.o	= -pg
+endif
 
 obj-y	:=  init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
 	    pat.o pgtable.o physaddr.o setup_nx.o tlb.o

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/mm: Disable various instrumentations of mem_encrypt.c
  2017-10-10 19:45 [PATCH] x86/mm: Disable various instrumentations of mem_encrypt.c Tom Lendacky
@ 2017-10-11  9:57 ` Borislav Petkov
  2017-10-11 18:15 ` [tip:x86/urgent] x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c tip-bot for Tom Lendacky
  1 sibling, 0 replies; 3+ messages in thread
From: Borislav Petkov @ 2017-10-11  9:57 UTC (permalink / raw)
  To: Tom Lendacky
  Cc: x86, Peter Zijlstra, linux-kernel, Ingo Molnar, H. Peter Anvin,
	Thomas Gleixner

On Tue, Oct 10, 2017 at 02:45:04PM -0500, Tom Lendacky wrote:
> Some routines in mem_encrypt.c are called very early in the boot process,
> e.g. sme_enable().  When CONFIG_KCOV is defined the resulting code added
> to sme_enable() (and others) for KCOV instrumentation results in a kernel
> crash.  Disable the KCOV instrumentation for mem_encrypt.c by adding
> KCOV_INSTRUMENT_mem_encrypt.o := n to arch/x86/mm/Makefile.
> 
> In order to avoid other possible early boot issues, model mem_encrypt.c
> after head64.c in regards to tools. In addition to disabling KCOV as
> stated above and a previous patch that disables branch profiling, also
> remove the "-pg" CFLAG if CONFIG_FUNCTION_TRACER is enabled and set
> KASAN_SANITIZE to "n", each of which are done on a file basis.
> 
> Reported-by: kernel test robot <lkp@01.org>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>  arch/x86/mm/Makefile |   11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Reviewed-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:x86/urgent] x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c
  2017-10-10 19:45 [PATCH] x86/mm: Disable various instrumentations of mem_encrypt.c Tom Lendacky
  2017-10-11  9:57 ` Borislav Petkov
@ 2017-10-11 18:15 ` tip-bot for Tom Lendacky
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Tom Lendacky @ 2017-10-11 18:15 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: bp, linux-kernel, thomas.lendacky, tglx, lkp, hpa, torvalds, bp,
	peterz, mingo

Commit-ID:  67bb8e999e0aeac285d22f0e53c856b9df5282c6
Gitweb:     https://git.kernel.org/tip/67bb8e999e0aeac285d22f0e53c856b9df5282c6
Author:     Tom Lendacky <thomas.lendacky@amd.com>
AuthorDate: Tue, 10 Oct 2017 14:45:04 -0500
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 11 Oct 2017 17:22:59 +0200

x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c

Some routines in mem_encrypt.c are called very early in the boot process,
e.g. sme_enable().  When CONFIG_KCOV=y is defined the resulting code added
to sme_enable() (and others) for KCOV instrumentation results in a kernel
crash.  Disable the KCOV instrumentation for mem_encrypt.c by adding
KCOV_INSTRUMENT_mem_encrypt.o := n to arch/x86/mm/Makefile.

In order to avoid other possible early boot issues, model mem_encrypt.c
after head64.c in regards to tools. In addition to disabling KCOV as
stated above and a previous patch that disables branch profiling, also
remove the "-pg" CFLAG if CONFIG_FUNCTION_TRACER is enabled and set
KASAN_SANITIZE to "n", each of which are done on a file basis.

Reported-by: kernel test robot <lkp@01.org>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20171010194504.18887.38053.stgit@tlendack-t1.amdoffice.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index 72bf8c0..e1f0958 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -1,5 +1,12 @@
-# Kernel does not boot with instrumentation of tlb.c.
-KCOV_INSTRUMENT_tlb.o	:= n
+# Kernel does not boot with instrumentation of tlb.c and mem_encrypt.c
+KCOV_INSTRUMENT_tlb.o		:= n
+KCOV_INSTRUMENT_mem_encrypt.o	:= n
+
+KASAN_SANITIZE_mem_encrypt.o	:= n
+
+ifdef CONFIG_FUNCTION_TRACER
+CFLAGS_REMOVE_mem_encrypt.o	= -pg
+endif
 
 obj-y	:=  init.o init_$(BITS).o fault.o ioremap.o extable.o pageattr.o mmap.o \
 	    pat.o pgtable.o physaddr.o setup_nx.o tlb.o

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 19:45 [PATCH] x86/mm: Disable various instrumentations of mem_encrypt.c Tom Lendacky
2017-10-11  9:57 ` Borislav Petkov
2017-10-11 18:15 ` [tip:x86/urgent] x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c tip-bot for Tom Lendacky

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git