public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] _dl_map_object_from_fd: Remove unnecessary debugger notification in error path
@ 2023-03-23 16:32 Andreas Schwab
  2023-03-24 11:20 ` Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2023-03-23 16:32 UTC (permalink / raw)
  To: libc-alpha

After commit ed3ce71f5c ("elf: Move la_activity (LA_ACT_ADD) after
_dl_add_to_namespace_list() (BZ #28062)") it is no longer necessary to
reset the debugger state in the error case, since the debugger
notification only happens after no more errors can occur.
---
 elf/dl-load.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index fcb39a78d4..9a0e40c0e9 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -951,8 +951,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
   /* Initialize to keep the compiler happy.  */
   const char *errstring = NULL;
   int errval = 0;
-  struct r_debug *r = _dl_debug_update (nsid);
-  bool make_consistent = false;
 
   /* Get file information.  To match the kernel behavior, do not fill
      in this information for the executable in case of an explicit
@@ -984,14 +982,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
 	    free ((void *) l->l_phdr);
 	  free (l);
 	  free (realname);
-
-	  if (make_consistent && r != NULL)
-	    {
-	      r->r_state = RT_CONSISTENT;
-	      _dl_debug_state ();
-	      LIBC_PROBE (map_failed, 2, nsid, r);
-	    }
-
 	  _dl_signal_error (errval, name, NULL, errstring);
 	}
 
@@ -1494,6 +1484,7 @@ cannot enable executable stack as shared object requires");
   _dl_add_to_namespace_list (l, nsid);
 
   /* Signal that we are going to add new objects.  */
+  struct r_debug *r = _dl_debug_update (nsid);
   if (r->r_state == RT_CONSISTENT)
     {
 #ifdef SHARED
@@ -1510,7 +1501,6 @@ cannot enable executable stack as shared object requires");
       r->r_state = RT_ADD;
       _dl_debug_state ();
       LIBC_PROBE (map_start, 2, nsid, r);
-      make_consistent = true;
     }
   else
     assert (r->r_state == RT_ADD);
-- 
2.40.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] _dl_map_object_from_fd: Remove unnecessary debugger notification in error path
  2023-03-23 16:32 [PATCH] _dl_map_object_from_fd: Remove unnecessary debugger notification in error path Andreas Schwab
@ 2023-03-24 11:20 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2023-03-24 11:20 UTC (permalink / raw)
  To: Andreas Schwab via Libc-alpha; +Cc: Andreas Schwab

* Andreas Schwab via Libc-alpha:

> After commit ed3ce71f5c ("elf: Move la_activity (LA_ACT_ADD) after
> _dl_add_to_namespace_list() (BZ #28062)") it is no longer necessary to
> reset the debugger state in the error case, since the debugger
> notification only happens after no more errors can occur.

This cleanup looks good to me.  Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-24 11:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 16:32 [PATCH] _dl_map_object_from_fd: Remove unnecessary debugger notification in error path Andreas Schwab
2023-03-24 11:20 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).