From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47383 invoked by alias); 31 Aug 2018 02:14:41 -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 46879 invoked by uid 89); 31 Aug 2018 02:14:40 -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=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*mark, meet X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,GIT_PATCH_1,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: mail1.windriver.com Received: from mail1.windriver.com (HELO mail1.windriver.com) (147.11.146.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 31 Aug 2018 02:14:39 +0000 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id w7V2EYRJ021429 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 30 Aug 2018 19:14:35 -0700 (PDT) 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; Thu, 30 Aug 2018 19:14:33 -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> From: Robert Yang Message-ID: Date: Fri, 31 Aug 2018 02:14: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: <20180830195709.GD28085@wildebeest.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SW-Source: 2018-q3/txt/msg00091.txt.bz2 On 08/31/2018 03:57 AM, Mark Wielaard wrote: > On Wed, Aug 29, 2018 at 04:53:20PM +0800, Robert Yang wrote: >> The one which actually saves the data is data_list.data.d.d_buf, so check it >> before free rawdata_base. >> >> This can fix a segmentation fault when prelink libqb_1.0.3: >> prelink: /usr/lib/libqb.so.0.18.2: Symbol section index outside of section numbers >> >> The segmentation fault happens when prelink call elf_end(). > > Are you sure this isn't a bug in prelink like we discussed last time? > If it isn't, can you give a short example how this issue happens? 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 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. I think that someone who uses libqb_1.0.3 + elfutils + prelink + crosscompile would meet the same problem. // Robert > > Thanks, > > Mark >