[RFC,v8,08/20] elf/dl-open.c: when creating a proxy check the libc_map in NS 0

Message ID 20210209171839.7911-9-vivek@collabora.com
State Superseded
Delegated to: Adhemerval Zanella Netto
Headers
Series Implementation of RTLD_SHARED for dlmopen |

Commit Message

Vivek Dasmohapatra Feb. 9, 2021, 5:18 p.m. UTC
  The libc_already_loaded check normally considers the libc_map entry
in GL(dl_ns)[args->nsid].libc_map.

This is not correct for proxies, which use the libc_map from
the default namespace (as proxies are dummy entries that point
to the base namespace via their l_real members).
---
 elf/dl-open.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Adhemerval Zanella Feb. 15, 2021, 5:55 p.m. UTC | #1
On 09/02/2021 14:18, Vivek Das Mohapatra via Libc-alpha wrote:
> The libc_already_loaded check normally considers the libc_map entry
> in GL(dl_ns)[args->nsid].libc_map.
> 
> This is not correct for proxies, which use the libc_map from
> the default namespace (as proxies are dummy entries that point
> to the base namespace via their l_real members).
> ---
>  elf/dl-open.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/elf/dl-open.c b/elf/dl-open.c
> index dc4b386559..096aa4c680 100644
> --- a/elf/dl-open.c
> +++ b/elf/dl-open.c
> @@ -568,6 +568,7 @@ dl_open_worker (void *a)
>      {
>        proxy_ns = args->nsid;
>        args->nsid = LM_ID_BASE;
> +      args->libc_already_loaded = GL(dl_ns)[LM_ID_BASE].libc_map != NULL;
>      }
>  
>    /* It was already open.  */
> 

Ok.
  

Patch

diff --git a/elf/dl-open.c b/elf/dl-open.c
index dc4b386559..096aa4c680 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -568,6 +568,7 @@  dl_open_worker (void *a)
     {
       proxy_ns = args->nsid;
       args->nsid = LM_ID_BASE;
+      args->libc_already_loaded = GL(dl_ns)[LM_ID_BASE].libc_map != NULL;
     }
 
   /* It was already open.  */