V4 [PATCH] x86/CET: Fix property note parser [BZ #23467]
H.J. Lu
hjl.tools@gmail.com
Mon Jul 30 21:20:00 GMT 2018
On Mon, Jul 30, 2018 at 12:43 PM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 07/30/2018 03:34 PM, H.J. Lu wrote:
>> On Mon, Jul 30, 2018 at 12:09 PM, Adhemerval Zanella
>> <adhemerval.zanella@linaro.org> wrote:
>>>
>>> On 30/07/2018 15:56, H.J. Lu wrote:
>>>>>> +
>>>>>> + test (bar);
>>>>>> +
>>>>>> + return EXIT_FAILURE;
>>>>>> +}
>>>>>> diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h
>>>>>> index 35d3f16a23..d9e0770e29 100644
>>>>>> --- a/sysdeps/x86/dl-prop.h
>>>>>> +++ b/sysdeps/x86/dl-prop.h
>>>>>> @@ -73,7 +73,7 @@ _dl_process_cet_property_note (struct link_map *l,
>>>>>> unsigned char *ptr = (unsigned char *) (note + 1) + 4;
>>>>>> unsigned char *ptr_end = ptr + note->n_descsz;
>>>>>>
>>>>> Should we care for overflow here (I guess not since we don't really
>>>>> protected against ill-formed elf files in general)?
>>>> We do protect against ill-formed notes. When we get here, the whole
>>>> note has been loaded into memory. There won't be overflow.
>>> Indeed, LGTM to me then.
>> This is the updated patch I am going to check in today.
>
> Please get final Reviewed-by from the release manager for any patches
> which are materially different from those reviewed.
>
>> From bed8cb21b6bd67bed148713259779a8a3e3f844d Mon Sep 17 00:00:00 2001
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>> Date: Fri, 27 Jul 2018 20:34:55 -0700
>> Subject: [PATCH] x86/CET: Fix property note parser [BZ #23467]
>>
>> GNU_PROPERTY_X86_FEATURE_1_AND may not be the first property item. We
>> need to check each property item until we reach the end of the property
>> or find GNU_PROPERTY_X86_FEATURE_1_AND.
>>
>> This patch adds 2 tests. The first test checks if IBT is enabled and
>> the second test reads the output from the first test to check if IBT
>> is is enabled. The second second test fails if IBT isn't enabled
>> properly.
>>
>> [BZ #23467]
>> * sysdeps/unix/sysv/linux/x86/Makefile (tests): Add
>> tst-cet-property-1 and tst-cet-property-2 if CET is enabled.
>> (CFLAGS-tst-cet-property-1.o): New.
>> (ASFLAGS-tst-cet-property-dep-2.o): Likewise.
>> ($(objpfx)tst-cet-property-2): Likewise.
>> ($(objpfx)tst-cet-property-2.out): Likewise.
>> * sysdeps/unix/sysv/linux/x86/tst-cet-property-1.c: New file.
>> * sysdeps/unix/sysv/linux/x86/tst-cet-property-2.c: Likewise.
>> * sysdeps/unix/sysv/linux/x86/tst-cet-property-dep-2.S: Likewise.
>> * sysdeps/x86/dl-prop.h (_dl_process_cet_property_note): Parse
>> each property item until GNU_PROPERTY_X86_FEATURE_1_AND is
>> found.
>> ---
>> sysdeps/unix/sysv/linux/x86/Makefile | 15 +++++
>> .../unix/sysv/linux/x86/tst-cet-property-1.c | 40 +++++++++++++
>> .../unix/sysv/linux/x86/tst-cet-property-2.c | 58 ++++++++++++++++++
>> .../sysv/linux/x86/tst-cet-property-dep-2.S | 60 +++++++++++++++++++
>> sysdeps/x86/dl-prop.h | 24 +++++---
>> 5 files changed, 188 insertions(+), 9 deletions(-)
>> create mode 100644 sysdeps/unix/sysv/linux/x86/tst-cet-property-1.c
>> create mode 100644 sysdeps/unix/sysv/linux/x86/tst-cet-property-2.c
>> create mode 100644 sysdeps/unix/sysv/linux/x86/tst-cet-property-dep-2.S
>
> OK for 2.28 with 5 comment additions.
>
> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
>
This is the updated patch I am checking in.
Thanks.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-CET-Fix-property-note-parser-BZ-23467.patch
Type: text/x-patch
Size: 10308 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180730/39935fbf/attachment.bin>
More information about the Libc-alpha
mailing list