From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: DoS with unprivileged mounts Date: Wed, 14 Aug 2013 12:53:48 -0700 Message-ID: <8761v882wj.fsf@xmission.com> References: <520BD9E0.8050304@mit.edu> Mime-Version: 1.0 Content-Type: text/plain Cc: Miklos Szeredi , "Serge E. Hallyn" , Al Viro , Linux-Fsdevel , Kernel Mailing List To: Andy Lutomirski Return-path: In-Reply-To: <520BD9E0.8050304@mit.edu> (Andy Lutomirski's message of "Wed, 14 Aug 2013 12:26:24 -0700") Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Andy Lutomirski writes: > On 08/14/2013 10:42 AM, Miklos Szeredi wrote: >> There's a simple and effective way to prevent unlink(2) and rename(2) >> from operating on any file or directory by simply mounting something >> on it. In any mount instance in any namespace. >> >> Was this considered in the unprivileged mount design? >> >> The solution is also theoretically simple: mounts in unpriv namespaces >> are marked "volatile" and are dissolved on an unlink type operation. > > I'd actually prefer the reverse: unprivileged mounts don't prevent > unlink and rename. If the dentry goes away, then the mount could still > exist, sans underlying file. (This is already supported on network > filesystems.) Of course we do this in network filesystems by pretending the rename/unlink did not actually happen. The vfs insists that it be lied to instead of mirroring what actually happened. Again all of this is a question about efficient data structures and not really one of semantics. Can either semantic be implemented in such a way that it does not slow down the vfs? Eric