From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by sourceware.org (Postfix) with ESMTPS id 25F0D385782C for ; Fri, 2 Apr 2021 20:50:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 25F0D385782C Received: by mail-qk1-x736.google.com with SMTP id v70so6267487qkb.8 for ; Fri, 02 Apr 2021 13:50:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kj/1k3j1oMvjQVwyXWWM4qHxVB37idupCiDa8X6HusI=; b=rJyOCA9BIcae7Ryol9feE7v9TViOLm24t570r4nF0PgQ0nZTxnrxxwtm0JXrnui/XH uqdhX4RKbsq/FSJp91ommcJBgftuDiqMDqUZ5AkiqX7Wi8AQaC011mhwxtBH5G5wKnGe VE7l0/khJ3GE4Fca/BhrB2wN+yI1SOYZV22bbZOHqUo+uGYaIXsH0tmOUzgVyfcAxg6b A9HP+R6iB47rbCndRMFZds/K5UNywvEawGZj1CT2CRYV3hjVtLTE/YWrFNqqLK9D43Dt Rbz74NetbHNQ358JkVoKr9zmdcd4/ADzbynBg6piny/g+/pFtH2TJv0Fch7bKp+WWjii dV8g== X-Gm-Message-State: AOAM5312XvSaU8RxPuo0ndQBDibBj/eMBMqeGEq+aC/mpnkWdEbDwQGj 66j/8rqWJizy7219hvTW43PwYJCTW8nKb0Qh X-Google-Smtp-Source: ABdhPJy5o8R+rc+VNjvvO/CztobXApkPIa+7L5R739XuBUBQeNnGNvw6FLNrVcmWa+lFH25LGZIs5g== X-Received: by 2002:a05:620a:2915:: with SMTP id m21mr14507346qkp.147.1617396625424; Fri, 02 Apr 2021 13:50:25 -0700 (PDT) Received: from [192.168.1.132] ([177.194.41.149]) by smtp.gmail.com with ESMTPSA id l12sm7158919qtx.77.2021.04.02.13.50.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Apr 2021 13:50:25 -0700 (PDT) Subject: Re: [PATCH 06/15] elf: Fix comments and logic in _dl_add_to_slotinfo To: Szabolcs Nagy , libc-alpha@sourceware.org References: <068770faf123b7c227f5f1e130812f7976e74cef.1613390045.git.szabolcs.nagy@arm.com> From: Adhemerval Zanella Message-ID: Date: Fri, 2 Apr 2021 17:50:23 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <068770faf123b7c227f5f1e130812f7976e74cef.1613390045.git.szabolcs.nagy@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Fri, 02 Apr 2021 20:50:28 -0000 On 15/02/2021 08:59, Szabolcs Nagy via Libc-alpha wrote: > From: Szabolcs Nagy > > Since > > commit a509eb117fac1d764b15eba64993f4bdb63d7f3c > Avoid late dlopen failure due to scope, TLS slotinfo updates [BZ #25112] > > the generation counter update is not needed in the failure path. It is not clear to me from just the commit reference why it would be safe to remove the GL(dl_tls_generation) update on _dl_add_to_slotinfo. The dl_open_worker calls update_tls_slotinfo which in turn call might call _dl_add_to_slotinfo *after* the demarcation point. Will it terminate the process? > --- > elf/dl-tls.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/elf/dl-tls.c b/elf/dl-tls.c > index 79b93ad91b..24d00c14ef 100644 > --- a/elf/dl-tls.c > +++ b/elf/dl-tls.c > @@ -998,16 +998,7 @@ _dl_add_to_slotinfo (struct link_map *l, bool do_add) > + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); > if (listp == NULL) > { > - /* We ran out of memory. We will simply fail this > - call but don't undo anything we did so far. The > - application will crash or be terminated anyway very > - soon. */ > - > - /* We have to do this since some entries in the dtv > - slotinfo array might already point to this > - generation. */ > - ++GL(dl_tls_generation); > - > + /* We ran out of memory while resizing the dtv slotinfo list. */ > _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\ > cannot create TLS data structures")); > } >