linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Lianbo Jiang <lijiang@redhat.com>, Borislav Petkov <bp@suse.de>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
Date: Wed, 10 Oct 2018 16:32:45 +0200	[thread overview]
Message-ID: <20181010143306.2051406-1-arnd@arndb.de> (raw)

We get a link failure when calling copy_oldmem_page_encrypted()
when the compiler fails to do constant-propagation of the
sme_active() result into read_from_oldmem:

fs/proc/vmcore.o: In function `read_from_oldmem.part.0':
vmcore.c:(.text+0xb7): undefined reference to `copy_oldmem_page_encrypted'

Adding an IS_ENABLED() check means the compiler will always
know when it cannot be enabled.

Fixes: 992b649a3f01 ("kdump, proc/vmcore: Enable kdumping encrypted memory with SME enabled")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
There may be a better way of doing this, not sure what kinds
of assumptions we want to make here.
---
 fs/proc/vmcore.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
index d469ce9d8c0c..92e1e520a52d 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
@@ -123,7 +123,9 @@ static ssize_t read_from_oldmem(char *buf, size_t count,
 		if (pfn_is_ram(pfn) == 0)
 			memset(buf, 0, nr_bytes);
 		else {
-			if (encrypted)
+			if (IS_ENABLED(CONFIG_X86_64) &&
+			    IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) &&
+			    encrypted)
 				tmp = copy_oldmem_page_encrypted(pfn, buf,
 								 nr_bytes,
 								 offset,
-- 
2.18.0


             reply	other threads:[~2018-10-10 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-10 14:32 Arnd Bergmann [this message]
2018-10-10 14:40 ` [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT Borislav Petkov
2018-10-10 14:45   ` Arnd Bergmann

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=20181010143306.2051406-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=lijiang@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).