From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38919 invoked by alias); 28 Sep 2017 19:06:12 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 38908 invoked by uid 89); 28 Sep 2017 19:06:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*jistone X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 28 Sep 2017 19:06:10 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE59BC13FDED for ; Thu, 28 Sep 2017 19:06:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AE59BC13FDED Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jistone@redhat.com Received: from moya.lan (ovpn-117-4.phx2.redhat.com [10.3.117.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 856441F8 for ; Thu, 28 Sep 2017 19:06:09 +0000 (UTC) To: elfutils-devel@sourceware.org From: Josh Stone Subject: failed reading "Smallest x86 ELF Hello World" Message-ID: <2c4070fd-23b1-1758-b8be-342bfe852cb6@redhat.com> Date: Thu, 28 Sep 2017 19:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 28 Sep 2017 19:06:09 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00130.txt.bz2 >From http://timelessname.com/elfbin/ Elfutils completely fails to read the file: $ eu-readelf --version eu-readelf (elfutils) 0.169 Copyright [...] $ eu-readelf -a hello eu-readelf: failed reading 'hello': invalid file descriptor It's not clear that we should care, since that page even says it's "a completely corrupted x86 ELF Binary that still runs." But since it's good enough for the kernel to run it, I'd hope for *something* from tools. It also seems weird to get the message "invalid file descriptor", from ELF_E_INVALID_FILE, which makes it sound like more like EBADF. The file descriptor itself is fine - it just doesn't like the ELF within. (DWARF_E_INVALID_FILE's message is just "invalid file".) FWIW, binutils readelf does better: $ readelf --version GNU readelf version 2.27-24.fc26 Copyright [...] $ readelf -a hello ELF Header: Magic: 7f 45 4c 46 01 01 01 48 69 20 57 6f 72 6c 64 0a Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: ABI Version: 105 Type: EXEC (Executable file) Machine: Intel 80386 Version: 0x1 Entry point address: 0x8048080 Start of program headers: 52 (bytes into file) Start of section headers: 309248 (bytes into file) Flags: 0x80cd0000 Size of this header: 22763 (bytes) Size of program headers: 32 (bytes) Number of program headers: 2 Size of section headers: 40 (bytes) Number of section headers: 5 Section header string table index: 4 readelf: hello: Error: Reading 0xc8 bytes extends past end of file for section headers readelf: hello: Error: Section headers are not available! Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x000000 0x08048000 0x08048000 0x000a2 0x000a2 R E 0x1000 LOAD 0x0000a4 0x080490a4 0x080490a4 0x00009 0x00009 W 0x9007b900 There is no dynamic section in this file.