public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Manuel Lauss <manuel.lauss@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	libc-alpha@sourceware.org,  Fangrui Song <maskray@google.com>
Subject: Re: segfaults in _dl_fixup since 4af6982
Date: Wed, 13 Oct 2021 16:51:06 +0200	[thread overview]
Message-ID: <CAOLZvyGUObnEKg4hByhTqFpNVnge2oWC8XbwMVwauUh+VeWuhA@mail.gmail.com> (raw)
In-Reply-To: <bfc6495a-b549-a292-fb13-b816b3503278@linaro.org>

This patch works on x64_64 now, the 32bit x86 build breaks.

Manuel

On Wed, Oct 13, 2021 at 4:41 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 13/10/2021 10:55, Manuel Lauss wrote:
> > Applied this patch on top of git head, still same error.
> >
> > Manuel
>
> Sigh, it seems I got the elf_get_dynamic_info() sideways.  Could you check
> this slight modified patch? It is x86_64 only for now.
>
> And I am puzzled why I am not seeing any issues in the environments I am
> checking...
>
> >
> > On Wed, Oct 13, 2021 at 3:47 PM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >>
> >>
> >> On 13/10/2021 08:56, Adhemerval Zanella wrote:
> >>>
> >>>
> >>> On 13/10/2021 08:44, Adhemerval Zanella wrote:
> >>>>
> >>>>
> >>>> On 13/10/2021 07:58, Adhemerval Zanella wrote:
> >>>>>
> >>>>>
> >>>>>> On 13 Oct 2021, at 06:19, Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> >>>>>>
> >>>>>> The 10/13/2021 08:42, Manuel Lauss via Libc-alpha wrote:
> >>>>>>> [resend with libc-alpha]
> >>>>>>> Hi Adhemerval,
> >>>>>>>
> >>>>>>> Your recent commit 4af6982e4c9fc465ffb7a54b794aaaa134241f05 ("elf: Fix
> >>>>>>> elf_get_dynamic_info definition")  causes a lot (but not all) of my
> >>>>>>> applications
> >>>>>>> to segfault:
> >>>>>>>
> >>>>>>> Program received signal SIGSEGV, Segmentation fault.
> >>>>>>> _dl_fixup (l=<optimized out>, reloc_arg=<optimized out>) at dl-runtime.c:146
> >>>>>>> 146       return elf_machine_fixup_plt (l, result, refsym, sym, reloc,
> >>>>>>> rel_addr, value);
> >>>>>>> (gdb) bt
> >>>>>>> #0  _dl_fixup (l=<optimized out>, reloc_arg=<optimized out>) at dl-runtime.c:146
> >>>>>>> #1  0x00007ffff7fe251a in _dl_runtime_resolve_xsavec () at
> >>>>>>> ../sysdeps/x86_64/dl-trampoline.h:126
> >>>>>>> #2  0x000055555555634e in main (argc=1, argv=0x7fffffffd568) at
> >>>>>>> iconvconfig.c:288
> >>>>>>>
> >>>>>>> Reverting the commit fixes the problem. Gcc, python, etc seem to be
> >>>>>>> not affected, while for example iconvconfig and openssh are.
> >>>>>>
> >>>>>> on aarch64 buildbot i see
> >>>>>>
> >>>>>> FAIL: nptl/test-cond-printers
> >>>>>> FAIL: nptl/test-condattr-printers
> >>>>>> FAIL: nptl/test-mutex-printers
> >>>>>> FAIL: nptl/test-mutexattr-printers
> >>>>>> FAIL: nptl/test-rwlock-printers
> >>>>>> FAIL: nptl/test-rwlockattr-printers
> >>>>>>
> >>>>>> and
> >>>>>>
> >>>>>> $ cat nptl/test-cond-printers.out
> >>>>>> Error: Response does not match the expected pattern.
> >>>>>> Command: start
> >>>>>> Expected pattern: main
> >>>>>> Response:  Temporary breakpoint 1 at 0xac4: file test-cond-printers.c, line 36.
> >>>>>> Starting program: /work/glibc-aarch64-linux/build/build/nptl/test-cond-printers
> >>>>>>
> >>>>>> Program received signal SIGSEGV, Segmentation fault.
> >>>>>> _dl_fixup (l=<optimized out>, reloc_arg=<optimized out>) at dl-runtime.c:146
> >>>>>> 146       return elf_machine_fixup_plt (l, result, refsym, sym, reloc, rel_addr, value);
> >>>>>> (gdb)
> >>>>>>
> >>>>>>
> >>>>>> it seems to be a bind-now pie where PLT relocs are not yet
> >>>>>> processed when __libc_start_main is called but PLTGOT is
> >>>>>> already marked readonly so _dl_fixup crashes.
> >>>>>
> >>>>> I will check this out.
> >>>>>
> >>>>
> >>>> I am trying to reproduce it on aarch64-linux-gnu without much success (using
> >>>> gcc 11.1.1 20210702 and ld 2.36.1.20210702). Neither ssh or iconvconfig fails
> >>>> when running through the built glibc (using ubuntu 21.04 one).
> >>>>
> >>>> Any idea on how to reproduce it?
> >>>>
> >>>
> >>> Sigh... I think this is another fallback of RTLD_BOOTSTRAP.  I fixed the
> >>> elf_get_dynamic_info(), but there are lot of more usage that changes
> >>> the semantic of the nested functions (specifically on elf/do-rel.h
> >>> and dl-machine.h).
> >>>
> >>> I will try to fix, I think we should define RTLD_BOOTSTRAP before the
> >>> fist dynamic-link.h in rtld.
> >>>
> >>
> >> Could you check if the attached patch fixes it?  The rtld.c now should get
> >> all the required function with the expected semantic (RTLD_BOOTSTRAP defined).

  reply	other threads:[~2021-10-13 14:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAOLZvyH+V0TokSzHumaxJF9JA=Kxoxh2NVr+ZZbdBD5qZ-urZg@mail.gmail.com>
2021-10-13  6:42 ` Fwd: " Manuel Lauss
2021-10-13  9:18   ` Szabolcs Nagy
2021-10-13 10:58     ` Adhemerval Zanella
2021-10-13 11:44       ` Adhemerval Zanella
2021-10-13 11:56         ` Adhemerval Zanella
2021-10-13 13:46           ` Adhemerval Zanella
2021-10-13 13:55             ` Manuel Lauss
2021-10-13 14:41               ` Adhemerval Zanella
2021-10-13 14:51                 ` Manuel Lauss [this message]
2021-10-13 15:12                   ` Adhemerval Zanella
2021-10-13 17:28                 ` Szabolcs Nagy
2021-10-13 18:15                   ` Adhemerval Zanella

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=CAOLZvyGUObnEKg4hByhTqFpNVnge2oWC8XbwMVwauUh+VeWuhA@mail.gmail.com \
    --to=manuel.lauss@gmail.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    --cc=szabolcs.nagy@arm.com \
    /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).