From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753504AbbJaCJA (ORCPT ); Fri, 30 Oct 2015 22:09:00 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:39159 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbbJaCI7 (ORCPT ); Fri, 30 Oct 2015 22:08:59 -0400 Subject: Re: [PATCH 1/3] recordmcount: fix endianness handling bug for nop_mcount To: Sergei Shtylyov , , , , , References: <1446193864-24593-1-git-send-email-huawei.libin@huawei.com> <1446193864-24593-2-git-send-email-huawei.libin@huawei.com> <56338025.3060602@cogentembedded.com> CC: , , , , , From: libin Message-ID: <5634226A.9060208@huawei.com> Date: Sat, 31 Oct 2015 10:07:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <56338025.3060602@cogentembedded.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.23.78] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.56342275.0093,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6d47f9910d9acaabfbaf540a196b9139 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org on 2015/10/30 22:35, Sergei Shtylyov wrote: > Hello. > > On 10/30/2015 11:31 AM, Li Bin wrote: > >> In nop_mcount, shdr->sh_offset and welp->r_offset should handle >> endianness properly, otherwise it will trigger Segmentation fault >> if the recordmcount main and file.o have different endianness. >> >> Cc: # 3.0+ >> Signed-off-by: Li Bin >> --- >> scripts/recordmcount.h | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h >> index 49b582a..dda9dba 100644 >> --- a/scripts/recordmcount.h >> +++ b/scripts/recordmcount.h >> @@ -376,8 +376,9 @@ static void nop_mcount(Elf_Shdr const *const relhdr, >> mcountsym = get_mcountsym(sym0, relp, str0); >> >> if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { >> - if (make_nop) >> - ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); >> + if (make_nop) { >> + ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset)); >> + } > > {} not needed here. Oh, yes. When I cleaned the debugging code, forgot delete the {}. Thanks, Li Bin > > MBR, Sergei > > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 From: huawei.libin@huawei.com (libin) Date: Sat, 31 Oct 2015 10:07:38 +0800 Subject: [PATCH 1/3] recordmcount: fix endianness handling bug for nop_mcount In-Reply-To: <56338025.3060602@cogentembedded.com> References: <1446193864-24593-1-git-send-email-huawei.libin@huawei.com> <1446193864-24593-2-git-send-email-huawei.libin@huawei.com> <56338025.3060602@cogentembedded.com> Message-ID: <5634226A.9060208@huawei.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org on 2015/10/30 22:35, Sergei Shtylyov wrote: > Hello. > > On 10/30/2015 11:31 AM, Li Bin wrote: > >> In nop_mcount, shdr->sh_offset and welp->r_offset should handle >> endianness properly, otherwise it will trigger Segmentation fault >> if the recordmcount main and file.o have different endianness. >> >> Cc: # 3.0+ >> Signed-off-by: Li Bin >> --- >> scripts/recordmcount.h | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h >> index 49b582a..dda9dba 100644 >> --- a/scripts/recordmcount.h >> +++ b/scripts/recordmcount.h >> @@ -376,8 +376,9 @@ static void nop_mcount(Elf_Shdr const *const relhdr, >> mcountsym = get_mcountsym(sym0, relp, str0); >> >> if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { >> - if (make_nop) >> - ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); >> + if (make_nop) { >> + ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset)); >> + } > > {} not needed here. Oh, yes. When I cleaned the debugging code, forgot delete the {}. Thanks, Li Bin > > MBR, Sergei > > > . >