[PATCH] libelf: handle PN_XNUM in elf_getphdrnum before shdr 0 is cached

Omar Sandoval osandov@osandov.com
Mon Mar 23 08:55:43 GMT 2020


On Sun, Mar 22, 2020 at 11:40:34PM +0100, Mark Wielaard wrote:
> Hi Omar,
> 
> On Sat, 2020-03-21 at 11:21 -0700, Omar Sandoval wrote:
> > I encountered this in drgn on a vmcore for a large server created by
> > makedumpfile,
> 
> That makes sense since [vm]cores contain lots of segments.
> 
> >  but I was able to put together a minimal reproducer.
> > Generate the ELF file with this python script:
> > [...]
> > 
> > And run this program:
> > [...]
> > 
> > This should output 66000, but it outputs 65535 instead.
> 
> That is a really nice testcase. If we tweak it a little (so all
> segments have the same load address) then it compresses to just 188
> bytes with bzip2. Would you mind, and give your signed-off-by, for
> adding the attached to the testsuite? It fails before, and passes after
> your fix.

Sure thing, feel free to add

Signed-off-by: Omar Sandoval <osandov@fb.com>

Thanks!


More information about the Elfutils-devel mailing list