From patchwork Sun Mar 26 00:24:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 1761189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=R/qocwa/; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PkcHW2pNHz1yXv for ; Sun, 26 Mar 2023 11:28:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CEC073858C33 for ; Sun, 26 Mar 2023 00:28:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEC073858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1679790500; bh=Q+zcvEEYo+obSm0K3nkffZ2x/Fv441wbcs7tmv68+T8=; h=Date:In-Reply-To:References:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=R/qocwa/Rlto3Oj7VA2lnMsJAZONP2kFKGwiV34Shpdh3VOpBuFXdjIr73z70AJj4 ncD4vMYJ14jPFzbGr/8MWW4T+yO8Av6u4RR+mOnpl3CKimQaL3fftDbu0J/DgTWhSy QP/XMe9CmvVXl3j+vlFibJbzR93NQEwrJPNpCoq0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by sourceware.org (Postfix) with ESMTPS id 829FD3858D20 for ; Sun, 26 Mar 2023 00:28:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 829FD3858D20 Received: by mail-pl1-x649.google.com with SMTP id l14-20020a170902f68e00b001a1a9a1d326so3460224plg.9 for ; Sat, 25 Mar 2023 17:28:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679790483; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Q+zcvEEYo+obSm0K3nkffZ2x/Fv441wbcs7tmv68+T8=; b=BoxmVqFkBTGE4Ok2QPeHE2q4o4jUAjtLyHWu9jotS7Yk6fkIDVnpVUUfA41YhGrYW0 CDSBkhsyZOvhW/Z8bU72bh7RfQTdriApqC5ANMz+p24jK8H9SJIM5Qsr3sN84CSzV6oD 5IuTFQ0ODKn/srYcDlY85pDAAOEQy1R3XfPfY7r6seciTcmE5h2P+uEWJmOdlixqA9CV YG3OQ4WgGwyN20OGkYp93BeM7iS8+BibqrDF2Iz/QnqMgKZcznok3eH2lo6/N8dGl299 0vf8brFB/fnMEwijfCiil7Yhktbv+ocfBJRG1d/Gua/2im01DFazQVnc88qDjg9RW0S+ NEHA== X-Gm-Message-State: AAQBX9eEuReANwKzi8cEOBuFEJYw3oCThOmYKOH5Tbw11MsknqFrdXIV Pe2iiw1sOdYw4X/pCIjlAd6IxpWW2qu5Cf5PUZf7ClogI7w7Y9V5+DP/Pc3IS//ATeK2eOPotu3 aTXugi0+LxIk3NoAdJQWcGskk0dg/tNI8aLzpRaIAC91r4ZEVuN7i5z+JbWwGHN6lD7chRgNppa LgtMY= X-Google-Smtp-Source: AKy350YNaKaTruF8UKXGTbLnz6NK/BLTkXAAyZsKyWTo2VWGmca1k5dC9TT20HJNq+4Wp+q7GJ1WoKDRvHzO1Y7CoA== X-Received: from elbrus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:12e9]) (user=ppluzhnikov job=sendgmr) by 2002:a63:c1f:0:b0:513:477e:5ccb with SMTP id b31-20020a630c1f000000b00513477e5ccbmr388245pgl.12.1679790483402; Sat, 25 Mar 2023 17:28:03 -0700 (PDT) Date: Sun, 26 Mar 2023 00:24:00 +0000 In-Reply-To: <87h6u8xz2y.fsf@mid.deneb.enyo.de> Mime-Version: 1.0 References: <87h6u8xz2y.fsf@mid.deneb.enyo.de> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog Message-ID: <20230326002358.1244787-1-ppluzhnikov@google.com> Subject: [PATCH] Minor: don't call _dl_debug_update (which can have side effects) inside assert To: libc-alpha@sourceware.org Cc: Paul Pluzhnikov , Florian Weimer , Andreas Schwab X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL 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: Paul Pluzhnikov via Libc-alpha From: Paul Pluzhnikov Reply-To: Paul Pluzhnikov Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" On Sat, Mar 25, 2023 at 3:09 PM Florian Weimer wrote: > This needs __attribute__ ((unused)) on r_state to support building > with -DNDEBUG (although I have not tested that). Thanks. Revised patch included. --- elf/dl-open.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/elf/dl-open.c b/elf/dl-open.c index 91a2d8a538..2d985e21d8 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -578,7 +578,9 @@ dl_open_worker_begin (void *a) if ((mode & RTLD_GLOBAL) && new->l_global == 0) add_to_global_update (new); - assert (_dl_debug_update (args->nsid)->r_state == RT_CONSISTENT); + const int r_state __attribute__ ((unused)) + = _dl_debug_update (args->nsid)->r_state; + assert (r_state == RT_CONSISTENT); return; } @@ -927,7 +929,9 @@ no more namespaces available for dlmopen()")); _dl_signal_exception (errcode, &exception, NULL); } - assert (_dl_debug_update (args.nsid)->r_state == RT_CONSISTENT); + const int r_state __attribute__ ((unused)) + = _dl_debug_update (args.nsid)->r_state; + assert (r_state == RT_CONSISTENT); /* Release the lock. */ __rtld_lock_unlock_recursive (GL(dl_load_lock));