diff mbox series

[v2] elf: Also compile dl-misc.os with $(rtld-early-cflags)

Message ID 20240425145425.309747-1-hjl.tools@gmail.com
State New
Headers show
Series [v2] elf: Also compile dl-misc.os with $(rtld-early-cflags) | expand

Commit Message

H.J. Lu April 25, 2024, 2:54 p.m. UTC
Also compile dl-misc.os with $(rtld-early-cflags) to avoid

Program received signal SIGILL, Illegal instruction.
0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
    endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
156	  bool positive = true;
(gdb) bt
 #0  0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
    endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
 #1  0x00007ffff7fdb1a9 in tunable_initialize (
    cur=cur@entry=0x7ffff7ffbc00 <tunable_list+2176>,
    strval=strval@entry=0x7fffffffe2c9 "2", len=len@entry=1)
    at dl-tunables.c:131
 #2  0x00007ffff7fdb3a2 in parse_tunables (valstring=<optimized out>)
    at dl-tunables.c:258
 #3  0x00007ffff7fdb5d9 in __GI___tunables_init (envp=0x7fffffffdd58)
    at dl-tunables.c:288
 #4  0x00007ffff7fe44c3 in _dl_sysdep_start (
    start_argptr=start_argptr@entry=0x7fffffffdcb0,
    dl_main=dl_main@entry=0x7ffff7fe5f80 <dl_main>)
    at ../sysdeps/unix/sysv/linux/dl-sysdep.c:110
 #5  0x00007ffff7fe5cae in _dl_start_final (arg=0x7fffffffdcb0) at rtld.c:494
 #6  _dl_start (arg=0x7fffffffdcb0) at rtld.c:581
 #7  0x00007ffff7fe4b38 in _start ()
(gdb)

when glibc is compiled with APX.
---
 elf/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Florian Weimer April 25, 2024, 3 p.m. UTC | #1
* H. J. Lu:

> Also compile dl-misc.os with $(rtld-early-cflags) to avoid
>
> Program received signal SIGILL, Illegal instruction.
> 0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
>     endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
> 156	  bool positive = true;
> (gdb) bt
>  #0  0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
>     endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
>  #1  0x00007ffff7fdb1a9 in tunable_initialize (
>     cur=cur@entry=0x7ffff7ffbc00 <tunable_list+2176>,
>     strval=strval@entry=0x7fffffffe2c9 "2", len=len@entry=1)
>     at dl-tunables.c:131
>  #2  0x00007ffff7fdb3a2 in parse_tunables (valstring=<optimized out>)
>     at dl-tunables.c:258
>  #3  0x00007ffff7fdb5d9 in __GI___tunables_init (envp=0x7fffffffdd58)
>     at dl-tunables.c:288
>  #4  0x00007ffff7fe44c3 in _dl_sysdep_start (
>     start_argptr=start_argptr@entry=0x7fffffffdcb0,
>     dl_main=dl_main@entry=0x7ffff7fe5f80 <dl_main>)
>     at ../sysdeps/unix/sysv/linux/dl-sysdep.c:110
>  #5  0x00007ffff7fe5cae in _dl_start_final (arg=0x7fffffffdcb0) at rtld.c:494
>  #6  _dl_start (arg=0x7fffffffdcb0) at rtld.c:581
>  #7  0x00007ffff7fe4b38 in _start ()
> (gdb)
>
> when glibc is compiled with APX.

Maybe mention setting GLIBC_TUNABLES as the trigger in the commit
message?

Otherwise:

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian
H.J. Lu April 25, 2024, 3:08 p.m. UTC | #2
On Thu, Apr 25, 2024 at 8:00 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > Also compile dl-misc.os with $(rtld-early-cflags) to avoid
> >
> > Program received signal SIGILL, Illegal instruction.
> > 0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
> >     endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
> > 156     bool positive = true;
> > (gdb) bt
> >  #0  0x00007ffff7fd36ea in _dl_strtoul (nptr=nptr@entry=0x7fffffffe2c9 "2",
> >     endptr=endptr@entry=0x7fffffffd728) at dl-misc.c:156
> >  #1  0x00007ffff7fdb1a9 in tunable_initialize (
> >     cur=cur@entry=0x7ffff7ffbc00 <tunable_list+2176>,
> >     strval=strval@entry=0x7fffffffe2c9 "2", len=len@entry=1)
> >     at dl-tunables.c:131
> >  #2  0x00007ffff7fdb3a2 in parse_tunables (valstring=<optimized out>)
> >     at dl-tunables.c:258
> >  #3  0x00007ffff7fdb5d9 in __GI___tunables_init (envp=0x7fffffffdd58)
> >     at dl-tunables.c:288
> >  #4  0x00007ffff7fe44c3 in _dl_sysdep_start (
> >     start_argptr=start_argptr@entry=0x7fffffffdcb0,
> >     dl_main=dl_main@entry=0x7ffff7fe5f80 <dl_main>)
> >     at ../sysdeps/unix/sysv/linux/dl-sysdep.c:110
> >  #5  0x00007ffff7fe5cae in _dl_start_final (arg=0x7fffffffdcb0) at rtld.c:494
> >  #6  _dl_start (arg=0x7fffffffdcb0) at rtld.c:581
> >  #7  0x00007ffff7fe4b38 in _start ()
> > (gdb)
> >
> > when glibc is compiled with APX.
>
> Maybe mention setting GLIBC_TUNABLES as the trigger in the commit
> message?
>

Done:

https://patchwork.sourceware.org/project/glibc/list/?series=33163

> Otherwise:
>
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
>
> Thanks,
> Florian
>
diff mbox series

Patch

diff --git a/elf/Makefile b/elf/Makefile
index 7a465b8b1a..e3f5242e44 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -170,6 +170,7 @@  CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
 CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
 
 # Add the requested compiler flags to the early startup code.
+CFLAGS-dl-misc.os += $(rtld-early-cflags)
 CFLAGS-dl-printf.os += $(rtld-early-cflags)
 CFLAGS-dl-setup_hash.os += $(rtld-early-cflags)
 CFLAGS-dl-sysdep.os += $(rtld-early-cflags)