dlopen: skip debugger notification for DSO loaded from sprof (bug 30258)

Message ID mvm355vwhpx.fsf@suse.de
State Superseded
Headers
Series dlopen: skip debugger notification for DSO loaded from sprof (bug 30258) |

Checks

Context Check Description
dj/TryBot-apply_patch fail Patch failed to apply to master at the time it was sent
dj/TryBot-32bit fail Patch series failed to apply

Commit Message

Andreas Schwab March 23, 2023, 4:33 p.m. UTC
  Avoid inconsistent state in the debugger interface.
---
 elf/dl-load.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Florian Weimer March 24, 2023, 11:18 a.m. UTC | #1
* Andreas Schwab via Libc-alpha:

> Avoid inconsistent state in the debugger interface.
> ---
>  elf/dl-load.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index 9a0e40c0e9..39c63ff1b3 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1483,6 +1483,10 @@ cannot enable executable stack as shared object requires");
>    /* Now that the object is fully initialized add it to the object list.  */
>    _dl_add_to_namespace_list (l, nsid);
>  
> +  /* Skip auditing and debugger notification when called from 'sprof'.  */
> +  if (mode & __RTLD_SPROF)
> +    return l;
> +
>    /* Signal that we are going to add new objects.  */
>    struct r_debug *r = _dl_debug_update (nsid);
>    if (r->r_state == RT_CONSISTENT)

Can we add a test for this?  Thanks.
  

Patch

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 9a0e40c0e9..39c63ff1b3 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1483,6 +1483,10 @@  cannot enable executable stack as shared object requires");
   /* Now that the object is fully initialized add it to the object list.  */
   _dl_add_to_namespace_list (l, nsid);
 
+  /* Skip auditing and debugger notification when called from 'sprof'.  */
+  if (mode & __RTLD_SPROF)
+    return l;
+
   /* Signal that we are going to add new objects.  */
   struct r_debug *r = _dl_debug_update (nsid);
   if (r->r_state == RT_CONSISTENT)