<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/overlayfs, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-02-05T11:39:58Z</updated>
<entry>
<title>ovl: fix NULL pointer dereference in copy up warning</title>
<updated>2022-02-05T11:39:58Z</updated>
<author>
<name>Christoph Fritz</name>
</author>
<published>2022-01-12T18:33:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9c7f8a35c5a83740c0e3ea540b6ad145c50d79aa'/>
<id>urn:sha1:9c7f8a35c5a83740c0e3ea540b6ad145c50d79aa</id>
<content type='text'>
commit 4ee7e4a6c9b298da44029ed9ec8ed23ae49cc209 upstream.

This patch is fixing a NULL pointer dereference to get a recently
introduced warning message working.

Fixes: 5b0a414d06c3 ("ovl: fix filattr copy-up failure")
Signed-off-by: Christoph Fritz &lt;chf.fritz@googlemail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v5.15
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ovl: don't fail copy up if no fileattr support on upper</title>
<updated>2022-02-05T11:39:54Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2022-01-14T15:57:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=20842a8d93e3a595dbb49038588e4c994a500ccb'/>
<id>urn:sha1:20842a8d93e3a595dbb49038588e4c994a500ccb</id>
<content type='text'>
commit 94fd19752b28aa66c98e7991734af91dfc529f8f upstream.

Christoph Fritz is reporting that failure to copy up fileattr when upper
doesn't support fileattr or xattr results in a regression.

Return success in these failure cases; this reverts overlayfs to the old
behavior.

Add a pr_warn_once() in these cases to still let the user know about the
copy up failures.

Reported-by: Christoph Fritz &lt;chf.fritz@googlemail.com&gt;
Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
Cc: &lt;stable@vger.kernel.org&gt; # v5.15
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'ovl-update-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs</title>
<updated>2021-11-09T18:51:12Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2021-11-09T18:51:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1bdd629e5aa0e335504304be4208935948692549'/>
<id>urn:sha1:1bdd629e5aa0e335504304be4208935948692549</id>
<content type='text'>
Pull overlayfs updates from Miklos Szeredi:

 - Fix a regression introduced in the last cycle

 - Fix a use-after-free in the AIO path

 - Fix a bogus warning reported by syzbot

* tag 'ovl-update-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: fix filattr copy-up failure
  ovl: fix warning in ovl_create_real()
  ovl: fix use after free in struct ovl_aio_req
</content>
</entry>
<entry>
<title>ovl: fix filattr copy-up failure</title>
<updated>2021-11-04T13:04:52Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2021-11-04T13:04:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b0a414d06c3ed2097e32ef7944a4abb644b89bd'/>
<id>urn:sha1:5b0a414d06c3ed2097e32ef7944a4abb644b89bd</id>
<content type='text'>
This regression can be reproduced with ntfs-3g and overlayfs:

  mkdir lower upper work overlay
  dd if=/dev/zero of=ntfs.raw bs=1M count=2
  mkntfs -F ntfs.raw
  mount ntfs.raw lower
  touch lower/file.txt
  mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=work - overlay
  mv overlay/file.txt overlay/file2.txt

mv fails and (misleadingly) prints

  mv: cannot move 'overlay/file.txt' to a subdirectory of itself, 'overlay/file2.txt'

The reason is that ovl_copy_fileattr() is triggered due to S_NOATIME being
set on all inodes (by fuse) regardless of fileattr.

ovl_copy_fileattr() tries to retrieve file attributes from lower file, but
that fails because filesystem does not support this ioctl (this should fail
with ENOTTY, but ntfs-3g return EINVAL instead).  This failure is
propagated to origial operation (in this case rename) that triggered the
copy-up.

The fix is to ignore ENOTTY and EINVAL errors from fileattr_get() in copy
up.  This also requires turning the internal ENOIOCTLCMD into ENOTTY.

As a further measure to prevent unnecessary failures, only try the
fileattr_get/set on upper if there are any flags to copy up.

Side note: a number of filesystems set S_NOATIME (and sometimes other inode
flags) irrespective of fileattr flags.  This causes unnecessary calls
during copy up, which might lead to a performance issue, especially if
latency is high.  To fix this, the kernel would need to differentiate
between the two cases.  E.g. introduce SB_NOATIME_UPDATE, a per-sb variant
of S_NOATIME.  SB_NOATIME doesn't work, because that's interpreted as
"filesystem doesn't store an atime attribute"

Reported-and-tested-by: Kevin Locke &lt;kevin@kevinlocke.name&gt;
Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags")
Cc: &lt;stable@vger.kernel.org&gt; # v5.15
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>ovl: fix warning in ovl_create_real()</title>
<updated>2021-11-04T09:55:34Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2021-11-04T09:55:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1f5573cfe7a7056e80a92c7a037a3e69f3a13d1c'/>
<id>urn:sha1:1f5573cfe7a7056e80a92c7a037a3e69f3a13d1c</id>
<content type='text'>
Syzbot triggered the following warning in ovl_workdir_create() -&gt;
ovl_create_real():

	if (!err &amp;&amp; WARN_ON(!newdentry-&gt;d_inode)) {

The reason is that the cgroup2 filesystem returns from mkdir without
instantiating the new dentry.

Weird filesystems such as this will be rejected by overlayfs at a later
stage during setup, but to prevent such a warning, call ovl_mkdir_real()
directly from ovl_workdir_create() and reject this case early.

Reported-and-tested-by: syzbot+75eab84fd0af9e8bf66b@syzkaller.appspotmail.com
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>ovl: fix use after free in struct ovl_aio_req</title>
<updated>2021-10-29T11:48:19Z</updated>
<author>
<name>yangerkun</name>
</author>
<published>2021-09-30T03:22:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9a254403760041528bc8f69fe2f5e1ef86950991'/>
<id>urn:sha1:9a254403760041528bc8f69fe2f5e1ef86950991</id>
<content type='text'>
Example for triggering use after free in a overlay on ext4 setup:

aio_read
  ovl_read_iter
    vfs_iter_read
      ext4_file_read_iter
        ext4_dio_read_iter
          iomap_dio_rw -&gt; -EIOCBQUEUED
          /*
	   * Here IO is completed in a separate thread,
	   * ovl_aio_cleanup_handler() frees aio_req which has iocb embedded
	   */
          file_accessed(iocb-&gt;ki_filp); /**BOOM**/

Fix by introducing a refcount in ovl_aio_req similarly to aio_kiocb.  This
guarantees that iocb is only freed after vfs_read/write_iter() returns on
underlying fs.

Fixes: 2406a307ac7d ("ovl: implement async IO routines")
Signed-off-by: yangerkun &lt;yangerkun@huawei.com&gt;
Link: https://lore.kernel.org/r/20210930032228.3199690-3-yangerkun@huawei.com/
Cc: &lt;stable@vger.kernel.org&gt; # v5.6
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>fs: get rid of the res2 iocb-&gt;ki_complete argument</title>
<updated>2021-10-25T16:36:24Z</updated>
<author>
<name>Jens Axboe</name>
</author>
<published>2021-10-21T15:22:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6b19b766e8f077f29cdb47da5003469a85bbfb9c'/>
<id>urn:sha1:6b19b766e8f077f29cdb47da5003469a85bbfb9c</id>
<content type='text'>
The second argument was only used by the USB gadget code, yet everyone
pays the overhead of passing a zero to be passed into aio, where it
ends up being part of the aio res2 value.

Now that everybody is passing in zero, kill off the extra argument.

Reviewed-by: Darrick J. Wong &lt;djwong@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>ovl: fix IOCB_DIRECT if underlying fs doesn't support direct IO</title>
<updated>2021-09-28T07:16:12Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2021-09-27T09:23:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1dc1eed46f9fa4cb8a07baa24fb44c96d6dd35c9'/>
<id>urn:sha1:1dc1eed46f9fa4cb8a07baa24fb44c96d6dd35c9</id>
<content type='text'>
Normally the check at open time suffices, but e.g loop device does set
IOCB_DIRECT after doing its own checks (which are not sufficent for
overlayfs).

Make sure we don't call the underlying filesystem read/write method with
the IOCB_DIRECT if it's not supported.

Reported-by: Huang Jianan &lt;huangjianan@oppo.com&gt;
Fixes: 16914e6fc7e1 ("ovl: add ovl_read_iter()")
Cc: &lt;stable@vger.kernel.org&gt; # v4.19
Tested-by: Huang Jianan &lt;huangjianan@oppo.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>ovl: fix missing negative dentry check in ovl_rename()</title>
<updated>2021-09-24T19:00:31Z</updated>
<author>
<name>Zheng Liang</name>
</author>
<published>2021-09-24T01:16:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a295aef603e109a47af355477326bd41151765b6'/>
<id>urn:sha1:a295aef603e109a47af355477326bd41151765b6</id>
<content type='text'>
The following reproducer

  mkdir lower upper work merge
  touch lower/old
  touch lower/new
  mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge
  rm merge/new
  mv merge/old merge/new &amp; unlink upper/new

may result in this race:

PROCESS A:
  rename("merge/old", "merge/new");
  overwrite=true,ovl_lower_positive(old)=true,
  ovl_dentry_is_whiteout(new)=true -&gt; flags |= RENAME_EXCHANGE

PROCESS B:
  unlink("upper/new");

PROCESS A:
  lookup newdentry in new_upperdir
  call vfs_rename() with negative newdentry and RENAME_EXCHANGE

Fix by adding the missing check for negative newdentry.

Signed-off-by: Zheng Liang &lt;zhengliang6@huawei.com&gt;
Fixes: e9be9d5e76e3 ("overlay filesystem")
Cc: &lt;stable@vger.kernel.org&gt; # v3.18
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>ovl: enable RCU'd -&gt;get_acl()</title>
<updated>2021-08-18T20:08:24Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2021-08-18T20:08:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=332f606b32b6291a944c8cf23b91f53a6e676525'/>
<id>urn:sha1:332f606b32b6291a944c8cf23b91f53a6e676525</id>
<content type='text'>
Overlayfs does not cache ACL's (to avoid double caching).  Instead it just
calls the underlying filesystem's i_op-&gt;get_acl(), which will return the
cached value, if possible.

In rcu path walk, however, get_cached_acl_rcu() is employed to get the
value from the cache, which will fail on overlayfs resulting in dropping
out of rcu walk mode.  This can result in a big performance hit in certain
situations.

Fix by calling -&gt;get_acl() with rcu=true in case of ACL_DONT_CACHE (which
indicates pass-through)

Reported-by: garyhuang &lt;zjh.20052005@163.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
</feed>
