Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6511250ybv; Wed, 12 Feb 2020 13:48:50 -0800 (PST) X-Google-Smtp-Source: APXvYqx8q37q6s7aQgSIK+gnh6sNsp/QV2ebjm5Dnis4uXcu8SE3NSX6uPdLEflFYWYOHSml8UEf X-Received: by 2002:aca:bb54:: with SMTP id l81mr779571oif.175.1581544130809; Wed, 12 Feb 2020 13:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581544130; cv=none; d=google.com; s=arc-20160816; b=pdWVPjanKfxpeUp6zeFW3lQbDv5yjwx+gaE40iQlX1iQ8xNg7aYgLNK7vBJC2+glng oIPjO0ztqZI+lrt6Yp8DQN/X72ayvSvbFte9OHaEo7XAGdZhve9iYn1I+T04Xeg09lJ9 y4s8ESQZb+RbNAE/SJDfpualblel64VJKX5CkKGHR1N8WeyF1mbgD/jCf67OQvd0dnwD IEZ6PFdpz8ZVlnq6Gnlfkoezx3gD0gnuTuRD0w8ed9vUunhSV34TXlcLcKll4WNoW8oW KIPT1eEFR233kDG1UyWy5TbjL5czFt1NpwVn6BFSwosOHBCnXVSdItirWHxYkXIBH+b9 h6bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from; bh=VwJxkjvZ4I9CuUGSO6IQV8xZS4cedZIzJDjbvDLoALg=; b=WB/ONig5JSgogIdMcyFWKf7yd32BgCtgrWf0B2jnQRlKSb5G/ySU5BXN8K/xcePqDK Qt/1tJPrfm75A35opaM+9IMHIhSe4Os3jxaqAq5Zl7rcA363NJZtNlW2wggl9T6VFbKD Zz+AMD4HUMjaPXWfeTSfNvVATaqF/Tq+50pd6QTeqhSVpEwg06xcawDqx+4j3T7MVMi/ jGEAm7m4iIXH2umO4Ha5xf+WvV9VgL5EZC1Bc4JtdtQt4LylNsTTkq+nI5aRjS+oN1w9 wJWNUbhlHtqbZ9KKfDtkUuoNqfvqNYl0xMpHKspymdPfzHykm6bgNwFwOmKNaqBcxuGN oAkQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si193499oir.69.2020.02.12.13.48.36; Wed, 12 Feb 2020 13:48:50 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xmission.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729147AbgBLVsc (ORCPT + 99 others); Wed, 12 Feb 2020 16:48:32 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:59594 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728447AbgBLVsc (ORCPT ); Wed, 12 Feb 2020 16:48:32 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1j1zrt-0001QL-Ry; Wed, 12 Feb 2020 14:48:25 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1j1zrr-0007IE-Re; Wed, 12 Feb 2020 14:48:25 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds Cc: Al Viro , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Oleg Nesterov , Solar Designer References: <20200210150519.538333-8-gladkov.alexey@gmail.com> <87v9odlxbr.fsf@x220.int.ebiederm.org> <20200212144921.sykucj4mekcziicz@comp-core-i7-2640m-0182e6> <87tv3vkg1a.fsf@x220.int.ebiederm.org> <87v9obipk9.fsf@x220.int.ebiederm.org> <20200212200335.GO23230@ZenIV.linux.org.uk> <20200212203833.GQ23230@ZenIV.linux.org.uk> <20200212204124.GR23230@ZenIV.linux.org.uk> Date: Wed, 12 Feb 2020 15:46:29 -0600 In-Reply-To: (Linus Torvalds's message of "Wed, 12 Feb 2020 13:02:40 -0800") Message-ID: <87lfp7h422.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1j1zrr-0007IE-Re;;;mid=<87lfp7h422.fsf@x220.int.ebiederm.org>;;;hst=in01.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19ygjuB60Kb6N9Sok9ZifBaf15XLQkzcfs= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sa03.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.3 required=8.0 tests=ALL_TRUSTED,BAYES_40, DCC_CHECK_NEGATIVE,T_TM2_M_HEADER_IN_MSG,XMSubLong autolearn=disabled version=3.4.2 X-Spam-Virus: No X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 BAYES_40 BODY: Bayes spam probability is 20 to 40% * [score: 0.2572] * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa03 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa03 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 1577 ms - load_scoreonly_sql: 0.02 (0.0%), signal_user_changed: 2.3 (0.1%), b_tie_ro: 1.60 (0.1%), parse: 0.64 (0.0%), extract_message_metadata: 11 (0.7%), get_uri_detail_list: 0.89 (0.1%), tests_pri_-1000: 12 (0.8%), tests_pri_-950: 1.00 (0.1%), tests_pri_-900: 0.82 (0.1%), tests_pri_-90: 21 (1.3%), check_bayes: 20 (1.3%), b_tokenize: 6 (0.4%), b_tok_get_all: 7 (0.5%), b_comp_prob: 1.59 (0.1%), b_tok_touch_all: 3.2 (0.2%), b_finish: 0.56 (0.0%), tests_pri_0: 174 (11.0%), check_dkim_signature: 0.38 (0.0%), check_dkim_adsp: 2.8 (0.2%), poll_dns_idle: 1342 (85.1%), tests_pri_10: 1.63 (0.1%), tests_pri_500: 1351 (85.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v8 07/11] proc: flush task dcache entries from all procfs instances X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > On Wed, Feb 12, 2020 at 12:41 PM Al Viro wrote: >> >> On Wed, Feb 12, 2020 at 08:38:33PM +0000, Al Viro wrote: >> > >> > Wait, I thought the whole point of that had been to allow multiple >> > procfs instances for the same userns? Confused... >> >> s/userns/pidns/, sorry > > Right, but we still hold the ref to it here... > > [ Looks more ] > > Oooh. No we don't. Exactly because we don't hold the lock, only the > rcu lifetime, the ref can go away from under us. I see what your > concern is. > > Ouch, this is more painful than I expected - the code flow looked so > simple. I really wanted to avoid a new lock during process shutdown, > because that has always been somewhat painful. The good news is proc_flush_task isn't exactly called from process exit. proc_flush_task is called during zombie clean up. AKA release_task. So proc_flush_task isn't called with any locks held, and it is called in a context where it can sleep. Further after proc_flush_task does it's thing the code goes and does "write_lock_irq(&task_list_lock);" So the code is definitely serialized to one processor already. What would be downside of having a mutex for a list of proc superblocks? A mutex that is taken for both reading and writing the list. Eric