Commit 263b0e48 authored by Philipp Rudo's avatar Philipp Rudo Committed by Heiko Carstens

s390/kdump: Make elfcorehdr size calculation ABI compliant

There are two ways to pass the vmcoreinfo to the crash kernel 1) via the
os_info mechanism and 2) via the lowcore->vmcore_info field. In the Linux
kernel only the second way is used. However, the first way is ABI for
stand-alone kdump. So other OSes use it to pass additional debug info. Make
the elfcorehdr size calculation aware of both possible ways.

Fixes: 8cce437f ("s390/kdump: Fix elfcorehdr size calculation")
Signed-off-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
Acked-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 2abe24b4
...@@ -478,26 +478,20 @@ static void *nt_vmcoreinfo(void *ptr) ...@@ -478,26 +478,20 @@ static void *nt_vmcoreinfo(void *ptr)
static size_t nt_vmcoreinfo_size(void) static size_t nt_vmcoreinfo_size(void)
{ {
const char *name = "VMCOREINFO"; const char *name = VMCOREINFO_NOTE_NAME;
char nt_name[11]; unsigned long size;
Elf64_Nhdr note; void *vmcoreinfo;
void *addr;
if (copy_oldmem_kernel(&addr, &S390_lowcore.vmcore_info, sizeof(addr)))
return 0;
if (copy_oldmem_kernel(&note, addr, sizeof(note)))
return 0;
memset(nt_name, 0, sizeof(nt_name)); vmcoreinfo = os_info_old_entry(OS_INFO_VMCOREINFO, &size);
if (copy_oldmem_kernel(nt_name, addr + sizeof(note), if (vmcoreinfo)
sizeof(nt_name) - 1)) return nt_size_name(size, name);
return 0;
if (strcmp(nt_name, name) != 0) vmcoreinfo = get_vmcoreinfo_old(&size);
if (!vmcoreinfo)
return 0; return 0;
return nt_size_name(note.n_descsz, name); kfree(vmcoreinfo);
return nt_size_name(size, name);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment