From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by sourceware.org (Postfix) with ESMTPS id ACF6A394881B for ; Wed, 14 Apr 2021 18:12:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org ACF6A394881B Received: by mail-qt1-x836.google.com with SMTP id i6so6535899qti.10 for ; Wed, 14 Apr 2021 11:12:48 -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=mWbzniGHJgRevEJKI5RaHLkc/ylk3AFsH2flfSVaaRs=; b=csZKg9bK5ME4xNsi/YBX7auHOX6ETDHHhzwJZPa/2KXVm6Ry/sJsF6Htl4igSxkVZO wdTA7Aae57GEsFybJLOWO4AbvbTUuPKn0e9U/Ow4eaEkqTP4jYdXnFS9ek2wanIVhtgU C1br92dgGNRYjNMJvmeCAMEwTneFepX4H3DZtH/ljThJrTZDuh3m/NMJYS0GSFraQlCj 4Z7CvT4FU0ZagI2UmxIoBB1Q/1bVKz6Qm2LYvsqlgTktn5qUqhfWKRUYVGbr2DmxigQQ OGTtNbL2+0AvqJC8ufifmQdRa/hMUnLe3a2sHSyUtuSrOYyR4IGA8V6n6fX2vRRRqMox 94EQ== X-Gm-Message-State: AOAM531ydh47FJSi3WrzMQ+Q4M9x6PQ+f4PhNdzXnlgOkDSlqit6/gbs 6u0o+rbNlwckSeU4BhPzTylWRNZ4e3KixKdt X-Google-Smtp-Source: ABdhPJy6awxFpcxs3rOCj+GajkSEv8HfM4AvhdZuxOKbKDGFucEVo0ekqdRAqmpimjywCXzIBfAlpg== X-Received: by 2002:ac8:7ee3:: with SMTP id r3mr31362746qtc.77.1618423968266; Wed, 14 Apr 2021 11:12:48 -0700 (PDT) Received: from [192.168.1.132] ([177.194.41.149]) by smtp.gmail.com with ESMTPSA id 44sm100611qtb.38.2021.04.14.11.12.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Apr 2021 11:12:47 -0700 (PDT) Subject: Re: [PATCH v2 03/14] elf: Fix comments and logic in _dl_add_to_slotinfo To: libc-alpha@sourceware.org, Szabolcs Nagy References: <6b63f027658b2bbe41f2da374da0aff63a77647f.1618301209.git.szabolcs.nagy@arm.com> From: Adhemerval Zanella Message-ID: Date: Wed, 14 Apr 2021 15:12:45 -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: <6b63f027658b2bbe41f2da374da0aff63a77647f.1618301209.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: Wed, 14 Apr 2021 18:12:49 -0000 On 13/04/2021 05:18, Szabolcs Nagy via Libc-alpha wrote: > 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. > That commit ensures allocation in _dl_add_to_slotinfo happens before > the demarcation point in dlopen (it is called twice, first time is for > allocation only where dlopen can still be reverted on failure, then > second time actual dtv updates are done which then cannot fail). LGTM, the commit is more clear now. Reviewed-by: Adhemerval Zanella > > -- > v2: > - expanded the commit message a bit. > --- > 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")); > } >