OpenCloudOS-Kernel/fs/overlayfs
Amir Goldstein 01b39dcc95 ovl: use inode_insert5() to hash a newly created inode
Currently, there is a small window where ovl_obtain_alias() can
race with ovl_instantiate() and create two different overlay inodes
with the same underlying real non-dir non-hardlink inode.

The race requires an adversary to guess the file handle of the
yet to be created upper inode and decode the guessed file handle
after ovl_creat_real(), but before ovl_instantiate().
This race does not affect overlay directory inodes, because those
are decoded via ovl_lookup_real() and not with ovl_obtain_alias().

This patch fixes the race, by using inode_insert5() to add a newly
created inode to cache.

If the newly created inode apears to already exist in cache (hashed
by the same real upper inode), we instantiate the dentry with the old
inode and drop the new inode, instead of silently not hashing the new
inode.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2018-05-31 11:06:12 +02:00
..
Kconfig ovl: Kconfig documentation fixes 2018-05-31 11:06:10 +02:00
Makefile ovl: encode pure upper file handles 2018-01-24 11:25:59 +01:00
copy_up.c ovl: clean up copy-up error paths 2018-05-31 11:06:11 +02:00
dir.c ovl: use inode_insert5() to hash a newly created inode 2018-05-31 11:06:12 +02:00
export.c ovl: Pass argument to ovl_get_inode() in a structure 2018-05-31 11:06:12 +02:00
inode.c ovl: use inode_insert5() to hash a newly created inode 2018-05-31 11:06:12 +02:00
namei.c ovl: Pass argument to ovl_get_inode() in a structure 2018-05-31 11:06:12 +02:00
overlayfs.h ovl: use inode_insert5() to hash a newly created inode 2018-05-31 11:06:12 +02:00
ovl_entry.h ovl: add support for "xino" mount and config options 2018-04-12 12:04:50 +02:00
readdir.c ovl: consistent d_ino for non-samefs with xino 2018-04-12 12:04:50 +02:00
super.c ovl: return dentry from ovl_create_real() 2018-05-31 11:06:11 +02:00
util.c ovl: constant st_ino for non-samefs with xino 2018-04-12 12:04:50 +02:00