Re: [PATCH][RFC] ovl_create_real(): make it cope with vfs_mkdir() safely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 12, 2018 at 8:13 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> On Sat, May 12, 2018 at 4:29 AM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>> [this one really, really needs a review by overlayfs folks;
>> all I can promise is that it compiles.]
>>
>> vfs_mkdir() may succeed and leave the dentry passed to it unhashed and
>> negative.  ovl_create_real() is the last caller breaking when that
>> happens.
>>
>> Make ovl_create_real() return the dentry to be used or ERR_PTR(-E...)
>> in case of error; usually that'll be the dentry passed to it, but
>> it might be a different one - result of lookup in case of vfs_mkdir()
>> leaving looking the inode, etc. up to the next lookup to come.
>>
>> In that case (as well as in case of an error), original dentry is
>> dropped.  That simplifies the callers.  Moreover, passing ERR_PTR()
>> as dentry leads to immediate return of the same ERR_PTR().  That
>> simplifies the callers even more.
>
> So in the beginning I had mixed feelings about the internal interface
> change.. it feels shady, but it does simplify the callers... but then
> I realized the correct way to simplify the callers would be a helper
> ovl_create_real_temp(), because in most of the call sites
> ovl_lookup_temp() is the argument to ovl_create_real(), so
> your patch shouldn't bother with it.
>
> With that in mind, I think your mkdir fix should go into ovl_do_mkdir(),
> hopefully, calling a vfs helper vfs_mkdir_hashed(), where all
> of the above, including ovl_create_real() pass in a struct dentry **
>
> I can prep and test the ovl patches if you like.
>

My tested version is at:
https://github.com/amir73il/linux/commits/ovl-fixes

The branch is based on a merge of your vfs/fixes and Miklos'
vfs/overlayfs-rorw branches. It includes also a patch for overlayfs
to use d_instantiate_new().

Will post the patches to overlayfs list shortly.

Thanks,
Amir.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux