View Issue Details

IDProjectCategoryView StatusLast Update
0000093fileGeneralpublic2019-07-23 08:51
Reporteriaeiaeiaeiae@byom.de Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version5.37 
Summary0000093: file incorrectly recognizes -static-pie binaries
Descriptionfile recognizes binaries build with gcc using -static-pie as dynamically linked binaries.
Steps To Reproduce1. Create a simple hello word C program
2. Compile it using gcc -fPIE -static-pie -o test test.c
3. Run file on the resulting binary

Output:

test: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=4594afb38f3f60aaad10d08ab519fcaeae55ee70, for GNU/Linux 3.2.0, not stripped

It should actually be reported as statically linked, check with ldd:

$ ldd test
    statically linked

TagsNo tags attached.

Activities

christos

2019-07-21 09:05

manager   ~0003260

I can't reproduce this

[5:04am] 10020>cc -static -fPIE -pie hello.c -o hello
[5:04am] 10021>./file -m ../magic/magic.mgc ./hello
./hello: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=f864bee36ab81bd40145389b987e8fe6b6d92696, not stripped
[5:04am] 10022>./file --version
file-5.37
magic file from /usr/local/share/misc/magic

iaeiaeiaeiae@byom.de

2019-07-22 18:29

reporter   ~0003266

"-static -pie" and "-static-pie" are not the same thing. You need a relatively recent gcc for the latter https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=252034

I used gcc (GCC) 9.1.0.
testbin (806,560 bytes)

christos

2019-07-22 20:43

manager   ~0003267

I don't have an environment like that available. Can you just attach a binary?

iaeiaeiaeiae@byom.de

2019-07-23 08:51

reporter   ~0003268

The previous comment contained a binary.

https://bugs.astron.com/file_download.php?file_id=64&type=bug

Issue History

Date Modified Username Field Change
2019-07-17 17:52 iaeiaeiaeiae@byom.de New Issue
2019-07-21 09:04 christos Assigned To => christos
2019-07-21 09:04 christos Status new => assigned
2019-07-21 09:05 christos Status assigned => feedback
2019-07-21 09:05 christos Note Added: 0003260
2019-07-22 18:29 iaeiaeiaeiae@byom.de File Added: testbin
2019-07-22 18:29 iaeiaeiaeiae@byom.de Note Added: 0003266
2019-07-22 18:29 iaeiaeiaeiae@byom.de Status feedback => assigned
2019-07-22 20:43 christos Note Added: 0003267
2019-07-23 08:51 iaeiaeiaeiae@byom.de Note Added: 0003268