Bug 22051 - zero terminator in the middle of glibc's .eh_frame
Summary: zero terminator in the middle of glibc's .eh_frame
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: 2.27
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 22048
  Show dependency treegraph
 
Reported: 2017-08-31 03:39 UTC by H.J. Lu
Modified: 2017-11-25 16:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
A patch (741 bytes, patch)
2017-08-31 04:30 UTC, H.J. Lu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2017-08-31 03:39:03 UTC
1997-09-21  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
    
            * elf/sofini.c [HAVE_DWARF2_UNWIND_INFO]: Supply termination for
            the frame unwind info section.
    
added

/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
   this would be the 'length' field in a real FDE.  */

typedef unsigned int ui32 __attribute__ ((mode (SI)));
static const ui32 __FRAME_END__[1]
  __attribute__ ((used, section (".eh_frame")))
  = { 0 };

to elf/sofini.c.  Since libc.so is created with

# gcc   -shared -static-libgcc ... elf/sofini.os .. -lgcc

The zero terminator is placed in the middle of glibc's .eh_frame due to object
files included from libgcc.a.   Do we still need it today?
Comment 1 H.J. Lu 2017-08-31 03:39:56 UTC
This is related to PR 22048.
Comment 2 H.J. Lu 2017-08-31 04:30:39 UTC
Created attachment 10379 [details]
A patch

I am testing this.
Comment 3 Sourceware Commits 2017-08-31 10:52:58 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22051/master has been created
        at  48db46049147d66176f2af3ed71e6ee48929fd64 (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=48db46049147d66176f2af3ed71e6ee48929fd64

commit 48db46049147d66176f2af3ed71e6ee48929fd64
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 30 21:26:53 2017 -0700

    Place $(elf-objpfx)sofini.os the last [BZ #22051]
    
    Since sofini.os terminates .eh_frame section, it should be placed the
    last.
    
    	[BZ #22051]
    	* Makerules (build-module-helper-objlist): Filter out
    	$(elf-objpfx)sofini.os.
    	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
    	needed.

-----------------------------------------------------------------------
Comment 4 Sourceware Commits 2017-08-31 11:07:01 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22051/master has been deleted
       was  48db46049147d66176f2af3ed71e6ee48929fd64

- Log -----------------------------------------------------------------
48db46049147d66176f2af3ed71e6ee48929fd64 Place $(elf-objpfx)sofini.os the last [BZ #22051]
-----------------------------------------------------------------------
Comment 5 Sourceware Commits 2017-08-31 11:07:20 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22051/master has been created
        at  953d46ebe8cf0bf24c78b7ab0306cd035d413411 (commit)

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=953d46ebe8cf0bf24c78b7ab0306cd035d413411

commit 953d46ebe8cf0bf24c78b7ab0306cd035d413411
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Aug 30 21:26:53 2017 -0700

    Place $(elf-objpfx)sofini.os last [BZ #22051]
    
    Since sofini.os terminates .eh_frame section, it should be placed last.
    
    	[BZ #22051]
    	* Makerules (build-module-helper-objlist): Filter out
    	$(elf-objpfx)sofini.os.
    	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
    	needed.

-----------------------------------------------------------------------
Comment 6 H.J. Lu 2017-08-31 11:33:04 UTC
Since libc.so is always built with --eh-frame-hdr, do we still need
ZERO terminator?
Comment 7 Andreas Schwab 2017-08-31 12:59:18 UTC
Due to float128 we now pull quite some stuff from libgcc.
Comment 8 Sourceware Commits 2017-08-31 13:29:34 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  ecd0747df388f3925d4839740b0abcf43d0a9fb2 (commit)
      from  5f0704b66cea73cf2ab148ec4cff645cc301fd8c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ecd0747df388f3925d4839740b0abcf43d0a9fb2

commit ecd0747df388f3925d4839740b0abcf43d0a9fb2
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 31 06:28:31 2017 -0700

    Place $(elf-objpfx)sofini.os last [BZ #22051]
    
    Since sofini.os terminates .eh_frame section, it should be placed last.
    
    	[BZ #22051]
    	* Makerules (build-module-helper-objlist): Filter out
    	$(elf-objpfx)sofini.os.
    	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
    	needed.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    8 ++++++++
 Makerules |    5 ++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Comment 9 H.J. Lu 2017-08-31 13:31:30 UTC
Fixed.
Comment 10 Sourceware Commits 2017-09-07 16:09:45 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.26/master has been updated
       via  dca8b177f6bb521638f4d8a845b4cb10348137c9 (commit)
      from  8a1adb593969e099604537804f594efe01e04f6f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=dca8b177f6bb521638f4d8a845b4cb10348137c9

commit dca8b177f6bb521638f4d8a845b4cb10348137c9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 31 06:28:31 2017 -0700

    Place $(elf-objpfx)sofini.os last [BZ #22051]
    
    Since sofini.os terminates .eh_frame section, it should be placed last.
    
    	[BZ #22051]
    	* Makerules (build-module-helper-objlist): Filter out
    	$(elf-objpfx)sofini.os.
    	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
    	needed.
    
    (cherry picked from commit ecd0747df388f3925d4839740b0abcf43d0a9fb2)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    8 ++++++++
 Makerules |    5 ++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Comment 11 Sourceware Commits 2017-09-07 16:44:36 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.25/master has been updated
       via  c71ddec7b314d4da5397508516983e0a9e831711 (commit)
      from  bc5ace67fe9823757532e0273f6c1cdfda065433 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c71ddec7b314d4da5397508516983e0a9e831711

commit c71ddec7b314d4da5397508516983e0a9e831711
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Aug 31 06:28:31 2017 -0700

    Place $(elf-objpfx)sofini.os last [BZ #22051]
    
    Since sofini.os terminates .eh_frame section, it should be placed last.
    
    	[BZ #22051]
    	* Makerules (build-module-helper-objlist): Filter out
    	$(elf-objpfx)sofini.os.
    	(build-shlib-objlist): Append $(elf-objpfx)sofini.os if it is
    	needed.
    
    (cherry picked from commit ecd0747df388f3925d4839740b0abcf43d0a9fb2)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    8 ++++++++
 Makerules |    5 ++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Comment 12 Sourceware Commits 2017-11-25 16:36:54 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr22051/master has been deleted
       was  953d46ebe8cf0bf24c78b7ab0306cd035d413411

- Log -----------------------------------------------------------------
953d46ebe8cf0bf24c78b7ab0306cd035d413411 Place $(elf-objpfx)sofini.os last [BZ #22051]
-----------------------------------------------------------------------