[PATCH 2/2] rtld: turn "Already zero" assumptions into asserts
Rolf Eike Beer
eb@emlix.com
Tue Sep 22 12:38:08 GMT 2020
H.J. Lu wrote:
> On Tue, Sep 22, 2020 at 5:13 AM Rolf Eike Beer <eb@emlix.com> wrote:
> > ---
> >
> > elf/rtld.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/elf/rtld.c b/elf/rtld.c
> > index 99d130cd1c..441d837095 100644
> > --- a/elf/rtld.c
> > +++ b/elf/rtld.c
> > @@ -1449,7 +1449,7 @@ of this helper program; chances are you did not
> > intend to run this program.\n\>
> > the shared object is already loaded. */
> >
> > _dl_rtld_libname.name = ((const char *) main_map->l_addr
> >
> > + ph->p_vaddr);
> >
> > - /* _dl_rtld_libname.next = NULL; Already zero. */
> > + assert(_dl_rtld_libname.next == NULL);
>
> Space after assert. Same applies to other changes.
> and there are
>
> rtld.c:static struct libname_list _dl_rtld_libname;
> rtld.c:static struct libname_list _dl_rtld_libname2;
>
> There is no need for assert of zero on static variables.
Except when by accident the .bss section is not behind the last PT_LOAD and
suddenly is not zeroed out anymore and it takes you a while to find out _what_
exactly is broken ;) But fine with me.
Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 313 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20200922/61f237cb/attachment.sig>
More information about the Libc-alpha
mailing list