From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id EAD5F3948A8D for ; Mon, 15 Feb 2021 12:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EAD5F3948A8D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 11BBBAD29; Mon, 15 Feb 2021 12:23:16 +0000 (UTC) Date: Mon, 15 Feb 2021 13:23:14 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Cc: Mark Wielaard Subject: [committed] Add attribute to checksum for DW_FORM_implicit_const Message-ID: <20210215122313.GA26036@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Feb 2021 12:23:19 -0000 Hi, In checksum_die, we handle DW_FORM_implicit_const like so: ... case DW_FORM_implicit_const: if (!handled && die->die_ck_state != CK_BAD) { handled = true; die->u.p1.die_hash = iterative_hash_object (t->values[i], die->u.p1.die_hash); } ... The problem is that the attribute is not hashed in. We could fix this by removing the "handled = true" assignment, but generally the order is "attribute first, value second", and this fix would do the reverse. Consequently, identical attributes, one with form DW_FORM_sdata and one with form DW_FORM_implicit_const would not get the same checksum. Fix this by locally adding hashing of the attribute, before hashing in the value. Committed to trunk. Thanks, - Tom Add attribute to checksum for DW_FORM_implicit_const 2021-02-15 Tom de Vries PR dwz/27418 * dwz.c (checksum_die): Hash in attribute for DW_FORM_implicit_const. --- dwz.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dwz.c b/dwz.c index 7b528e2..17921f0 100644 --- a/dwz.c +++ b/dwz.c @@ -3614,6 +3614,9 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die) if (!handled && die->die_ck_state != CK_BAD) { handled = true; + s = t->attr[i].attr; + die->u.p1.die_hash + = iterative_hash_object (s, die->u.p1.die_hash); die->u.p1.die_hash = iterative_hash_object (t->values[i], die->u.p1.die_hash); }