[PATCH v2] ld.so: Decorate BSS mappings

Petr Malat oss@malat.biz
Tue Jan 28 10:06:04 GMT 2025


On Fri, Jan 24, 2025 at 11:22:47AM -0300, Adhemerval Zanella Netto wrote:
> The patch look ok, although I just realized that this will be always calculated
> even if glibc.mem.decorate_maps is not set (and currently is not a default
> option).
>
> I think it would be better to also check for
> TUNABLE_GET (glibc, mem, decorate_maps, int32_t, NULL) != 0 (maybe add a inline
> function on setvmaname like is_decorate_maps_enable):

I have refactored it a bit more to avoid assembling the name also when
the functionality is not present in the kernel.


>   if (is_decorate_maps_enable())
>     {
>       char bssname[ANON_VMA_NAME_MAX_LEN] = " glibc: .bss";
>       if (l->l_name != NULL && *l->l_name != '\0')
>         {
>            [...]
>         }
>       __set_vma_name ((void*)zeropage, zeroend - zeropage, bssname);
>     }
>
> > +                {
> > +                  int i = strlen(bssname), j = 0;
> > +                  int namelen = strlen(l->l_name);
>
> Minor style nits: space after function name ('strlen (...)' and no implicit
> checks (l->name != NULL).

ack


More information about the Libc-alpha mailing list