kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
Subsystems (3)
PATCH 1/1 kdump, proc/vmcore: fix building without CONFIG_ARCH_HAS_MEM_ENCRYPT
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.
---
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(-)
fs/proc/vmcore.c +3 -1
@@ -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,
Signature · 1 line
2.18.0
Quoted 25 lines · Arnd Bergmann
We get a link failure when calling
copy_oldmem_page_encrypted()when the compiler fails to do constant-propagation of thesme_active()result intoread_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 <[email protected]>---
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(-)fs/proc/vmcore.c +0
-0
fs/proc/vmcore.c static ssize_t read_from_oldmem(char *buf, size_t count, · line 131
Quoted 10 lines
fs/proc/vmcore.c +3
-1@@ -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
Signature · 4 lines
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)Quoted 42 lines · Borislav Petkov
Quoted 36 lines · Arnd Bergmann
We get a link failure when calling
copy_oldmem_page_encrypted()when the compiler fails to do constant-propagation of thesme_active()result intoread_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 memorywith SME enabled")
Signed-off-by Arnd Bergmann <[email protected]>---
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(-)fs/proc/vmcore.c +3
-1@@ -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,Quoted 2 lines
offset,
--Doesn't that fix it?
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