[Crash-utility] 7.2.8: Failure when using PPC64 extensions on a PPC64 build from X86_64

Arun Easi aeasi.linux at gmail.com
Fri Sep 4 18:27:54 UTC 2020


Hi,

I was trying to debug a PPC64 crash from a X86_64 machine. I got crash
(7.2.8) to work with a "make target=PPC64", but when I tried to load an
extension I got this error:

crash> extend
/root/misc/builds/mpykdump-v3.2.1-g4308a70/Extension/mpykdump.so
extend: /root/misc/builds/mpykdump-v3.2.1-g4308a70/Extension/mpykdump.so:
not an ELF format object file


I tried other sample extensions (like dminfo) with the same result.

A little debugging shows that "is_shared_object()" is returning FALSE
leading to this. Just commenting the call makes the extension work as
expected.

gdb of is_shared_object():

3852            } else if ((elf64->e_ident[EI_CLASS] == ELFCLASS64) &&
(gdb)
3854                    switch (swap16(elf64->e_machine, swap))
(gdb) p elf64
$6 = (Elf64_Ehdr *) 0x7fffffffca40
(gdb) p *elf64
$7 = {e_ident = "\177ELF\002\001\001\000\000\000\000\000\000\000\000",
e_type = 3, e_machine = 62,
  e_version = 1, e_entry = 511360, e_phoff = 64, e_shoff = 20379704,
e_flags = 0, e_ehsize = 64,
  e_phentsize = 56, e_phnum = 7, e_shentsize = 64, e_shnum = 31, e_shstrndx
= 28}
(gdb) p/x *elf64
$8 = {e_ident = {0x7f, 0x45, 0x4c, 0x46, 0x2, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0},
  e_type = 0x3, e_machine = 0x3e, e_version = 0x1, e_entry = 0x7cd80,
e_phoff = 0x40, e_shoff = 0x136f838,
  e_flags = 0x0, e_ehsize = 0x40, e_phentsize = 0x38, e_phnum = 0x7,
e_shentsize = 0x40, e_shnum = 0x1f,
  e_shstrndx = 0x1c}
(gdb) n
3867                            if (machine_type("X86_64") ||
machine_type("ARM64"))
(gdb)
3877                            if (machine_type("ARM64"))
(gdb)
3887                    if (CRASHDEBUG(1))
(gdb) p swap
$9 = 0
(gdb) p machine_type("X86_64")
$10 = 0
(gdb) p machine_type("PPC64")
$11 = 1
(gdb) n
3793                    return FALSE;


It appears like the fix should be something like this (which does fix the
issue), but I'd leave it to experts how to fix this correctly:

 # diff -up symbols.c.org symbols.c
--- symbols.c.org       2020-09-02 11:28:33.855265712 -0700
+++ symbols.c   2020-09-02 11:28:36.964274966 -0700
@@ -3864,7 +3864,8 @@ is_shared_object(char *file)
                        break;

                case EM_X86_64:
-                       if (machine_type("X86_64") ||
machine_type("ARM64"))
+                       if (machine_type("X86_64") || machine_type("ARM64")
||
+                                       machine_type("PPC64"))
                                return TRUE;
                        break;

Regards,
-Arun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20200904/e506c7fc/attachment.htm>


More information about the Crash-utility mailing list