From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81238 invoked by alias); 2 Dec 2019 16:07:14 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 81230 invoked by uid 89); 2 Dec 2019 16:07:14 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=activating, gained X-HELO: us-smtp-delivery-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575302831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=03SxwiHQqgWlrOGwhtXED8ycXkqFfCvXFDDvP5VmvZE=; b=Vf0/lA+R/6dyIFXqWkynSF2JVHbZFHs0aOPq4hUJWUdFGtP3wwFgHsld7n6pjpXyeW2+ze l6UDV3XFHePpH1He9BGYbC4cZhyLjUDG3Wkv8i/SmrCiBDvVeObiSTpDj8cmaAyJlEBAfZ WwP0ODfrqJx+Mq3CQpUBNi0SPQdCDbE= From: Florian Weimer To: libc-alpha@sourceware.org Subject: Re: [review v3] Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839] References: <20191115160205.9EEC928171@gnutoolchain-gerrit.osci.io> Date: Mon, 02 Dec 2019 16:07:00 -0000 In-Reply-To: <20191115160205.9EEC928171@gnutoolchain-gerrit.osci.io> (Florian Weimer's message of "Fri, 15 Nov 2019 11:02:04 -0500") Message-ID: <871rtmyams.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-12/txt/msg00056.txt.bz2 * Florian Weimer: > +/* Mark the objects as NODELETE if required. This is delayed until > + after dlopen failure is not possible, so that _dl_close can clean > + up objects if necessary. */ > +static void > +activate_nodelete (struct link_map *new, int mode) > +{ > + if (mode & RTLD_NODELETE || new->l_nodelete =3D=3D link_map_nodelete_p= ending) > + { > + if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_FILES)) > + _dl_debug_printf ("activating NODELETE for %s [%lu]\n", > + new->l_name, new->l_ns); > + new->l_nodelete =3D link_map_nodelete_active; > + } > + > + for (unsigned int i =3D 0; i < new->l_searchlist.r_nlist; ++i) > + { > + struct link_map *imap =3D new->l_searchlist.r_list[i]; > + if (imap->l_nodelete =3D=3D link_map_nodelete_pending) > + { > + if (__glibc_unlikely (GLRO (dl_debug_mask) & DL_DEBUG_FILES)) > + _dl_debug_printf ("activating NODELETE for %s [%lu]\n", > + imap->l_name, imap->l_ns); > + > + /* Only new objects should have set > + link_map_nodelete_pending. Existing objects should not > + have gained any new dependencies and therefore cannot > + reach NODELETE status. */ > + assert (!imap->l_init_called || imap->l_type !=3D lt_loaded); This assert is incorrect because the NODELETE markers actually go in the other direction (from new loaded libraries to their dependencies). I still need to write tests for this. But I can submit a patch for the removal of the assert immediately, if so desired. Thanks, Florian