From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64504 invoked by alias); 20 Jul 2019 21:51:20 -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 64494 invoked by uid 89); 20 Jul 2019 21:51:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-14.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=uncomfortable, HX-Languages-Length:1832, Say X-Spam-Status: No, score=-14.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 20 Jul 2019 21:51:19 +0000 Received: from librem.wildebeest.org (dhcp-089-098-233-039.chello.nl [89.98.233.39]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 29AB230012F3; Sat, 20 Jul 2019 23:51:17 +0200 (CEST) Received: by librem.wildebeest.org (Postfix, from userid 1000) id C1F06C013E; Sat, 20 Jul 2019 23:51:16 +0200 (CEST) Date: Sat, 20 Jul 2019 21:51:00 -0000 From: Mark Wielaard To: "Dmitry V. Levin" Cc: Florian Weimer , elfutils-devel@sourceware.org, Panu Matilainen Subject: Re: [PATCH] elfclassify tool Message-ID: <20190720215116.GC2851@wildebeest.org> References: <871s22yybt.fsf@oldenburg2.str.redhat.com> <8736mfzhob.fsf@oldenburg2.str.redhat.com> <20190719134341.GA26346@altlinux.org> <84da918d32c57e6f16fbcf1c854b375111dbdcb5.camel@wildebeest.org> <20190719183542.GB29323@altlinux.org> <87v9vxivsu.fsf@oldenburg2.str.redhat.com> <20190719212308.GA31813@altlinux.org> <20190719213653.GA2851@wildebeest.org> <20190719225727.GA31985@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190719225727.GA31985@altlinux.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2019-q3/txt/msg00072.txt.bz2 On Sat, Jul 20, 2019 at 01:57:27AM +0300, Dmitry V. Levin wrote: > On Fri, Jul 19, 2019 at 11:36:53PM +0200, Mark Wielaard wrote: > > > If the ELF type is ET_DYN and the object is not marked as DF_1_PIE, > > > could we come up with a more reliable heuristics than DT_SONAME and PT_INTERP? > > > > Why do you feel it is unreliable? Do you have any examples of files > > misidentified? > > No, I don't have such examples because most (if not all) ET_DYN > non-DF_1_PIE objects we have nowadays are actually libraries regardless > of their DT_SONAME or PT_INTERP. > > What actually disqualifies these objects from being libraries, besides > missing PT_DYNAMIC? The goal here was to have a classification specifically to handle things like glibc or Qt executable.so shared libraries. So that --shared would make them as shared libraries primarily (and so --executable would not mark them as programs). This is because for shared libraries you might want to do some processing you don't want for executable (or the other way around). Think about deciding whether or not to keep the .symtab. Maybe you are looking for another goal/classification? For example I added --program which does classify those special files as programs (even though --shared also says they are shared libraries). Maybe you are looking for a different classification similar/dual to that. Say --library? > The only reason why I feel uncomfortable to rely on this has_soname check > is that DT_SONAME is so easily added unnoticed by mistake. But it isn't used in isolation to mark something as --shared. > btw, I think it would be appropriate to move the has_dynamic check before > the first check in is_shared that returns true. Yes, that is probably fine, but does it really matter? Florian, what do you think? Cheers, Mark