From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E579EC11D00 for ; Thu, 20 Feb 2020 23:39:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6849208CD for ; Thu, 20 Feb 2020 23:39:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729330AbgBTXjr (ORCPT ); Thu, 20 Feb 2020 18:39:47 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:43782 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbgBTXjr (ORCPT ); Thu, 20 Feb 2020 18:39:47 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1j4vQ1-0006zU-4k; Thu, 20 Feb 2020 16:39:45 -0700 Received: from ip68-227-160-95.om.om.cox.net ([68.227.160.95] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.87) (envelope-from ) id 1j4vQ0-0006jR-EQ; Thu, 20 Feb 2020 16:39:44 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Al Viro Cc: Linus Torvalds , 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: <20200212200335.GO23230@ZenIV.linux.org.uk> <20200212203833.GQ23230@ZenIV.linux.org.uk> <20200212204124.GR23230@ZenIV.linux.org.uk> <87lfp7h422.fsf@x220.int.ebiederm.org> <87pnejf6fz.fsf@x220.int.ebiederm.org> <871rqpaswu.fsf_-_@x220.int.ebiederm.org> <20200220230758.GT23230@ZenIV.linux.org.uk> Date: Thu, 20 Feb 2020 17:37:44 -0600 In-Reply-To: <20200220230758.GT23230@ZenIV.linux.org.uk> (Al Viro's message of "Thu, 20 Feb 2020 23:07:58 +0000") Message-ID: <87mu9c7ruf.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=1j4vQ0-0006jR-EQ;;;mid=<87mu9c7ruf.fsf@x220.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=68.227.160.95;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX18cMc7gMcKxQtdSwR/g1EJXnhEFC3gu5r8= X-SA-Exim-Connect-IP: 68.227.160.95 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: Re: [PATCH 0/7] proc: Dentry flushing without proc_mnt X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: Al Viro writes: > On Thu, Feb 20, 2020 at 03:02:22PM -0800, Linus Torvalds wrote: >> On Thu, Feb 20, 2020 at 12:48 PM Eric W. Biederman >> wrote: >> > >> > Linus, does this approach look like something you can stand? >> >> A couple of worries, although one of them seem to have already been >> resolved by Al. >> >> I think the real gatekeeper should be Al in general. But other than >> the small comments I had, I think this might work just fine. >> >> Al? > > I'll need to finish RTFS there; I have initially misread that patch, > actually - Eric _is_ using that thing both for those directories > and for sysctl inodes. And the prototype for that machinery (the > one he'd pulled from proc_sysctl.c) is playing with pinning superblocks > way too much; for per-pid directories that's not an issue, but > for sysctl table removal you are very likely to hit a bunch of > evictees on the same superblock... I saw that was possible. If the broad strokes look correct I don't have a problem at all with optimizing for the case where many of the entries are for inodes on the same superblock. I just had enough other details on my mind I was afraid if I got a little more clever I would have introduced a typo somewhere. I wish I could limit the sysctl parts to just directories, but unfortunately the sysctl tables don't always give a guarantee that a directory is what will be removed. But sysctls do have one name per inode invarant like fat. There is no way to express a sysctl table that doesn't have that invariant. As for d_find_alias/d_invalidate. Just for completeness I wanted to write a loop: while (dentry = d_find_alias(inode)) { d_invalidate(dentry); dput(dentry); } Unfortunately that breaks on directories, because for directories d_find_alias turns into d_find_any_alias, and continues to return aliases even when they are unhashed. It might be nice to write a cousin of d_prune_aliases call it d_invalidate_aliases that just does that loop the correct way in dcache.c Eric