eliben / pyelftools

Parsing ELF and DWARF in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for aarch64 PAC/BTI markers

rossburton opened this issue · comments

The .note.gnu.property segment will contain GNU_PROPERTY_AARCH64_FEATURE_1_BTI and GNU_PROPERTY_AARCH64_FEATURE_1_PAC markers if the code is compiled with BTI/PAC enabled.

readelf can dump these:

$ readelf -n .../libacl.so

Displaying notes found in: .note.gnu.property
  Owner                Data size 	Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0
      Properties: AArch64 feature: BTI, PAC

But pyelftools doesn't know how to parse the data.

Thanks for letting know. If you feel up to it, submit a PR. If not, please share a minimal binary with those properties, and someone will get to it (eventually).

Here's a representative library:

libattr.so.1.1.2501.zip

I have most of a patch locally that I've been using and just needs a test case, but due to #524 I can't submit it.

Didn't keep other contributors from submitting PRs, myself included. :) I might be missing something legally.

Is that a representative binary or a minimal one? For the autotest purposes, we'd prefer a minimal one, and one with no risk of having proprietary code in it.

Is that a representative binary or a minimal one? For the autotest purposes, we'd prefer a minimal one, and one with no risk of having proprietary code in it.

Representative, because I had it to hand (it's from GNU attr).

Here's int main(void) { return 0;} compiled with PAC/BTI:

pac-bti-test.zip

The PR has landed. Is this still an issue?

So it looks like GitHub doesn't mail when issues are mentioned in PRs, so i didn't notice that PR at all!

$ python3 ./scripts/readelf.py  /yocto/ross/build/tmp/sysroots-components/cortexa57/libice/usr/lib/libICE.so -n

Displaying notes found in: .note.gnu.property
  Owner                Data size        Description
  GNU                  0x00000010	NT_GNU_PROPERTY_TYPE_0 (program properties)
      Properties: aarch64 feature: bti, pac

That will do nicely, thanks.