public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/28676] p_align on PT_LOAD segment in DSO isn't honored
Date: Wed, 15 Dec 2021 22:25:25 +0000	[thread overview]
Message-ID: <bug-28676-131-KThUfmPrfo@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28676-131@http.sourceware.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
Linker may set p_align of a PT_LOAD segment larger than p_align of the
first PT_LOAD segment to satisfy a section alignment:

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 10 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000834 0x0000000000000834  R E    0x1000
  LOAD           0x0000000000000e00 0x0000000000001e00 0x0000000000001e00
                 0x0000000000000230 0x0000000000000230  RW     0x1000
  LOAD           0x0000000000400000 0x0000000000400000 0x0000000000400000
                 0x0000000000000004 0x0000000000000008  RW     0x400000
...

 Section to Segment mapping:
  Segment Sections...
   00     .note.gnu.property .note.gnu.build-id .gnu.hash .dynsym .dynstr
.gnu.v
ersion .gnu.version_r .rela.dyn .rela.plt .init .plt .plt.got .text .fini
.rodat
a .eh_frame_hdr .eh_frame
   01     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt
   02     .data .bss

We should align the first PT_LOAD segment to the maximum p_align of all
PT_LOAD segments, similar to the kernel commit:

commit ce81bb256a224259ab686742a6284930cbe4f1fa
Author: Chris Kennelly <ckennelly@google.com>
Date:   Thu Oct 15 20:12:32 2020 -0700

    fs/binfmt_elf: use PT_LOAD p_align values for suitable start address

A patch with a testcase is posted at

https://sourceware.org/pipermail/libc-alpha/2021-December/134219.html

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

  parent reply	other threads:[~2021-12-15 22:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-08 23:51 [Bug dynamic-link/28676] New: " hjl.tools at gmail dot com
2021-12-09  1:11 ` [Bug dynamic-link/28676] " hjl.tools at gmail dot com
2021-12-10 19:45 ` hjl.tools at gmail dot com
2021-12-13 15:00 ` fweimer at redhat dot com
2021-12-13 15:00 ` fweimer at redhat dot com
2021-12-13 15:02 ` fweimer at redhat dot com
2021-12-13 23:36 ` sam at gentoo dot org
2021-12-14  5:31 ` i at maskray dot me
2021-12-15 22:25 ` hjl.tools at gmail dot com [this message]
2022-01-05 13:32 ` hjl.tools at gmail dot com
2022-01-05 13:32 ` hjl.tools at gmail dot com
2022-01-21 19:43 ` cvs-commit at gcc dot gnu.org
2022-01-24 14:52 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28676-131-KThUfmPrfo@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).