[Bug 246960] file(1) does not report PIE binaries

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Jun 3 16:22:51 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246960

            Bug ID: 246960
           Summary: file(1) does not report PIE binaries
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs at FreeBSD.org
          Reporter: emaste at freebsd.org

Reproduction steps:
1. build a PIE (position independent executable) binary:

$ cc -fpie -pie -o hello ~/hello.c
$ ./hello
Hello, world

2. use file to determine the type:

$ file hello
hello: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), dynamically
linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 13.0 (1300087),
FreeBSD-style, with debug_info, not stripped

As of very recently we have a DF_1_PIE flag to indicate that this is a PIE
binary, not a DSO:

$ readelf -d hello

Dynamic section at offset 0xc20 contains 25 entries:
  Tag                Type                  Name/Value
 0x0000000000000001 NEEDED               Shared library: [libc.so.7]
 0x000000006ffffffb FLAGS_1              PIE

We should report something like "ELF 64-bit LSB position independent
executable..." from file/libmagic.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list