From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Adhemerval Zanella Newsgroups: gmane.comp.lib.glibc.alpha Subject: Re: [PATCH 3/3] Refactor atfork handlers Date: Tue, 20 Feb 2018 10:48:38 -0300 Message-ID: <2fc18517-d23d-a298-e458-88ceff1cfc33@linaro.org> References: <1518008967-8310-1-git-send-email-adhemerval.zanella@linaro.org> <1518008967-8310-3-git-send-email-adhemerval.zanella@linaro.org> <88a58530-092d-4daa-1096-97a1bf8e08ff@redhat.com> <7b71dd04-afd0-9ff0-79c3-3d47cbd77ee2@redhat.com> <4aad8145-b06f-4d95-315a-73d5f2253971@linaro.org> <9d8251a8-7604-9846-ebde-409786e2ebf4@redhat.com> <780cefa6-543f-1a04-4b4e-9059a30d211b@linaro.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1519134424 20392 195.159.176.226 (20 Feb 2018 13:47:04 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Feb 2018 13:47:04 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 Cc: libc-alpha@sourceware.org To: Florian Weimer Original-X-From: libc-alpha-return-90406-glibc-alpha=m.gmane.org@sourceware.org Tue Feb 20 14:47:00 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=BXN2FUmna9nCoslX IXk0hmKZiNUce25b95d+B5MpMeiKnQvxxhXGAUZUNrxEe/K33G+pRD8VUOwGnsUQ iWnHe875CVH/tjgJ0t8HdPjy6rKbbJbbLmkNIRP1wBwkWV7lj7bXHQXYACzEqw4f Eki8FOyV7oI7N1VA6TNV49iCoS4= 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:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=agDS83Xk1ExyPZvrIzQ3kA ms40Q=; b=r/KvfT20l+BlLOT9G3nTdTclZb+WBeDgv0YO85KH2/L24XlUszmwk8 17wLYqkxVhH3hy5dL8wi3XEI8b+/lVVcNdiojMRXIrYEhojAgHxec+4WJbSNs7Kp pN2r/gQ1mEbp6M0+gfVeaacAWpRiyrvIQEzWQZTl6qynZw3vM4A8Q= 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: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1307, HContent-Transfer-Encoding:8bit X-HELO: mail-qk0-f194.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jzViMMO9Lct6yjeDGw/LdpUvWyxO/xbrE/kcTUXjJZc=; b=Crs9wF23NnHEXQLF1ay5goJ1Jt8iYXZhHkdfhhZ/B9Cs5loEub1CwSJW4WFb7FfW7c wpTSHfA3DNmcMCUW2MxVJJNz22M5N52UG9M9JGkRxzYoVyY9M75gl23sRzpz9uvekh+i rp49KSWz0eio4x1LGTiKsz715DnclrN8dDi+V4pCqN4V8qyK9O38B9M+A1qAll0IA1rj Se3xaGOZRJ+YoL0hXLSKQlgfn2cA+5Z8mpvv2pxgYv3DNo9CFejtBMxdfenwlpvTzubP Y/uthOttCy2RbOD58FOMdECuozfhUQ56NBkOd2B79+wYgGO0sA1P/vhg9r5oGVn7vAbz rdUg== X-Gm-Message-State: APf1xPAMLyDYukwUpVpLKNV1DpRL+vVzQFDIwScjbuJDq4kKl/kPmGO4 brlxpNHfr5Upx9LX8/CzxNBMQRqOMSs= X-Google-Smtp-Source: AH8x2257K8JpITuVqlikWcLS7SDHjKRHONvB6z4rJwO1sbBrpD7Ke/idISdgVA0rLnMXzp5ly38A0w== X-Received: by 10.55.191.65 with SMTP id p62mr21117762qkf.88.1519134523421; Tue, 20 Feb 2018 05:48:43 -0800 (PST) In-Reply-To: Xref: news.gmane.org gmane.comp.lib.glibc.alpha:82738 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eo8Fy-0004WZ-JE for glibc-alpha@blaine.gmane.org; Tue, 20 Feb 2018 14:46:54 +0100 Received: (qmail 68170 invoked by alias); 20 Feb 2018 13:48:57 -0000 Received: (qmail 68087 invoked by uid 89); 20 Feb 2018 13:48:46 -0000 On 20/02/2018 10:42, Florian Weimer wrote: > On 02/20/2018 02:27 PM, Adhemerval Zanella wrote: >> I think it might occur with proposed implementation only if a callback tries to call >> pthread_atfork or fork itself.  It these scenario you have in mind? And should we >> really support them if this is the case? > > No. > > __libc_fork starts like this: > >   bool multiple_threads >     = THREAD_GETMEM (THREAD_SELF, header.multiple_threads); > >   __run_fork_handlers (atfork_run_prepare); > > And then acquires _IO_list_lock. > > I don't see anything which prevents concurrent registration of additional fork handlers between the first and second call to __run_fork_handlers. The atfork_run_prepare will instruct __run_fork_handlers to take the internal atfork_lock handler: void __run_fork_handlers (enum __run_fork_handler_type who) { struct fork_handler *runp; if (who == atfork_run_prepare) { lll_lock (atfork_lock, LLL_PRIVATE); And it will prevent to add new registration until either the parent or the child call __run_fork_handlers with either 'atfork_run_child' or 'atfork_run_parent' to release the lock. > > As I said, that shouldn't prevent inclusion of the current patch, but we need to fix this before 2.28, I think. > > Thanks, > Florian