View Issue Details

IDProjectCategoryView StatusLast Update
0000028file[All Projects] Generalpublic2018-12-10 21:12
ReporteranonymousAssigned Tochristos 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.34 
Target VersionFixed in VersionHEAD 
Summary0000028: file reports a dynamically linked library as ELF 32-bit LSB pie executable instead of ELF 32-bit LSB shared object
Descriptionfile on the submitted file libtest_lib.so.0.8 created by cmake build on GNU/Hurd reports:

5.33-3 and 5.34-{1,2}:
ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV),
dynamically linked,
BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, with
debug_info, not stripped

5.29-3:
ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
dynamically linked,
BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, not stripped

Due to that one test fails.
Steps To ReproduceRun the cmake tests. Debian version 3.12.1-1
TagsNo tags attached.
Attach Tags

Activities

anonymous

2018-08-13 15:52

reporter  

libtest_lib.so.0.8 (5,100 bytes)

christos

2018-08-14 11:28

manager   ~0000052

Please download and run and unmodified version of file to reproduce. I am not sure where the 5.34.x comes from...

./file -m ../magic/magic.mgc libtest_lib.so.0.8
libtest_lib.so.0.8: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, with debug_info, not stripped

anonymous

2018-08-14 14:43

reporter   ~0000053

file 5.34-2 is from Debian (as all versions mentioned here: https://tracker.debian.org/pkg/file. Upstream releases downloaded from: ftp://ftp.astron.com/pub/file/
There are a number of patches applied though. Dunno yet if they change the output.

anonymous

2018-08-14 14:56

reporter   ~0000054

After downloading file-5.34.tar.gz and building:
LD_LIBRARY_PATH=./src/.libs/libmagic.so.1 src/.libs/file ../libtest_lib.so.0.8
../libtest_lib.so.0.8: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=dfa3ab0e1cc5aeb84dd5f655ef53977fb87b0aa1, with debug_info, not stripped
Same result with:
LD_LIBRARY_PATH=./src/.libs/libmagic.so.1 src/.libs/file -m ./magic/magic.mgc ../libtest_lib.so.0.8

christos

2018-08-14 15:12

manager   ~0000055

that is really curious now:
[11:11am] 125>./file -m ../magic/magic.mgc libtest_lib.so.0.8
libtest_lib.so.0.8: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, with debug_info, not stripped
[11:11am] 126>uname -a
Linux mb1 4.9.0-6-amd64 0000001 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
[11:11am] 127>cksum libtest_lib.so.0.8
1407326587 5100 libtest_lib.so.0.8

anonymous

2018-08-14 17:09

reporter   ~0000056

previous results were reported form a GNU/Hurd box:
uname -a
GNU hurd-sid 0.9 GNU-Mach 1.8+git20180728-486-dbg/Hurd-0.9 i686-AT386 GNU

GNU/Linux-amd64:
uname -a
Linux z97-4790k 4.9.0-2-amd64 0000001 SMP Debian 4.9.10-1 (2017-02-17) x86_64 GNU/Linux
file --version
file-5.34
magic file from /etc/magic:/usr/share/misc/magic
file ./libtest_lib.so.0.8
./libtest_lib.so.0.8: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, with debug_info, not stripped
wget .../ file-5.34.tar.gz
uncompresss; configure;make
 LD_LIBRARY_PATH=./src/.libs/libmagic.so.1 src/.libs/file ../libtest_lib.so.0.8
../libtest_lib.so.0.8: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=f7eb0213a2606a5e3b1bc46d369d2fc47db1d8c5, with debug_info, not stripped
Same result with:
LD_LIBRARY_PATH=./src/.libs/libmagic.so.1 src/.libs/file -m ./magic/magic.mgc ../libtest_lib.so.0.8

anonymous

2018-08-14 17:14

reporter   ~0000057

cksum ../libtest_lib.so.0.8
1407326587 5100 ../libtest_lib.so.0.8

anonymous

2018-08-15 14:19

reporter   ~0000058

Hi again. It seems like the difference is that the file generated by cmake for tests is executable on GNU/Hurd but not on GNU/Linux:
ls -l ../libtest_lib.so.0.8
-rwxr-xr-x 1 srs srs 7340 Aug 10 13:57 ../libtest_lib.so.0.8
file ../libtest_lib.so.0.8
../libtest_lib.so.0.8: ELF 32-bit LSB pie executable, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=dfa3ab0e1cc5aeb84dd5f655ef53977fb87b0aa1, with debug_info, not stripped

chmod -x ../libtest_lib.so.0.8
file ../libtest_lib.so.0.8
../libtest_lib.so.0.8: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=dfa3ab0e1cc5aeb84dd5f655ef53977fb87b0aa1, with debug_info, not stripped

from the rule: magic/Magdir/elf
16 leshort 3 ${x?pie executable:shared object},

The file I uploaded was probably stripped of the +x flag.

christos

2018-08-16 06:11

manager   ~0000060

Yes, well while I can remove the code that checks for the shared object being executable, the question is why does hurd installed libraries with the execute bit set :-)

anonymous

2018-08-16 08:01

reporter   ~0000061

Well, Hurd does not normally install shared libraries with the executable flag on. Only a few ones are executable. I don't know why they are really.
However, the library libtest_lib.so.0.8 was created by test code in cmake (Debian version 3.12.1-1)

christos

2018-08-16 11:14

manager   ~0000062

Isn't it better to file a bug with Hurd and ask them why some of the libraries are installed executable and others are not, plus fix the CMakefile not to add the execute bit?

For example running:
$ /lib/x86_64-linux-gnu/libc-2.24.so
GNU C Library (Debian GLIBC 2.24-11+deb9u3) stable release version 2.24, by Roland McGrath et al.
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 6.3.0 20170516.
Available extensions:
        crypt add-on version 2.1 by Michael Glad and others
        GNU Libidn by Simon Josefsson
        Native POSIX Threads Library by Ulrich Drepper et al
        BIND-8.2.3-T5B
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.

Is that a PIE binary or a shared object?

anonymous

2018-08-16 18:27

reporter   ~0000064

Well, some Linux libraries also have the executable flag set:
ls -l /lib/x86_64-linux-gnu/libc-2.27.so
-rwxr-xr-x 1 root root 1800248 Mar 3 11:47 /lib/x86_64-linux-gnu/libc-2.27.so
/lib/x86_64-linux-gnu/libc-2.27.so GNU C Library (Debian GLIBC 2.27-1) stable release version 2.27.
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 7.3.0.
libc ABIs: UNIQUE IFUNC
For bug reporting instructions, please see:
<http://www.debian.org/Bugs/>.

christos

2018-08-18 14:33

manager   ~0000065

Yes, the real question is should it? What's the reason or benefit? Should the installation be sloppy about it?

christos

2018-12-10 21:12

manager   ~0000108

This is not relevant anymore; the execute bit is not used anymore.

Issue History

Date Modified Username Field Change
2018-08-13 15:52 anonymous New Issue
2018-08-13 15:52 anonymous File Added: libtest_lib.so.0.8
2018-08-14 11:27 christos Assigned To => christos
2018-08-14 11:27 christos Status new => assigned
2018-08-14 11:28 christos Status assigned => feedback
2018-08-14 11:28 christos Note Added: 0000052
2018-08-14 14:43 anonymous Note Added: 0000053
2018-08-14 14:56 anonymous Note Added: 0000054
2018-08-14 15:12 christos Note Added: 0000055
2018-08-14 17:09 anonymous Note Added: 0000056
2018-08-14 17:14 anonymous Note Added: 0000057
2018-08-15 14:19 anonymous Note Added: 0000058
2018-08-16 06:11 christos Note Added: 0000060
2018-08-16 08:01 anonymous Note Added: 0000061
2018-08-16 11:14 christos Note Added: 0000062
2018-08-16 18:27 anonymous Note Added: 0000064
2018-08-18 14:33 christos Note Added: 0000065
2018-12-10 21:12 christos Status feedback => resolved
2018-12-10 21:12 christos Resolution open => fixed
2018-12-10 21:12 christos Fixed in Version => HEAD
2018-12-10 21:12 christos Note Added: 0000108