From owner-freebsd-bugs@freebsd.org Fri Jan 12 10:59:10 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54A2EEA59FE for ; Fri, 12 Jan 2018 10:59:10 +0000 (UTC) (envelope-from bygg@mail.cafax.se) Received: from mail.cafax.se (mail.cafax.se [IPv6:2a00:801:11:53::4]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBB2183479 for ; Fri, 12 Jan 2018 10:59:09 +0000 (UTC) (envelope-from bygg@mail.cafax.se) Received: from mail.cafax.se (localhost [127.0.0.1]) by mail.cafax.se (8.15.1/8.15.1) with ESMTPS id w0CAx6Ki001923 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Jan 2018 11:59:06 +0100 (MET) Received: (from bygg@localhost) by mail.cafax.se (8.15.1/8.15.1/Submit) id w0CAx6W8004700 for freebsd-bugs@freebsd.org; Fri, 12 Jan 2018 11:59:06 +0100 (MET) Sender: Johnny Eriksson Date: Fri, 12 Jan 2018 11:59:06 WET From: Johnny Eriksson Reply-To: Johnny Eriksson To: freebsd-bugs@freebsd.org Subject: elfdump Message-ID: X-Scanned-By: MIMEDefang 2.71 on 192.71.228.4 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 10:59:10 -0000 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. --Johnny