From patchwork Thu Oct 10 10:27:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Pratt X-Patchwork-Id: 98653 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E007A385702B for ; Thu, 10 Oct 2024 10:27:38 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by sourceware.org (Postfix) with ESMTPS id 8EC2E3857710 for ; Thu, 10 Oct 2024 10:27:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8EC2E3857710 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=pm.me ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8EC2E3857710 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=185.70.40.133 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556045; cv=none; b=D9SVWhK+L/5Cpju16zBTno0/CKCKYJ98dzl0hJzVEZUH0wHFpxtQFYLE3wl8Psy9b4mW974GCRzR/PNN1RhEOybnkkFg16NHQzO9sxOm3sZfljeuUVW/vkHsoOUeujPhCuJu025B9KIzcFKGYvbeL+kn7B1UUkzGQQPY9g63czk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1728556045; c=relaxed/simple; bh=rq8qq7T/1nmntbbwh6FiD7embnBtVxHx1Tr85+aAWuA=; h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version; b=aGrrS3t1Q4S9cBfgaNXq1/8zJLUoMPWUnKxbQ+mnuTDb2bwBpJT3oBAWWkTGFQ+COKejP8PgL5dPPCUK8prjqDxz53YWKQgpm50Z0UBCbbbK+44s0dwT/+42slALcxyBBq/zKV6RJyuoJgMy/Utjj+/gaPj1mLD2XWRpz498hiE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1728556040; x=1728815240; bh=Mc6mtMlxoGM/P8npfvJNM0lL2P8ksxKp5FWgxBSXpBc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=IbRDeuw4iLf5HnNvJvRh/bBsSozsN5PjTs7Oesz+w6JaRs7fIhppvPnNXbKytgzzq c95zIes6gqYFBo/LrLRuFEAwP/7DEDrAqsNrIr5PUxjm9ndIk2QvXQSyXRLu3rK7f2 00Xw3eCPNBSmeGylgOhQH4YJQozeCobYTc3ynbWmiJMmqQ3QqgtpcAL8F9L2O8ZSro uNv8Ya3Ep6KWEJYVzy14tyYP2rSR8gMD+TwghTSpMRVNrdLJ06NHdFTsoqFZbCGowi EAauAh6CtyEuxOVWyBgA9p4tmdsNP9FqOv+w+nA0PClv4ljMwe+GuhM7WZzO/Eszfr gLojlTPbF85Cw== Date: Thu, 10 Oct 2024 10:27:15 +0000 To: elfutils-devel@sourceware.org From: Michael Pratt Cc: Michael Pratt Subject: [PATCH 4/6] src: Prevent invalid include of binary into compilation Message-ID: <20241010102559.9162-5-mcpratt@pm.me> In-Reply-To: <20241010102559.9162-1-mcpratt@pm.me> References: <20241010102559.9162-1-mcpratt@pm.me> Feedback-ID: 27397442:user:proton X-Pm-Message-ID: a8edf7b32de9108f35f68fc8ad6a7917578c2831 MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org The "stack" binary built by elfutils has the same name as the standard C++ header . If that header were to be in the list of includes while building the C++ elfutils program "srcfiles", then there is a chance that the "stack" binary is included instead and treated as text, leading to a decode error if "stack" happens to be built first and "." is in the include paths. Adding the result of C++ compilation srcfiles.o to the dependencies of "stack" ensures that the C++ compilation will happen first, before the stack binary is present. While this doesn't guarantee an error will not occur in all cases, it does guarantee that it will not occur from a clean build state. * src/Makefile.am: Add compilation dependency between the stack and srcfiles binaries. Signed-off-by: Michael Pratt --- src/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.am b/src/Makefile.am index e0267d96..c5474c68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -94,6 +94,7 @@ strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib) +EXTRA_stack_DEPENDENCIES = $(if $(findstring srcfiles,$(bin_PROGRAMS)),$(srcfiles_OBJECTS)) elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) elfclassify_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD) srcfiles_SOURCES = srcfiles.cxx