Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jun 2020 16:22:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 246960] file(1) does not report PIE binaries
Message-ID:  <bug-246960-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246960

            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@FreeBSD.org
          Reporter: emaste@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), dynamical=
ly
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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-246960-227>