From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0745746149897042514==" MIME-Version: 1.0 From: Mark Wielaard To: elfutils-devel@lists.fedorahosted.org Subject: Re: [PATCH] elflint: Fix sh_entsize check when comparing SHT_HASH and SHT_GNU_HASH. Date: Mon, 15 Feb 2016 23:48:45 +0100 Message-ID: <20160215224845.GC29346@blokker.redhat.com> In-Reply-To: 1455024638-12222-1-git-send-email-mjw@redhat.com --===============0745746149897042514== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue, Feb 09, 2016 at 02:30:38PM +0100, Mark Wielaard wrote: > GCC6 -Wduplicated-cond found the following issue: > = > elflint.c: In function =E2=80=98compare_hash_gnu_hash=E2=80=99: > elflint.c:2483:34: error: duplicated =E2=80=98if=E2=80=99 condition [-Wer= ror=3Dduplicated-cond] > else if (hash_shdr->sh_entsize =3D=3D sizeof (Elf64_Word)) > ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ > elflint.c:2448:29: note: previously used here > if (hash_shdr->sh_entsize =3D=3D sizeof (Elf32_Word)) > ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ > = > Which is correct, a Word in both Elf32 and Elf64 files is 4 bytes. > We meant to check for sizeof (Elf64_Xword) which is 8 bytes. > = > Also fix the section index and name in the error message. > = > The reason we probably didn't see this issue before is that SHT_HASH > sections really always should have sh_entsize of 4 even on 64bit arches. > There are however a couple of arches with mistakes in their sysv ABI. > See libelf/common.h. This also would only be triggered if on such an > architectures when the ELF file would have both a SHT_HASH and SHT_GNU_HA= SH > section and elflint would try to compare those sections. > = > Add an example testfile-s390x-hash-both to run-elflint-test.sh. I pushed this to master. --===============0745746149897042514==--