From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web10.14600.1605134474295865631 for ; Wed, 11 Nov 2020 14:41:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MLFqYY0h; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605134473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAVejAit/SXSqA+IwwYC0ClYyODeqQgnDirISBbk7Ss=; b=MLFqYY0hXIro7zL7kQTy+pvWzVCEWo6uExB6VPC0HpSr0iMTZeEmCgngeclMP6INQRIJXD H80U7dVM4HmsDVWCCjZUEVK1kPTjEsRoC1d25fExu1SzBnZpq3i/4rwio0gYS6D+hi0xAr C6p6RKWbRKhpMrOwKHaaGn+oJ09GIWM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-39PmFkqQOCm8kMRW4Rt1dQ-1; Wed, 11 Nov 2020 17:41:11 -0500 X-MC-Unique: 39PmFkqQOCm8kMRW4Rt1dQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCC59802ED9; Wed, 11 Nov 2020 22:41:08 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-85.ams2.redhat.com [10.36.113.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id A127D19C71; Wed, 11 Nov 2020 22:41:07 +0000 (UTC) Subject: Re: [edk2-devel] : Query regarding IsTextShdr inside Basetools From: "Laszlo Ersek" To: "Ard Biesheuvel (ARM address)" , "Liming Gao (Byosoft address)" Cc: devel@edk2.groups.io, mojha@codeaurora.org, discuss@edk2.groups.io References: <9cd5c07e-d74d-5fa7-b3a7-2ef5fec01fc5@redhat.com> Message-ID: <7b920231-f763-06d6-c69c-a97123c7a4be@redhat.com> Date: Wed, 11 Nov 2020 23:41:06 +0100 MIME-Version: 1.0 In-Reply-To: <9cd5c07e-d74d-5fa7-b3a7-2ef5fec01fc5@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 11/11/20 23:40, Laszlo Ersek wrote: > Ard, Liming, > > can you please take a look? > > Thanks! > Laszlo Darn, I used Liming's old email address. Correcting it now. Sorry! Laszlo > > On 11/10/20 14:07, Mukesh Ojha wrote: >> Hi All, >> >> I have a doubt about the check we have put inside IsTextShdr() . >> >> STATIC >> BOOLEAN >> IsTextShdr ( >>   Elf_Shdr *Shdr >>   ) >> { >>   return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == >> SHF_ALLOC); >> } >> >> >> We are observing one issue where while generate EFI using GenFW in EDK2 >> because test/data section offset is different than calculated >> mCoffSectionsOffset when scanning sections. >> I run GenFW with a failure dll in my local after adding some logs into >> GenFW. and found that “mCoffSectionsOffset” for data section seems not >> to have expected value due to >> “.note.gnu.property” size. Because compiled dll has “.note.gnu.property” >> section with alloc flag and GenFW thinks that it’s a text section if >> alloc flag is set. >> So its size is added to the mCoffSectionsOffset. >> >> Could you please give us an advice whether we can fix IsTextShdr() >> function like below ? >> >> >> --- a/BaseTools/Source/C/GenFw/Elf64Convert.c >> +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c >> @@ -229,7 +229,7 @@ IsTextShdr ( >>    Elf_Shdr *Shdr >>    ) >> { >> -  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == >> SHF_ALLOC); >> +  return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | >> SHF_ALLOC)) == (SHF_ALLOC | SHF_EXECINSTR));^ >> >> >> Thanks, >> Mukesh >> >> >> >> >> >