This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Check multiple NT_GNU_PROPERTY_TYPE_0 notes [BZ #23509]


On Thu, Aug 16, 2018 at 4:47 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 08/16/2018 01:39 PM, H.J. Lu wrote:
>
>> Please show the output of "readelf -n".  I believe that all
>> NT_GNU_PROPERTY_TYPE_0
>> notes are in a single PT_NOTE segment.
>
>
> There is just one property note because the linker has property note merging
> support:
>
> Displaying notes found in: .note.ABI-tag
>   Owner                 Data size       Description
>   GNU                  0x00000010       NT_GNU_ABI_TAG (ABI version tag)
>     OS: Linux, ABI: 3.2.0
>
> Displaying notes found in: .note.gnu.property
>   Owner                 Data size       Description
>   GNU                  0x00000020       NT_GNU_PROPERTY_TYPE_0
>       Properties: x86 ISA used:
>         x86 ISA needed:
>
> Displaying notes found in: .note.gnu.build-id
>   Owner                 Data size       Description
>   GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID
> bitstring)
>     Build ID: 5bd43ed7376c4734e49138a6bddb15dc0d0002a6
>
>> My patch checks each PT_LOAD segment
>> until a NT_GNU_PROPERTY_TYPE_0 note is found.  If more than one note is
>> found,
>> it disables CET since the binary was created by the older linker.
>
>
> I assumed the patch stopped searching once it finds a segment with a single
> NT_GNU_PROPERTY_TYPE_0 note.  I'm still worried that this might be a
> problem, considering that ld produces multiple segments in some cases (but
> the triggering conditions for that aren't entirely clear to me).
>

Multiple segments are perfectly normal.  But there is only one
.note.gnu.property
section, which may contain more then one NT_GNU_PROPERTY_TYPE_0 notes.
This was built by the old linker:

[hjl@gnu-cet-1 pr23509]$ readelf -n foo

Displaying notes found in: .note.gnu.property
  Owner                 Data size Description
  GNU                  0x00000020 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
Invalid x86 feature used: x86
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature used: x86
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature used: x86
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature used: x86
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature: IBT, SHSTK
  GNU                  0x00000010 NT_GNU_PROPERTY_TYPE_0
      Properties: Invalid x86 feature used: x86

Displaying notes found in: .note.ABI-tag
  Owner                 Data size Description
  GNU                  0x00000010 NT_GNU_ABI_TAG (ABI version tag)
    OS: Linux, ABI: 3.2.0

Displaying notes found in: .note.gnu.build-id
  Owner                 Data size Description
  GNU                  0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: e07c4ee5b30388bc95738a19cba8b9e13018176c
[hjl@gnu-cet-1 pr23509]$



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]