* [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
@ 2018-10-10 14:32 Arnd Bergmann
2018-10-10 14:40 ` Borislav Petkov
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2018-10-10 14:32 UTC (permalink / raw)
To: Lianbo Jiang, Borislav Petkov
Cc: Arnd Bergmann, Alexey Dobriyan, Andrew Morton, linux-kernel,
linux-fsdevel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
2018-10-10 14:32 [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT Arnd Bergmann
@ 2018-10-10 14:40 ` Borislav Petkov
2018-10-10 14:45 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Borislav Petkov @ 2018-10-10 14:40 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Lianbo Jiang, Alexey Dobriyan, Andrew Morton, linux-kernel,
linux-fsdevel
On Wed, Oct 10, 2018 at 04:32:45PM +0200, Arnd Bergmann wrote:
> 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,
> --
Doesn't that fix it?
https://git.kernel.org/tip/cf089611f4c446285046fcd426d90c18f37d2905
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
2018-10-10 14:40 ` Borislav Petkov
@ 2018-10-10 14:45 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-10-10 14:45 UTC (permalink / raw)
To: Borislav Petkov
Cc: Lianbo Jiang, Alexey Dobriyan, Andrew Morton, linux-kernel,
linux-fsdevel
On 10/10/18, Borislav Petkov <bp@suse.de> wrote:
> On Wed, Oct 10, 2018 at 04:32:45PM +0200, Arnd Bergmann wrote:
>> 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,
>> --
>
> Doesn't that fix it?
>
> https://git.kernel.org/tip/cf089611f4c446285046fcd426d90c18f37d2905
Sorry, my mistake. I noticed this patch was still in my queue and not marked
as 'submitted'. I forgot we had already discussed it.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-10 14:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-10 14:32 [PATCH] kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT Arnd Bergmann
2018-10-10 14:40 ` Borislav Petkov
2018-10-10 14:45 ` Arnd Bergmann
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).