<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/overlayfs/readdir.c, branch linux-4.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-09-01T09:11:59Z</updated>
<entry>
<title>ovl: proper cleanup of workdir</title>
<updated>2016-09-01T09:11:59Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2016-09-01T09:11:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eea2fb4851e9dcbab6b991aaf47e2e024f1f55a0'/>
<id>urn:sha1:eea2fb4851e9dcbab6b991aaf47e2e024f1f55a0</id>
<content type='text'>
When mounting overlayfs it needs a clean "work" directory under the
supplied workdir.

Previously the mount code removed this directory if it already existed and
created a new one.  If the removal failed (e.g. directory was not empty)
then it fell back to a read-only mount not using the workdir.

While this has never been reported, it is possible to get a non-empty
"work" dir from a previous mount of overlayfs in case of crash in the
middle of an operation using the work directory.

In this case the left over state should be discarded and the overlay
filesystem will be consistent, guaranteed by the atomicity of operations on
moving to/from the workdir to the upper layer.

This patch implements cleaning out any files left in workdir.  It is
implemented using real recursion for simplicity, but the depth is limited
to 2, because the worst case is that of a directory containing whiteouts
under "work".

Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs</title>
<updated>2016-05-28T00:14:05Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2016-05-28T00:14:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d102a56edba7a3f236454716fa09920e66772044'/>
<id>urn:sha1:d102a56edba7a3f236454716fa09920e66772044</id>
<content type='text'>
Pull vfs fixes from Al Viro:
 "Followups to the parallel lookup work:

   - update docs

   - restore killability of the places that used to take -&gt;i_mutex
     killably now that we have down_write_killable() merged

   - Additionally, it turns out that I missed a prerequisite for
     security_d_instantiate() stuff - -&gt;getxattr() wasn't the only thing
     that could be called before dentry is attached to inode; with smack
     we needed the same treatment applied to -&gt;setxattr() as well"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  switch -&gt;setxattr() to passing dentry and inode separately
  switch xattr_handler-&gt;set() to passing dentry and inode separately
  restore killability of old mutex_lock_killable(&amp;inode-&gt;i_mutex) users
  add down_write_killable_nested()
  update D/f/directory-locking
</content>
</entry>
<entry>
<title>Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs</title>
<updated>2016-05-27T23:44:39Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2016-05-27T23:44:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0121a32201dcc72933fb6019c41661e2f8a02fc5'/>
<id>urn:sha1:0121a32201dcc72933fb6019c41661e2f8a02fc5</id>
<content type='text'>
Pull overlayfs update from Miklos Szeredi:
 "The meat of this is a change to use the mounter's credentials for
  operations that require elevated privileges (such as whiteout
  creation).  This fixes behavior under user namespaces as well as being
  a nice cleanup"

* 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: Do d_type check only if work dir creation was successful
  ovl: update documentation
  ovl: override creds with the ones from the superblock mounter
</content>
</entry>
<entry>
<title>ovl: override creds with the ones from the superblock mounter</title>
<updated>2016-05-27T06:55:26Z</updated>
<author>
<name>Antonio Murdaca</name>
</author>
<published>2016-04-07T13:48:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3fe6e52f062643676eb4518d68cee3bc1272091b'/>
<id>urn:sha1:3fe6e52f062643676eb4518d68cee3bc1272091b</id>
<content type='text'>
In user namespace the whiteout creation fails with -EPERM because the
current process isn't capable(CAP_SYS_ADMIN) when setting xattr.

A simple reproducer:

$ mkdir upper lower work merged lower/dir
$ sudo mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merged
$ unshare -m -p -f -U -r bash

Now as root in the user namespace:

\# touch merged/dir/{1,2,3} # this will force a copy up of lower/dir
\# rm -fR merged/*

This ends up failing with -EPERM after the files in dir has been
correctly deleted:

unlinkat(4, "2", 0)                     = 0
unlinkat(4, "1", 0)                     = 0
unlinkat(4, "3", 0)                     = 0
close(4)                                = 0
unlinkat(AT_FDCWD, "merged/dir", AT_REMOVEDIR) = -1 EPERM (Operation not
permitted)

Interestingly, if you don't place files in merged/dir you can remove it,
meaning if upper/dir does not exist, creating the char device file works
properly in that same location.

This patch uses ovl_sb_creator_cred() to get the cred struct from the
superblock mounter and override the old cred with these new ones so that
the whiteout creation is possible because overlay is wrong in assuming that
the creds it will get with prepare_creds will be in the initial user
namespace.  The old cap_raise game is removed in favor of just overriding
the old cred struct.

This patch also drops from ovl_copy_up_one() the following two lines:

override_cred-&gt;fsuid = stat-&gt;uid;
override_cred-&gt;fsgid = stat-&gt;gid;

This is because the correct uid and gid are taken directly with the stat
struct and correctly set with ovl_set_attr().

Signed-off-by: Antonio Murdaca &lt;runcom@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>restore killability of old mutex_lock_killable(&amp;inode-&gt;i_mutex) users</title>
<updated>2016-05-26T04:13:25Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2016-05-26T04:05:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=002354112f1e3cc7400ef48b853aefb90e801588'/>
<id>urn:sha1:002354112f1e3cc7400ef48b853aefb90e801588</id>
<content type='text'>
The ones that are taking it exclusive, that is...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>parallel lookups: actual switch to rwsem</title>
<updated>2016-05-02T23:49:28Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2016-04-15T19:08:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9902af79c01a8e39bb99b922fa3eef6d4ea23d69'/>
<id>urn:sha1:9902af79c01a8e39bb99b922fa3eef6d4ea23d69</id>
<content type='text'>
ta-da!

The main issue is the lack of down_write_killable(), so the places
like readdir.c switched to plain inode_lock(); once killable
variants of rwsem primitives appear, that'll be dealt with.

lockdep side also might need more work

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ovl: rename is_merge to is_lowest</title>
<updated>2016-03-21T16:31:46Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2016-03-21T16:31:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=56656e960b555cb98bc414382566dcb59aae99a2'/>
<id>urn:sha1:56656e960b555cb98bc414382566dcb59aae99a2</id>
<content type='text'>
The 'is_merge' is an historical naming from when only a single lower layer
could exist.  With the introduction of multiple lower layers the meaning of
this flag was changed to mean only the "lowest layer" (while all lower
layers were being merged).

So now 'is_merge' is inaccurate and hence renaming to 'is_lowest'

Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>ovl: Ensure upper filesystem supports d_type</title>
<updated>2016-03-21T16:31:45Z</updated>
<author>
<name>Vivek Goyal</name>
</author>
<published>2016-02-22T14:28:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=45aebeaf4f67468f76bedf62923a576a519a9b68'/>
<id>urn:sha1:45aebeaf4f67468f76bedf62923a576a519a9b68</id>
<content type='text'>
In some instances xfs has been created with ftype=0 and there if a file
on lower fs is removed, overlay leaves a whiteout in upper fs but that
whiteout does not get filtered out and is visible to overlayfs users.

And reason it does not get filtered out because upper filesystem does
not report file type of whiteout as DT_CHR during iterate_dir().

So it seems to be a requirement that upper filesystem support d_type for
overlayfs to work properly. Do this check during mount and fail if d_type
is not supported.

Suggested-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>wrappers for -&gt;i_mutex access</title>
<updated>2016-01-22T23:04:28Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2016-01-22T20:40:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5955102c9984fa081b2d570cfac75c97eecf8f3b'/>
<id>urn:sha1:5955102c9984fa081b2d570cfac75c97eecf8f3b</id>
<content type='text'>
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&amp;inode-&gt;i_mutex).

Please, use those for access to -&gt;i_mutex; over the coming cycle
-&gt;i_mutex will become rwsem, with -&gt;lookup() done with it held
only shared.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ovl: check dentry positiveness in ovl_cleanup_whiteouts()</title>
<updated>2015-12-11T15:30:49Z</updated>
<author>
<name>Konstantin Khlebnikov</name>
</author>
<published>2015-11-16T15:44:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=84889d49335627bc770b32787c1ef9ebad1da232'/>
<id>urn:sha1:84889d49335627bc770b32787c1ef9ebad1da232</id>
<content type='text'>
This patch fixes kernel crash at removing directory which contains
whiteouts from lower layers.

Cache of directory content passed as "list" contains entries from all
layers, including whiteouts from lower layers. So, lookup in upper dir
(moved into work at this stage) will return negative entry. Plus this
cache is filled long before and we can race with external removal.

Example:
 mkdir -p lower0/dir lower1/dir upper work overlay
 touch lower0/dir/a lower0/dir/b
 mknod lower1/dir/a c 0 0
 mount -t overlay none overlay -o lowerdir=lower1:lower0,upperdir=upper,workdir=work
 rm -fr overlay/dir

Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt; # 3.18+
</content>
</entry>
</feed>
