From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29869 invoked by alias); 3 Sep 2018 01:32:52 -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 29554 invoked by uid 89); 3 Sep 2018 01:32:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=yang X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mail5.wrs.com Received: from mail5.windriver.com (HELO mail5.wrs.com) (192.103.53.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Sep 2018 01:32:49 +0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id w831WjKi020784 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Sun, 2 Sep 2018 18:32:45 -0700 Received: from localhost.corp.ad.wrs.com (128.224.162.161) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.408.0; Sun, 2 Sep 2018 18:32:44 -0700 Subject: Re: [PATCH V2] libelf/elf_end.c: check data_list.data.d.d_buf before free it To: Mark Wielaard CC: References: <1535532800-35485-1-git-send-email-liezhi.yang@windriver.com> <1535532800-35485-2-git-send-email-liezhi.yang@windriver.com> <20180830195709.GD28085@wildebeest.org> <1535708136.13215.1.camel@klomp.org> From: Robert Yang Message-ID: <69a0a0fb-d09c-4580-f2cc-7962130a2d18@windriver.com> Date: Mon, 03 Sep 2018 01:32:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1535708136.13215.1.camel@klomp.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SW-Source: 2018-q3/txt/msg00097.txt.bz2 On 08/31/2018 05:35 PM, Mark Wielaard wrote: > Hi Robert, > > On Fri, 2018-08-31 at 10:17 +0800, Robert Yang wrote: >> Sorry, I can't make sure which ones is wrong, libqb, prelink or >> elfutils, this >> happens when cross compiling, and I've built more than 4 hunderds of packages, >> libqb 1.0.3 is the only package which has the problem, I've also fixed prelink, >> but it is another segmentation fault error. I've reported this problem to libqb >> community, then they make another branch for libqb, and it works well without >> any errors, the branch is topic-no-ldsection, and the commit is: >> https://github.com/ClusterLabs/libqb/commit/358e0120d8cd288095907869d3f8da92937188a0 > > So, this is a separate issue? Or does the prelink problem also go away > when using that commit/branch? > >> I've used gdb/valgrind to debug this segfault, but can't find prelink's distinct >> problem, the only problem I found is that elfutil's elf_end() free() a NULL >> memory, so I made this patch. > > OK. So I believe that is because prelink's error handling seems wrong. > It seems to assume it adding the ELF data buffer itself, so frees it, > but the data actually seemed to come from elf_getdata, so shouldn't > have been freed by prelink. Thanks, I will investigate that. // Robert > > Thanks, > > Mark >