Re: overlayfs vs. fscrypt
From: Eric Biggers
Date: Wed Mar 13 2019 - 15:43:19 EST
On Wed, Mar 13, 2019 at 07:19:46PM +0000, Al Viro wrote:
> On Wed, Mar 13, 2019 at 09:44:33AM -0700, Eric Biggers wrote:
>
> > > Just to make sure - you do realize that ban on multiple dentries refering
> > > to the same directory inode is *NOT* conditional upon those dentries being
> > > hashed, right?
> >
> > Isn't this handled by d_splice_alias() already, by moving the old dentry to the
> > new name?
>
> ... which means that if somebody without the key chdirs into subdirectory
> they only see by encrypted name and waits for proper owner to look it up,
> they suddenly see it by _un_encrypted name. Or does O_PATH open, for
> that matter, so exec permissions on that thing are not required.
Is there a real problem here? After the key is added, the filenames are
supposed to be shown in plaintext, not ciphertext. This is intrinsic to the
fact that we don't support both "views" at the same time. Either the directory
has the key or it does not.
If someone is using ciphertext view (e.g. doing a directory traversal)
concurrently with the key being added, that can certainly break things. But the
ciphertext view only allows a very restricted set of actions such as deleting
files. And if such actions are necessary, the system userspace is meant to be
designed in such a way that adding the key can't race with it.
- Eric