HomePhabricator

scripts: use LIEF for ELF security & symbol checks

Description

scripts: use LIEF for ELF security & symbol checks

Summary:

test-*-check: Pass in *FLAGS and compile with them

These test-*-check scripts should compile "test" binaries in a way that
is as close to what autotools would do, since the goal is to make sure
that if we run the *-check script, they can correctly detect flaws in
binaries which are compiled by our autotools-based system.

Therefore, we should emulate what happens when the binary is linked in
autotools, meaning that for C binaries, we need to supply the CFLAGS,
CPPFLAGS, and LDFLAGS flags in that order.

Note to future developers: perhaps it'd be nice to have these
test-*-check scripts be part of configure.ac to avoid having to manually
replicate autoconf-like behaviour every time we find a discrepancy. Of
course, that would also mean you'd have to write more m4...

scripts: use LIEF for ELF checks in symbol-check.py

Co-authored-by: Carl Dong <contact@carldong.me>

Note that TestSymbolChecks.test_PE currently still fails for another reason on my machine

'test1: symbol __libc_start_main from unsupported version GLIBC_2.34(2)\n'

I'm still looking for the backport to make this work.

scripts: only parse the binary once in symbol-check.py

scripts: use LIEF for ELF checks in security-check.py

scripts: only parse the binary once in security-check.py

scripts: remove pixie.py

This is a backport of core#22392
Depends on D13970

Test Plan:
Check for no regressions in unit tests:

contrib/devtools/test-security-check.py
contrib-devtools/test-symbol-check.py

gitian builds

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Carl Dong <contact@carldong.me>Authored on Oct 1 2021, 00:17
PiRKCommitted on Jun 3 2023, 08:24
PiRKPushed on Jun 3 2023, 08:24
Reviewer
Restricted Project
Differential Revision
D13971: scripts: use LIEF for ELF security & symbol checks
Parents
rABC44053f6c488e: devtools: Correctly extract symbol versions in symbol-check
Branches
Unknown
Tags
Unknown