From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 91C493858D1E for ; Wed, 21 Dec 2022 11:13:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 91C493858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B4C976B8B9; Wed, 21 Dec 2022 11:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1671621184; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1hgvk8rvv0qLH4Jdt8GTDFvlTfahhpxAvgf5oy/9rg=; b=HYZQYqYPZ3WTanIKxv1pyJ/JNcCsBEfVW8zTTHKTOF98uxDKaNTWmTMFITOUnIv8jSvRCt qLpY6l5wu0nUpQUa59UQWvpy14bJVJOSX1SiGda+cmcmYqeDglyDB57pOSd+FvVeHczFez Yjf96/kVHTmlRVO8LUluOfHANvj0u5s= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1671621184; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1hgvk8rvv0qLH4Jdt8GTDFvlTfahhpxAvgf5oy/9rg=; b=vC+6iKBX5oV7mXQkYBOqzr9/dBL4Hfi+dwRE1dQHuFBw1iQXB6ATGjDyi98ANToJ4mZxZS blhesJbOPsfbb/Bw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A45D01390E; Wed, 21 Dec 2022 11:13:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id axN/JkDqomN/OwAAMHmgww (envelope-from ); Wed, 21 Dec 2022 11:13:04 +0000 Message-ID: Date: Wed, 21 Dec 2022 12:13:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCHv2] support ZSTD compression algorithm Content-Language: en-US To: Mark Wielaard , elfutils-devel@sourceware.org References: <24d7165b-b8ac-ea5d-a046-aec2203696a9@suse.cz> <39e57e080be477edd4f7239d43ff1188bbb4814e.camel@klomp.org> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <39e57e080be477edd4f7239d43ff1188bbb4814e.camel@klomp.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_EU,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 12/19/22 16:09, Mark Wielaard wrote: > Hi Martin, > > On Mon, 2022-12-19 at 15:19 +0100, Martin Liška wrote: >> On 12/15/22 14:17, Mark Wielaard wrote: >>> Is there a particular way you are running eu-readelf? Is it with >>> generic -w or -a, or decoding a specific section type? >> >> Hello. >> >> $ LD_LIBRARY_PATH=./libelf ./src/readelf -w >> ~/Programming/testcases/a.out >> >> where I get: >> >> ./src/readelf: cannot get debug context descriptor: No DWARF >> information found >> >> DWARF section [37] '.debug_info' at offset 0x1ab2: >> [Offset] >> ./src/readelf: cannot get next unit: no error >> >> Call frame information section [13] '.eh_frame' at offset 0x4a8: >> ... >> >> >> t��o5��=I�iAp@a����S^R/<�����^�qi�ַp@ > > [...] > >> So basically a garbage. And I don't know how to bail out properly? > > Aha. If you have that a.out somewhere I can take a look. I suspect this > is because we expect all .debug sections to have been decompressed in > libdw/dwarf_begin_elf.c, but that isn't really true, see check_section > in that file which has: > > if ((shdr->sh_flags & SHF_COMPRESSED) != 0) > { > if (elf_compress (scn, 0, 0) < 0) > { > /* It would be nice if we could fail with a specific error. > But we don't know if this was an essential section or not. > So just continue for now. See also valid_p(). */ > return result; > } > } Sure, there's a file example: https://splichal.eu/tmp/zstd.out $ ./src/readelf -Sz zstd.out ... [35] .debug_abbrev PROGBITS 0000000000000000 000018b4 00000177 0 C 0 0 1 [ELF ZSTD (2) 00000318 1] $ LD_LIBRARY_PATH=libelf/ ./src/readelf -w zstd.out (prints garbage if not configured with zstd) Please use code from my branch: https://sourceware.org/git/?p=elfutils.git;a=shortlog;h=refs/heads/users/marxin/try-zstd-support-v2 Cheers, Martin > > We should probably adjust valid_p so it produces a more appropriate > error message and/or add additional checks in readlelf.c. > > But lets do that after this patch goes in. > > Cheers, > > Mark