HomePhabricator

contrib: Parse ELF directly for symbol and security checks

Description

contrib: Parse ELF directly for symbol and security checks

Summary:
Instead of the ever-messier text parsing of the output of the readelf
tool (which is clearly meant for human consumption not to be machine
parseable), parse the ELF binaries directly.

Add a small dependency-less ELF parser specific to the checks.

This is slightly more secure, too, because it removes potential
ambiguity due to misparsing and changes in the output format of elfread. It
also allows for stricter and more specific ELF format checks in the future.

This removes the build-time dependency for readelf.

This is a backport of core#20434
Depends on D13582

Test Plan: gitian builds

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D13585

Details

Provenance
Wladimir J. van der Laan <laanwj@protonmail.com>Authored on Nov 20 2020, 08:15
PiRKCommitted on Apr 6 2023, 05:53
PiRKPushed on Apr 6 2023, 05:53
Reviewer
Restricted Project
Differential Revision
D13585: contrib: Parse ELF directly for symbol and security checks
Parents
rABCf6024eed1517: scripts: add PE dylib checking to symbol-check.py
Branches
Unknown
Tags
Unknown