Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 717264

Summary: sys-apps/file-5.38: Regression in distinction of ELF PIE executables from ELF shared libraries
Product: Gentoo Linux Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: dev-portage
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=715162
Whiteboard:
Package list:
Runtime testing required: ---

Description Arfrever Frehtes Taifersar Arahesis 2020-04-12 22:45:47 UTC
sys-apps/file-5.37-r1 is not affected.

sys-apps/file-5.38 has regression in distinction of ELF PIE executables from ELF shared libraries.

Fix: https://github.com/file/file/commit/483e7d8f1a5c3544bd42ead471813f8389fa7fc2


With sys-apps/file-5.37-r1:

# file /bin/ls /lib64/libz.so.1.2.11
/bin/ls:               ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 4.0.0, stripped
/lib64/libz.so.1.2.11: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped


With sys-apps/file-5.38 (unpatched):

# file /bin/ls /lib64/libz.so.1.2.11
/bin/ls:               ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 4.0.0, stripped
/lib64/libz.so.1.2.11: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), statically linked, stripped


With sys-apps/file-5.38 (patched):

# file /bin/ls /lib64/libz.so.1.2.11
/bin/ls:               ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 4.0.0, stripped
/lib64/libz.so.1.2.11: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), statically linked, stripped


(This "shared object" for ELF PIE executables causes false positive result in Portage code added for bug #715162.)

(Another, still present, unrelated regression seen above is "statically linked" for ELF dynamically linked shared libraries...)
Comment 1 Larry the Git Cow gentoo-dev 2020-04-12 23:28:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5460a7f2977b8ef57e56c447c5b8350bbe505f9d

commit 5460a7f2977b8ef57e56c447c5b8350bbe505f9d
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2020-04-12 23:20:25 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2020-04-12 23:21:49 +0000

    sys-apps/file: rev bump
    
    - Revert https://github.com/file/file/commit/24c9c086cd7c55b7b0a003a145b32466468e2608
      which fixes misdetection of shared libraries as statically linked as.
    
    - Cherry-pick https://github.com/file/file/commit/d955cefc956ba537cfc0556023a65fe80bd2d82b
    
    - Cherry-pick https://github.com/file/file/commit/483e7d8f1a5c3544bd42ead471813f8389fa7fc2
    
    Bug: https://bugs.gentoo.org/717264
    Package-Manager: Portage-2.3.98, Repoman-2.3.22
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 sys-apps/file/file-5.38-r1.ebuild                  | 142 +++++++++++++++++++++
 ...3-iaeiaeiaeiae-Do-as-the-comment-says-and.patch |  40 ++++++
 ...ble-bit-is-only-set-when-DF_1_PIE-bit-is-.patch |  29 +++++
 ...le-5.38-td-is-for-ptrdiff_t-not-for-off_t.patch |  27 ++++
 4 files changed, 238 insertions(+)
Comment 2 Thomas Deutschmann (RETIRED) gentoo-dev 2020-04-12 23:29:29 UTC
Wondering if the revert of https://github.com/file/file/commit/24c9c086cd7c55b7b0a003a145b32466468e2608 will cause some new failures with gcc-9. Let's see...