From patchwork Thu Jan 31 11:41:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 1034122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495012-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hXW/fvSr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43qywM5d7mz9sBb for ; Thu, 31 Jan 2019 22:40:35 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=LQalo/oqL6wy/HDDR7WrdXMWapHaLoijzeb+9fbi1DWhBR5m4T zTVnR+ROyDkVvgPn4clroCAnLO8bToQm43Gkm2ga/Sc/evROxFRm1DmR1Kq+3iyh eTyLDOY7m0T1eBbnFJ1b779lr5I4Edfo8kuTRzZxZ0U2aWQIkq9lXtcC8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=PJqLI8DiKRQcXG+6wuYUQ5LjNFE=; b=hXW/fvSrY9nJToqlkdV3 RFdQXQkNgY22nw04j+hYRK0rEN66j0MoH5qL/wd+Rd29MThI4eAFWiI0yyTXwftm 2NMQtA8iwtx2BlzOG8FPUHC8GqAk1hBOGHVvD/77ye35zmSDMD7hrcV40w3wVoNZ DF2XhHjKsHWtH1jOgWf2BXg= Received: (qmail 44923 invoked by alias); 31 Jan 2019 11:40:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 44793 invoked by uid 89); 31 Jan 2019 11:40:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Jan 2019 11:40:27 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1E07DB070; Thu, 31 Jan 2019 11:40:25 +0000 (UTC) Date: Thu, 31 Jan 2019 12:41:00 +0100 From: Tom de Vries To: gcc-patches@gcc.gnu.org Cc: Ian Lance Taylor Subject: [PATCH][libbacktrace] Fix .gnu_debugaltlink build-id check Message-ID: <20190131114059.GA15611@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, The 'debugaltlink_name_len =+ 1' bug reported in PR89136 exposes the fact that the build-id is not verified for the .gnu_debugaltlink. Fix both problems. OK for trunk? Thanks, - Tom [libbacktrace] Fix .gnu_debugaltlink build-id check 2019-01-31 Tom de Vries PR libbacktrace/89136 * elf.c (elf_add): Read build-id if with_buildid_data. Fix 'debugaltlink_name_len =+ 1'. --- libbacktrace/elf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c index d933052200c..f3988ec02a0 100644 --- a/libbacktrace/elf.c +++ b/libbacktrace/elf.c @@ -2864,7 +2864,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, /* Read the build ID if present. This could check for any SHT_NOTE section with the right note name and type, but gdb looks for a specific section name. */ - if (!debuginfo + if ((!debuginfo || with_buildid_data != NULL) && !buildid_view_valid && strcmp (name, ".note.gnu.build-id") == 0) { @@ -2938,7 +2938,7 @@ elf_add (struct backtrace_state *state, const char *filename, int descriptor, if (debugaltlink_name_len < shdr->sh_size) { /* Include terminating zero. */ - debugaltlink_name_len =+ 1; + debugaltlink_name_len += 1; debugaltlink_buildid_data = debugaltlink_data + debugaltlink_name_len;