Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2777778imu; Fri, 23 Nov 2018 14:43:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/W97mVjoxpYt3/eq3yic1SeN21ebFQiHFMZ1JfWD/XhjoYwrVUB1TFl2O/3Q1QZqydKHcsH X-Received: by 2002:a17:902:968d:: with SMTP id n13mr17832580plp.109.1543012985052; Fri, 23 Nov 2018 14:43:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543012985; cv=none; d=google.com; s=arc-20160816; b=vK0mQV0CWacLP9IXf2lV9KzNjd+kYJJAOSqyGW1VnVZXPyGspoGe1D4fjDMXUI8xGM FvK2BHPdn7PmLhjUjfox/HnfAyR2ibTcqz82QD2tRa0M7kyKPSQpVJQLN5BIp4WGfoqg v1+uWAIZIpAl9cv1QSt4wCkfBOUcyMvCsm+9YsUcBO/JiTRt4Hu0cqYxSNgIlQoYfPgz D2cL3dh4h3hbT7y0BchF8jsBZtofl6m/znr7XlYdxmeaoFGH4JKsabgWp3dolVeSHHMO KvD4DfPbpslwt/g6Ka5Ddw0hfYYttDh6P4CZExyUSd0J/wPhfi2RSilb3EJXzONSwC/V AyAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mltPyKhZNnT4TzkMbZpI/dNqNVHMyzkfdwIxzSV93dI=; b=Vyph60x62xmQVWyPmlKbrXky1f7Dg6hitVP7bnJRKKpZal8A/lMWeIpDp0VulPE39r B1IL3SFkmKArBiVdEG6WaRClXx+N3Fts21PBs+62ceieRSFCyWCkzRp67D8GlsfeswEx 1yJ3PxA/h0h3AwdKs9TbfdcMGXtm4FtSvv6LAOcNI1cegIXWGFdSL40kXehuKzAL9yoY n3PPwC+XQQoXvzwq9l/pzKE59r3ou6s+cTZXmzUG5z2eprK3FWUM08gjGk3kf4mWLW6K qFPDQ8wxZ2/qbZdGK+eIW9mVM7ZKqhbRMnzd81rSCIvv1v5xkPqSIVZhQAdqeFHAu1Kh IwAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z126-v6si60056408pfb.280.2018.11.23.14.42.48; Fri, 23 Nov 2018 14:43:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437545AbeKWB5d (ORCPT + 99 others); Thu, 22 Nov 2018 20:57:33 -0500 Received: from 216-12-86-13.cv.mvl.ntelos.net ([216.12.86.13]:58394 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731345AbeKWB5c (ORCPT ); Thu, 22 Nov 2018 20:57:32 -0500 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1gPqj8-0004q2-00; Thu, 22 Nov 2018 15:17:10 +0000 Date: Thu, 22 Nov 2018 10:17:10 -0500 From: Rich Felker To: Florian Weimer Cc: Mathieu Desnoyers , carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , linux-kernel , linux-api Subject: Re: [RFC PATCH v4 1/5] glibc: Perform rseq(2) registration at nptl init and thread creation Message-ID: <20181122151710.GF23599@brightrain.aerifal.cx> References: <20181121183936.8176-1-mathieu.desnoyers@efficios.com> <20181122143603.GD23599@brightrain.aerifal.cx> <782067422.9852.1542899056778.JavaMail.zimbra@efficios.com> <87a7m1ywni.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87a7m1ywni.fsf@oldenburg.str.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 04:11:45PM +0100, Florian Weimer wrote: > * Mathieu Desnoyers: > > > Thoughts ? > > > > /* Unregister rseq TLS from kernel. */ > > if (has_rseq && __rseq_unregister_current_thread ()) > > abort(); > > > > advise_stack_range (pd->stackblock, pd->stackblock_size, (uintptr_t) pd, > > pd->guardsize); > > > > /* If the thread is detached free the TCB. */ > > if (IS_DETACHED (pd)) > > /* Free the TCB. */ > > __free_tcb (pd); > > Considering that we proceed to free the TCB, I really hope that all > signals are blocked at this point. (I have not checked this, though.) > > Wouldn't this address your concern about access to the rseq area? I'm not familiar with glibc's logic here, but for other reasons, I don't think freeing it is safe until the kernel task exit futex (set via clone or set_tid_address) has fired. I would guess __free_tcb just sets up for it to be reclaimable when this happens rather than immediately freeing it for reuse. Rich