]> git.ipfire.org Git - thirdparty/glibc.git/commit
Check multiple NT_GNU_PROPERTY_TYPE_0 notes [BZ #23509]
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 8 Nov 2018 18:06:58 +0000 (10:06 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 8 Nov 2018 18:52:32 +0000 (10:52 -0800)
commit3e8d8dd5afba18a847ff7a80f473336f777cc329
tree6941b586dd352a85282409ce00dce07b79d03a7b
parentfc0e3393ff775aa795b523083bb0db7f18d3b91e
Check multiple NT_GNU_PROPERTY_TYPE_0 notes [BZ #23509]

Linkers group input note sections with the same name into one output
note section with the same name.  One output note section is placed in
one PT_NOTE segment.  Since new linkers merge input .note.gnu.property
sections into one output .note.gnu.property section, there is only
one NT_GNU_PROPERTY_TYPE_0 note in one PT_NOTE segment with new linkers.
Since older linkers treat input .note.gnu.property section as a generic
note section and just concatenate all input .note.gnu.property sections
into one output .note.gnu.property section without merging them, we may
see multiple NT_GNU_PROPERTY_TYPE_0 notes in one PT_NOTE segment with
older linkers.

When an older linker is used to created the program on CET-enabled OS,
the linker output has a single .note.gnu.property section with multiple
NT_GNU_PROPERTY_TYPE_0 notes, some of which have IBT and SHSTK enable
bits set even if the program isn't CET enabled.  Such programs will
crash on CET-enabled machines.  This patch updates the note parser:

1. Skip note parsing if a NT_GNU_PROPERTY_TYPE_0 note has been processed.
2. Check multiple NT_GNU_PROPERTY_TYPE_0 notes.

[BZ #23509]
* sysdeps/x86/dl-prop.h (_dl_process_cet_property_note): Skip
note parsing if a NT_GNU_PROPERTY_TYPE_0 note has been processed.
Update the l_cet field when processing NT_GNU_PROPERTY_TYPE_0 note.
Check multiple NT_GNU_PROPERTY_TYPE_0 notes.
* sysdeps/x86/link_map.h (l_cet): Expand to 3 bits,  Add
lc_unknown.

(cherry picked from commit d524fa6c35e675eedbd8fe6cdf4db0b49c658026)
ChangeLog
NEWS
sysdeps/x86/dl-prop.h
sysdeps/x86/link_map.h