From patchwork Thu Mar 23 16:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 66813 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F251385043C for ; Thu, 23 Mar 2023 16:33:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F251385043C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679589184; bh=cVvrD3FMBOdFM6w1H/ymJCuQmgnPZ0bbgdoIIjGSg+w=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FAEHcoNO7XWlg3eHPkfcXfpI3Ws5ckT5cm334IlkXnLzPgeeKxzDZMgTGaMowTvxh WPsicWnrWekDJTzgpO6QLE9gAKPJYCrTMSAgqGmgQNUEOdevPomwFvwZgqlgeYOecr r3R6jxtIok0jgU2ZK8pvhNe3tpl6CO7MRVzNhZTM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 4B60C3858CDB for ; Thu, 23 Mar 2023 16:32:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B60C3858CDB Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6EFA21FE09 for ; Thu, 23 Mar 2023 16:32:40 +0000 (UTC) Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 6E4A02C141 for ; Thu, 23 Mar 2023 16:32:40 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id 5B1464A0358; Thu, 23 Mar 2023 17:32:40 +0100 (CET) To: libc-alpha@sourceware.org Subject: [PATCH] _dl_map_object_from_fd: Remove unnecessary debugger notification in error path X-Yow: What a COINCIDENCE! I'm an authorized ``SNOOTS OF THE STARS'' dealer!! Date: Thu, 23 Mar 2023 17:32:40 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andreas Schwab via Libc-alpha From: Andreas Schwab Reply-To: Andreas Schwab Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "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);