public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/28780] New: --disable-default-pie doesn't work
@ 2022-01-13 23:11 hjl.tools at gmail dot com
  2022-01-15 19:23 ` [Bug build/28780] " hjl.tools at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-13 23:11 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

            Bug ID: 28780
           Summary: --disable-default-pie doesn't work
           Product: glibc
           Version: 2.35
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: carlos at redhat dot com, spoyarek at redhat dot com
  Target Milestone: ---

When glibc is configured with --disable-default-pie, glibc programs
and tests are still built with PIE.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
@ 2022-01-15 19:23 ` hjl.tools at gmail dot com
  2022-01-15 19:39 ` hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-15 19:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
One problem is

commit 91e92272caefad4b6156572fc41671dcbd93afe5
Author: Fangrui Song <maskray@google.com>
Date:   Fri Sep 24 09:36:32 2021 -0700

    i386: Port elf_machine_{load_address,dynamic} from x86-64

    This drops reliance on _GLOBAL_OFFSET_TABLE_[0] being the link-time
    address of _DYNAMIC.

    The code sequence length does not change.

    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

and

commit b37b75d269883a2c553bb7019a813094eb4e2dd1
Author: Fangrui Song <maskray@google.com>
Date:   Tue Aug 17 10:45:57 2021 -0700

    x86_64: Simplify elf_machine_{load_address,dynamic}

    and drop reliance on _GLOBAL_OFFSET_TABLE_[0] being the link-time
    address of _DYNAMIC. &__ehdr_start is a better way to get the load address.

    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

replaced _GLOBAL_OFFSET_TABLE_ reference with _DYNAMIC.  But linker won't
define _DYNAMIC for non-PIE static.  "gcc -static" leads to undefined
_DYNAMIC error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
  2022-01-15 19:23 ` [Bug build/28780] " hjl.tools at gmail dot com
@ 2022-01-15 19:39 ` hjl.tools at gmail dot com
  2022-01-17  3:57 ` siddhesh at sourceware dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-15 19:39 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to H.J. Lu from comment #1)
> One problem is
> 
> commit 91e92272caefad4b6156572fc41671dcbd93afe5
> Author: Fangrui Song <maskray@google.com>
> Date:   Fri Sep 24 09:36:32 2021 -0700
> 
>     i386: Port elf_machine_{load_address,dynamic} from x86-64
>     
>     This drops reliance on _GLOBAL_OFFSET_TABLE_[0] being the link-time
>     address of _DYNAMIC.
>     
>     The code sequence length does not change.
>     
>     Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
> 
> and
> 
> commit b37b75d269883a2c553bb7019a813094eb4e2dd1
> Author: Fangrui Song <maskray@google.com>
> Date:   Tue Aug 17 10:45:57 2021 -0700
> 
>     x86_64: Simplify elf_machine_{load_address,dynamic}
>     
>     and drop reliance on _GLOBAL_OFFSET_TABLE_[0] being the link-time
>     address of _DYNAMIC. &__ehdr_start is a better way to get the load
> address.
>     
>     Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
> 
> replaced _GLOBAL_OFFSET_TABLE_ reference with _DYNAMIC.  But linker won't
> define _DYNAMIC for non-PIE static.  "gcc -static" leads to undefined
> _DYNAMIC error.

Ignore this.  The problem is elsewhere.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
  2022-01-15 19:23 ` [Bug build/28780] " hjl.tools at gmail dot com
  2022-01-15 19:39 ` hjl.tools at gmail dot com
@ 2022-01-17  3:57 ` siddhesh at sourceware dot org
  2022-01-17 13:23 ` fweimer at redhat dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-01-17  3:57 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at sourceware dot org

--- Comment #3 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
(In reply to H.J. Lu from comment #0)
> When glibc is configured with --disable-default-pie, glibc programs
> and tests are still built with PIE.

I don't see this:

$ file iconv/iconvconfig
iconv/iconvconfig: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=aa0e3a52679c883c41e8919bf3c83d2042832abb, for GNU/Linux 3.2.0,
with debug_info, not stripped

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-17  3:57 ` siddhesh at sourceware dot org
@ 2022-01-17 13:23 ` fweimer at redhat dot com
  2022-01-17 13:41 ` [Bug build/28780] --disable-default-pie doesn't work on static programs hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: fweimer at redhat dot com @ 2022-01-17 13:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #4 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Siddhesh Poyarekar from comment #3)
> (In reply to H.J. Lu from comment #0)
> > When glibc is configured with --disable-default-pie, glibc programs
> > and tests are still built with PIE.
> 
> I don't see this:
> 
> $ file iconv/iconvconfig
> iconv/iconvconfig: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
> dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
> BuildID[sha1]=aa0e3a52679c883c41e8919bf3c83d2042832abb, for GNU/Linux 3.2.0,
> with debug_info, not stripped

Does your toolchain default to PIE?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work on static programs
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2022-01-17 13:23 ` fweimer at redhat dot com
@ 2022-01-17 13:41 ` hjl.tools at gmail dot com
  2022-01-17 13:58 ` siddhesh at sourceware dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-17 13:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|--disable-default-pie       |--disable-default-pie
                   |doesn't work                |doesn't work on static
                   |                            |programs

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Siddhesh Poyarekar from comment #3)
> (In reply to H.J. Lu from comment #0)
> > When glibc is configured with --disable-default-pie, glibc programs
> > and tests are still built with PIE.
> 
> I don't see this:
> 
> $ file iconv/iconvconfig
> iconv/iconvconfig: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
> dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
> BuildID[sha1]=aa0e3a52679c883c41e8919bf3c83d2042832abb, for GNU/Linux 3.2.0,
> with debug_info, not stripped

Only static programs are affected:

[hjl@gnu-tgl-2 build-x86_64-linux]$ file setjmp/tst-setjmp
setjmp/tst-setjmp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter
/export/build/gnu/tools-build/glibc-static/build-x86_64-linux/elf/ld.so,
BuildID[sha1]=6ab8089abe7c83d9915248c83475e4c823e1b630, for GNU/Linux 3.2.0,
with debug_info, not stripped
[hjl@gnu-tgl-2 build-x86_64-linux]$ file setjmp/tst-setjmp-static
setjmp/tst-setjmp-static: ELF 64-bit LSB pie executable, x86-64, version 1
(GNU/Linux), static-pie linked,
BuildID[sha1]=8a318ee34736192fe96c1f3b59b5aa4cf4395317, for GNU/Linux 3.2.0,
with debug_info, not stripped
[hjl@gnu-tgl-2 build-x86_64-linux]$ file elf/sln
elf/sln: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux),
static-pie linked, BuildID[sha1]=8120135c9ed1d318cf3b33f4dd0bc3f6d0aa58d4, for
GNU/Linux 3.2.0, with debug_info, not stripped
[hjl@gnu-tgl-2 build-x86_64-linux]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work on static programs
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2022-01-17 13:41 ` [Bug build/28780] --disable-default-pie doesn't work on static programs hjl.tools at gmail dot com
@ 2022-01-17 13:58 ` siddhesh at sourceware dot org
  2022-01-17 13:59 ` siddhesh at sourceware dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-01-17 13:58 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

--- Comment #6 from Siddhesh Poyarekar <siddhesh at sourceware dot org> ---
OK got it, thanks for clarifying.  I'll review your patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work on static programs
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2022-01-17 13:58 ` siddhesh at sourceware dot org
@ 2022-01-17 13:59 ` siddhesh at sourceware dot org
  2022-01-17 15:27 ` cvs-commit at gcc dot gnu.org
  2022-01-17 15:28 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: siddhesh at sourceware dot org @ 2022-01-17 13:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

Siddhesh Poyarekar <siddhesh at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|spoyarek at redhat dot com         |

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work on static programs
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2022-01-17 13:59 ` siddhesh at sourceware dot org
@ 2022-01-17 15:27 ` cvs-commit at gcc dot gnu.org
  2022-01-17 15:28 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-17 15:27 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

--- Comment #7 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ded3aeb2025c6686956eb10125aacb9a6e7c298e

commit ded3aeb2025c6686956eb10125aacb9a6e7c298e
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Jan 15 14:23:20 2022 -0800

    Properly handle --disable-default-pie [BZ #28780]

    When --disable-default-pie is used, all glibc programs and the testsuite
    should be built as position dependent executables (non-PIE), regardless
    if the build compiler supports PIE or static PIE.

    When --disable-default-pie is used, don't build static PIE by default.

    This fixes BZ #28780.

    Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug build/28780] --disable-default-pie doesn't work on static programs
  2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2022-01-17 15:27 ` cvs-commit at gcc dot gnu.org
@ 2022-01-17 15:28 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2022-01-17 15:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28780

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.35
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-17 15:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 23:11 [Bug build/28780] New: --disable-default-pie doesn't work hjl.tools at gmail dot com
2022-01-15 19:23 ` [Bug build/28780] " hjl.tools at gmail dot com
2022-01-15 19:39 ` hjl.tools at gmail dot com
2022-01-17  3:57 ` siddhesh at sourceware dot org
2022-01-17 13:23 ` fweimer at redhat dot com
2022-01-17 13:41 ` [Bug build/28780] --disable-default-pie doesn't work on static programs hjl.tools at gmail dot com
2022-01-17 13:58 ` siddhesh at sourceware dot org
2022-01-17 13:59 ` siddhesh at sourceware dot org
2022-01-17 15:27 ` cvs-commit at gcc dot gnu.org
2022-01-17 15:28 ` hjl.tools at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).