Skip to contentSkip to conversation

ppc64/kdump: Fix ELF header endianess

PATCH In review Laurent Dufour 3 participants 4 messages Jul 25, 2014 – Sep 1, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc64/kdump: Fix ELF header endianess

The ELF header created among the loading of the kdump kernel should be flagged using the current endianess and not always as big endian.

Without this patch the data exposed in /proc/vmcore are not readable when running in LE mode.

---
 kexec/arch/ppc64/crashdump-ppc64.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +4 -0
index 00a0e632f48e..6214b831fdf2 100644
@@ -38,7 +38,11 @@
 static struct crash_elf_info elf_info64 =
 {
 	class: ELFCLASS64,
+#if BYTE_ORDER == LITTLE_ENDIAN
+	data: ELFDATA2LSB,
+#else
 	data: ELFDATA2MSB,
+#endif
 	machine: EM_PPC64,
 	page_offset: PAGE_OFFSET,
 	lowmem_limit: MAXMEM,

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#1 lore raw
Quoted 5 lines · On Fri, 25 Jul 2014 17:07:49 +0200 Laurent Dufour <[email protected]>…

The ELF header created among the loading of the kdump kernel should be flagged using the current endianess and not always as big endian.

Without this patch the data exposed in /proc/vmcore are not readable when running in LE mode.

FWIW I can confirm that this patch has fixed kdump on my ppc64le system.

Thank you, Laurent!

Petr Tesarik

Quoted 23 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +4 -0
index 00a0e632f48e..6214b831fdf2 100644
@@ -38,7 +38,11 @@
 static struct crash_elf_info elf_info64 =
 {
 	class: ELFCLASS64,
+#if BYTE_ORDER == LITTLE_ENDIAN
+	data: ELFDATA2LSB,
+#else
 	data: ELFDATA2MSB,
+#endif
 	machine: EM_PPC64,
 	page_offset: PAGE_OFFSET,
 	lowmem_limit: MAXMEM,
Quoted 4 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#2 lore raw
In reply to Laurent Dufour
Quoted 5 lines · Laurent Dufour

The ELF header created among the loading of the kdump kernel should be flagged using the current endianess and not always as big endian.

Without this patch the data exposed in /proc/vmcore are not readable when running in LE mode.

Hi Simon,

Do you have any concerns with this patch ?
If not, would you please consider it for merge since it fixes a major issue with dump analysis.

Thanks
Laurent.

Quoted 23 lines
---
 kexec/arch/ppc64/crashdump-ppc64.c |    4 ++++
 1 file changed, 4 insertions(+)
kexec/arch/ppc64/crashdump-ppc64.c +4 -0
index 00a0e632f48e..6214b831fdf2 100644
@@ -38,7 +38,11 @@
 static struct crash_elf_info elf_info64 =
 {
 	class: ELFCLASS64,
+#if BYTE_ORDER == LITTLE_ENDIAN
+	data: ELFDATA2LSB,
+#else
 	data: ELFDATA2MSB,
+#endif
 	machine: EM_PPC64,
 	page_offset: PAGE_OFFSET,
 	lowmem_limit: MAXMEM,
Quoted 5 lines

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
Quoted 4 lines · Laurent Dufour
Quoted 3 lines · Laurent Dufour

The ELF header created among the loading of the kdump kernel should be flagged using the current endianess and not always as big endian.

Quoted 8 lines
Quoted 2 lines

Without this patch the data exposed in /proc/vmcore are not readable when running in LE mode.

Hi Simon,

Do you have any concerns with this patch ?
If not, would you please consider it for merge since it fixes a major issue with dump analysis.

Thanks, I have applied this patch.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec