From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-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-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.1 spammy=HX-Languages-Length:1201 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 15:20:00 -0000 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 X-SW-Source: 2019-04/txt/msg00455.txt.bz2 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."