public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
@ 2022-12-07 11:37 yagogl at protonmail dot com
  2022-12-08  9:08 ` [Bug libc/29864] " yagogl at protonmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: yagogl at protonmail dot com @ 2022-12-07 11:37 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 29864
           Summary: __libc_start_main() should obtain program headers
                    address (_dl_phdr) from the auxv, not the ELF header.
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: yagogl at protonmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Created attachment 14487
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14487&action=edit
A patch file with my proposed solution.

The ELF specification declares a field in the ELF header to contain the offset
inside the binary at which there will be found the program headers table:
phoff. Since a segment may see its in-memory size differ from its in-file size
(or the binary may have holes), in-memory offsets are bound to differ too from
their in-file counterparts, and hence we may commit an error using base + phoff
to find the address of the phdr's, failing miserably with a segmentation fault
with a perfectly valid ELF.
Given that the kernel so nicely provides this piece of information in the
auxiliar vector, I think it would be best to use it by default, recurring to
other ways only when this field is mysteriously ommited from it or there is no
auxiliar vector at all.

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

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

* [Bug libc/29864] __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
  2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
@ 2022-12-08  9:08 ` yagogl at protonmail dot com
  2022-12-08 16:20 ` adhemerval.zanella at linaro dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: yagogl at protonmail dot com @ 2022-12-08  9:08 UTC (permalink / raw)
  To: glibc-bugs

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

Yago Gutiérrez <yagogl at protonmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #14487|0                           |1
           is patch|                            |

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

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

* [Bug libc/29864] __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
  2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
  2022-12-08  9:08 ` [Bug libc/29864] " yagogl at protonmail dot com
@ 2022-12-08 16:20 ` adhemerval.zanella at linaro dot org
  2022-12-08 17:07 ` yagogl at protonmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2022-12-08 16:20 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg

--- Comment #1 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Patch looks ok. Ideally, we dl_phdr would be in relro section but we do not for
other globals. Could you send it to libc-alpha? All patches are discussed
there.

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

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

* [Bug libc/29864] __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
  2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
  2022-12-08  9:08 ` [Bug libc/29864] " yagogl at protonmail dot com
  2022-12-08 16:20 ` adhemerval.zanella at linaro dot org
@ 2022-12-08 17:07 ` yagogl at protonmail dot com
  2022-12-08 17:14 ` adhemerval.zanella at linaro dot org
  2023-01-12 16:55 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: yagogl at protonmail dot com @ 2022-12-08 17:07 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #2 from Yago Gutiérrez <yagogl at protonmail dot com> ---
Yes, it has already been sent to the mailing list, unless I made something
wrong... I don't know, this is my first time submitting a patch.

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

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

* [Bug libc/29864] __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
  2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
                   ` (2 preceding siblings ...)
  2022-12-08 17:07 ` yagogl at protonmail dot com
@ 2022-12-08 17:14 ` adhemerval.zanella at linaro dot org
  2023-01-12 16:55 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2022-12-08 17:14 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Yeah, I saw it now.

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

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

* [Bug libc/29864] __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header.
  2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
                   ` (3 preceding siblings ...)
  2022-12-08 17:14 ` adhemerval.zanella at linaro dot org
@ 2023-01-12 16:55 ` adhemerval.zanella at linaro dot org
  4 siblings, 0 replies; 6+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2023-01-12 16:55 UTC (permalink / raw)
  To: glibc-bugs

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

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |adhemerval.zanella at linaro dot o
                   |                            |rg
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |2.37

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.37.

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

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

end of thread, other threads:[~2023-01-12 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 11:37 [Bug libc/29864] New: __libc_start_main() should obtain program headers address (_dl_phdr) from the auxv, not the ELF header yagogl at protonmail dot com
2022-12-08  9:08 ` [Bug libc/29864] " yagogl at protonmail dot com
2022-12-08 16:20 ` adhemerval.zanella at linaro dot org
2022-12-08 17:07 ` yagogl at protonmail dot com
2022-12-08 17:14 ` adhemerval.zanella at linaro dot org
2023-01-12 16:55 ` adhemerval.zanella at linaro dot org

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).