Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Jan 2018 11:45:09 -0800
From:      Oleksandr Tymoshenko <gonzo@bluezbox.com>
To:        Johnny Eriksson <bygg@cafax.se>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: elfdump
Message-ID:  <20180112194509.GA61935@bluezbox.com>
In-Reply-To: <CMM.0.91.0.1515754746.bygg@mail.cafax.se>
References:  <CMM.0.91.0.1515754746.bygg@mail.cafax.se>

next in thread | previous in thread | raw e-mail | index | archive | help
Johnny Eriksson (bygg@cafax.se) wrote:
> When parsing a 64-bit big-endian elf file (on a 64-bit X86-64 system),
> the sh_flags entry in the section header is mis-parsed since the routine
> used only reads a 32-bit value.
> 
> *** elfdump.c   Fri Jan 12 10:43:35 2018
> --- elfdump.c.org       Fri Jan 12 10:42:11 2018
> ***************
> *** 798,804 ****
> 		v = (char *)sh + i * shentsize;
> 		name = elf_get_word(e, v, SH_NAME);
> 		type = elf_get_word(e, v, SH_TYPE);
> !               flags = elf_get_size(e, v, SH_FLAGS);
> 		addr = elf_get_addr(e, v, SH_ADDR);
> 		offset = elf_get_off(e, v, SH_OFFSET);
> 		size = elf_get_size(e, v, SH_SIZE);
> --- 798,804 ----
> 		v = (char *)sh + i * shentsize;
> 		name = elf_get_word(e, v, SH_NAME);
> 		type = elf_get_word(e, v, SH_TYPE);
> !               flags = elf_get_word(e, v, SH_FLAGS);
> 		addr = elf_get_addr(e, v, SH_ADDR);
> 		offset = elf_get_off(e, v, SH_OFFSET);
> 		size = elf_get_size(e, v, SH_SIZE);
> 
> Possibly the (new) call to elf_get_size() should be changed to something
> a little bit more informative.

Hi Johnny,

Could you report this bug using Bugzilla interface
https://bugs.freebsd.org/bugzilla/ so it's properly
recorded and searchable?

Also which version of FreeBSD has this bug? I checked
FreeBSD-11 and FreeBSD-HEAD and they both use elf_get_word
to get flags

-- 
gonzo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180112194509.GA61935>