[Toybox] [PATCH] readelf: fix -n for x86-64 ibt/shstk notes.

enh enh at google.com
Thu Mar 14 17:08:34 PDT 2024


I couldn't work out how to get gcc to actually produce such a thing, but
/bin/dbxtool on my debian box right now has them.

The big mistake here is that GNU property notes' data is always 8-byte
aligned, so we needed to skip that. That lets us get rid of the existing
loop termination hack to skip padding.

While I'm here -- since the symptom was running off the end of the file --
I've also added a bounds check in the property dumping loop.

I wish I had fuzzing infrastructure to run AFL++ against this every time
it changes... In lieu of that I do wonder whether we should add `readelf
-aW /bin/* > /dev/null` as a smoke test that "at least it works for all
the _valid_ binaries on the system you're testing on". That would have
caught this sooner.
---
 toys/other/readelf.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240314/4c942270/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-readelf-fix-n-for-x86-64-ibt-shstk-notes.patch
Type: text/x-patch
Size: 3862 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240314/4c942270/attachment.bin>


More information about the Toybox mailing list