diff mbox series

[v2] elf: Replace nsid with args.nsid [BZ #27609]

Message ID 20210930182311.3718571-1-hjl.tools@gmail.com
State Committed
Commit 1e1ecea62e899acb58c3fdf3b320a0833ddd0dff
Headers show
Series [v2] elf: Replace nsid with args.nsid [BZ #27609] | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

H.J. Lu Sept. 30, 2021, 6:23 p.m. UTC
do_dlopen calls _dl_open with nsid == __LM_ID_CALLER (-2), which calls
dl_open_worker with args.nsid = nsid.  dl_open_worker updates args.nsid
if it is __LM_ID_CALLER.  After dl_open_worker returns, use args.nsid
instead of nsid.  This fixes BZ #27609.
---
 elf/dl-open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Florian Weimer Sept. 30, 2021, 6:27 p.m. UTC | #1
* H. J. Lu:

> do_dlopen calls _dl_open with nsid == __LM_ID_CALLER (-2), which calls
> dl_open_worker with args.nsid = nsid.  dl_open_worker updates args.nsid
> if it is __LM_ID_CALLER.  After dl_open_worker returns, use args.nsid
> instead of nsid.  This fixes BZ #27609.
> ---
>  elf/dl-open.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elf/dl-open.c b/elf/dl-open.c
> index a25443f6d1..5295e931b0 100644
> --- a/elf/dl-open.c
> +++ b/elf/dl-open.c
> @@ -886,7 +886,7 @@ no more namespaces available for dlmopen()"));
>        /* Avoid keeping around a dangling reference to the libc.so link
>  	 map in case it has been cached in libc_map.  */
>        if (!args.libc_already_loaded)
> -	GL(dl_ns)[nsid].libc_map = NULL;
> +	GL(dl_ns)[args.nsid].libc_map = NULL;
>  
>        /* Remove the object from memory.  It may be in an inconsistent
>  	 state if relocation failed, for example.  */

Patch looks okay.  But could you reference the fixed commit in the
commit message?

Thanks,
Florian
H.J. Lu Sept. 30, 2021, 6:36 p.m. UTC | #2
On Thu, Sep 30, 2021 at 11:27 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > do_dlopen calls _dl_open with nsid == __LM_ID_CALLER (-2), which calls
> > dl_open_worker with args.nsid = nsid.  dl_open_worker updates args.nsid
> > if it is __LM_ID_CALLER.  After dl_open_worker returns, use args.nsid
> > instead of nsid.  This fixes BZ #27609.
> > ---
> >  elf/dl-open.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/elf/dl-open.c b/elf/dl-open.c
> > index a25443f6d1..5295e931b0 100644
> > --- a/elf/dl-open.c
> > +++ b/elf/dl-open.c
> > @@ -886,7 +886,7 @@ no more namespaces available for dlmopen()"));
> >        /* Avoid keeping around a dangling reference to the libc.so link
> >        map in case it has been cached in libc_map.  */
> >        if (!args.libc_already_loaded)
> > -     GL(dl_ns)[nsid].libc_map = NULL;
> > +     GL(dl_ns)[args.nsid].libc_map = NULL;
> >
> >        /* Remove the object from memory.  It may be in an inconsistent
> >        state if relocation failed, for example.  */
>
> Patch looks okay.  But could you reference the fixed commit in the
> commit message?
>

Done.   Here is the patch I am checking in.

Thanks.
diff mbox series

Patch

diff --git a/elf/dl-open.c b/elf/dl-open.c
index a25443f6d1..5295e931b0 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -886,7 +886,7 @@  no more namespaces available for dlmopen()"));
       /* Avoid keeping around a dangling reference to the libc.so link
 	 map in case it has been cached in libc_map.  */
       if (!args.libc_already_loaded)
-	GL(dl_ns)[nsid].libc_map = NULL;
+	GL(dl_ns)[args.nsid].libc_map = NULL;
 
       /* Remove the object from memory.  It may be in an inconsistent
 	 state if relocation failed, for example.  */