From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id E6E7420248 for ; Thu, 18 Apr 2019 15:16:20 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=W4n4Z zu6glGlh81kfwibvkeWHsj6eOyE6Vx5bsC/hD07cnY/mbst8iAuKvlf6l94p98zs 01t1ta10FnHslNF2Br7JZlpDOJ5R7csQWzCID0as7LxoFgfHGF0QFoS/lOmYAkGt jDrLNChLCgvX6NDVxtCE/NmZ20V1FfkpATaAF4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=46N6fRW+d5K awESAsHsOqopQoQg=; b=T9lrbMWWe7kT9ekMr4DrbeHyH/Gl+Nuc+QyjyLiVLb5 AWHmc5rrCaMukitb/BpVx8pkgYOY+zeuBgdVlKmajmahrvX9ST2Hd84b7bhoHQ2c IMoGLOQArqj/Xet1OUT/8zLdRF5WPVmQFpLxSZp75Fg8cR2T59FkjdsWkwJY06Rc = Received: (qmail 45272 invoked by alias); 18 Apr 2019 15:16:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 45136 invoked by uid 89); 18 Apr 2019 15:16:07 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mx1.suse.de From: Andreas Schwab To: Florian Weimer Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Avoid concurrency problem in ldconfig (bug 23973) References: <87bm13y11o.fsf@oldenburg2.str.redhat.com> <87zhonv08p.fsf@oldenburg2.str.redhat.com> X-Yow: C'MON, everybody!! I've flown in LESLIE GORE and two dozen KOSHER BUTCHERS! They'll be doing intricate MILITARY MANEUVERS to the soundtrack from "OKLAHOMA"!! Date: Thu, 18 Apr 2019 17:16:01 +0200 In-Reply-To: <87zhonv08p.fsf@oldenburg2.str.redhat.com> (Florian Weimer's message of "Thu, 18 Apr 2019 16:47:34 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain On Apr 18 2019, Florian Weimer wrote: > * Andreas Schwab: > >> On Apr 18 2019, Florian Weimer wrote: >> >>> * Andreas Schwab: >>> >>>> Use a unique name for the temporary file when updating the ld.so cache, so >>>> that two concurrent runs of ldconfig don't write to the same file. >>>> >>>> * elf/cache.c (save_cache): Use unique temporary name. >>>> (save_aux_cache): Likewise. >>> >>> The downside of this change is that if ldconfig is interrupted, the >>> temporary file never goes away. >>> >>> Ideally, we would use O_TMPFILE if supported by the (file) system, but >>> that can get quite involved. >> >> That shortens the window, but won't close it, since we need a name to >> pass to rename in any case. > > The difference is that with a fixed name, the next ldconfig run will use > the same name and rename, cleaning up. With a random, unique name, that > automatic cleanup is gone. O_TMPFILE won't change that. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."