Bug 217702 - makedumpfile can not open /proc/vmcore
Summary: makedumpfile can not open /proc/vmcore
Status: RESOLVED CODE_FIX
Alias: None
Product: Platform Specific/Hardware
Classification: Unclassified
Component: PPC-64 (show other bugs)
Hardware: All Linux
: P3 normal
Assignee: platform_ppc-64
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 02:04 UTC by Pingfan
Modified: 2023-07-25 04:23 UTC (History)
2 users (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Pingfan 2023-07-25 02:04:45 UTC
This bug should be introduced by the
commit 606787fed7268feb256957872586370b56af697a
Author: Nicholas Piggin <npiggin@gmail.com>
Date:   Tue Jun 6 19:38:32 2023 +1000

    powerpc/64s: Remove support for ELFv1 little endian userspace
    
    ELFv2 was introduced together with little-endian. ELFv1 with LE has
    never been a thing. The GNU toolchain can create such a beast, but
    anyone doing that is a maniac who needs to be stopped so I consider
    this patch a feature.
    
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20230606093832.199712-5-npiggin@gmail.com


And can be workaround by the following draft patch:

diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 110d28bede2a..6af49c90c4b2 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -782,6 +782,18 @@ static void update_backup_region_phdr(struct kimage *image, Elf64_Ehdr *ehdr)
        }
 }
 
+/**
+ * 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2).
+ */
+static inline void update_elfcorehdr_eflags(Elf64_Ehdr *ehdr)
+{
+#if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN)
+       ehdr->e_flags = 0x2;
+#endif
+}
+
+
+
 /**
  * load_elfcorehdr_segment - Setup crash memory ranges and initialize elfcorehdr
  *                           segment needed to load kdump kernel.
@@ -810,6 +822,7 @@ static int load_elfcorehdr_segment(struct kimage *image, struct kexec_buf *kbuf)
 
        /* Fix the offset for backup region in the ELF header */
        update_backup_region_phdr(image, headers);
+       update_elfcorehdr_eflags(headers);
 
        kbuf->buffer = headers;
        kbuf->mem = KEXEC_BUF_MEM_UNKNOWN;
Comment 1 Michael Ellerman 2023-07-25 04:23:04 UTC
This should be fixed in mainline due to the revert:

106ea7ffd56b ("Revert "powerpc/64s: Remove support for ELFv1 little endian userspace"")

Note You need to log in before you can comment on or make changes to this bug.