<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/overlayfs, branch v4.4</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>ovl: get rid of the dead code left from broken (and disabled) optimizations</title>
<updated>2015-12-06T17:31:07+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2015-12-06T17:31:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0f7ff2dabbc95ed7a8019d142274f0c7e083577d'/>
<id>0f7ff2dabbc95ed7a8019d142274f0c7e083577d</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: fix permission checking for setattr</title>
<updated>2015-12-06T17:28:23+00:00</updated>
<author>
<name>Miklos Szeredi</name>
<email>miklos@szeredi.hu</email>
</author>
<published>2015-12-04T18:18:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=acff81ec2c79492b180fade3c2894425cd35a545'/>
<id>acff81ec2c79492b180fade3c2894425cd35a545</id>
<content type='text'>
[Al Viro] The bug is in being too enthusiastic about optimizing -&gt;setattr()
away - instead of "copy verbatim with metadata" + "chmod/chown/utimes"
(with the former being always safe and the latter failing in case of
insufficient permissions) it tries to combine these two.  Note that copyup
itself will have to do -&gt;setattr() anyway; _that_ is where the elevated
capabilities are right.  Having these two -&gt;setattr() (one to set verbatim
copy of metadata, another to do what overlayfs -&gt;setattr() had been asked
to do in the first place) combined is where it breaks.

Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Al Viro] The bug is in being too enthusiastic about optimizing -&gt;setattr()
away - instead of "copy verbatim with metadata" + "chmod/chown/utimes"
(with the former being always safe and the latter failing in case of
insufficient permissions) it tries to combine these two.  Note that copyup
itself will have to do -&gt;setattr() anyway; _that_ is where the elevated
capabilities are right.  Having these two -&gt;setattr() (one to set verbatim
copy of metadata, another to do what overlayfs -&gt;setattr() had been asked
to do in the first place) combined is where it breaks.

Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs</title>
<updated>2015-10-31T21:49:19+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2015-10-31T21:49:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4bb0fb57f3bbe2ed7d4aad75a3c60a051afbd1db'/>
<id>4bb0fb57f3bbe2ed7d4aad75a3c60a051afbd1db</id>
<content type='text'>
Pull overlayfs bug fixes from Miklos Szeredi:
 "This contains fixes for bugs that appeared in earlier kernels (all are
  marked for -stable)"

* 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: free lower_mnt array in ovl_put_super
  ovl: free stack of paths in ovl_fill_super
  ovl: fix open in stacked overlay
  ovl: fix dentry reference leak
  ovl: use O_LARGEFILE in ovl_copy_up()
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pull overlayfs bug fixes from Miklos Szeredi:
 "This contains fixes for bugs that appeared in earlier kernels (all are
  marked for -stable)"

* 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: free lower_mnt array in ovl_put_super
  ovl: free stack of paths in ovl_fill_super
  ovl: fix open in stacked overlay
  ovl: fix dentry reference leak
  ovl: use O_LARGEFILE in ovl_copy_up()
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: free lower_mnt array in ovl_put_super</title>
<updated>2015-10-12T15:11:44+00:00</updated>
<author>
<name>Konstantin Khlebnikov</name>
<email>khlebnikov@yandex-team.ru</email>
</author>
<published>2015-08-24T12:57:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5ffdbe8bf1e485026e1c7e4714d2841553cf0b40'/>
<id>5ffdbe8bf1e485026e1c7e4714d2841553cf0b40</id>
<content type='text'>
This fixes memory leak after umount.

Kmemleak report:

unreferenced object 0xffff8800ba791010 (size 8):
  comm "mount", pid 2394, jiffies 4294996294 (age 53.920s)
  hex dump (first 8 bytes):
    20 1c 13 02 00 88 ff ff                           .......
  backtrace:
    [&lt;ffffffff811f8cd4&gt;] create_object+0x124/0x2c0
    [&lt;ffffffff817a059b&gt;] kmemleak_alloc+0x7b/0xc0
    [&lt;ffffffff811dffe6&gt;] __kmalloc+0x106/0x340
    [&lt;ffffffffa0152bfc&gt;] ovl_fill_super+0x55c/0x9b0 [overlay]
    [&lt;ffffffff81200ac4&gt;] mount_nodev+0x54/0xa0
    [&lt;ffffffffa0152118&gt;] ovl_mount+0x18/0x20 [overlay]
    [&lt;ffffffff81201ab3&gt;] mount_fs+0x43/0x170
    [&lt;ffffffff81220d34&gt;] vfs_kern_mount+0x74/0x170
    [&lt;ffffffff812233ad&gt;] do_mount+0x22d/0xdf0
    [&lt;ffffffff812242cb&gt;] SyS_mount+0x7b/0xc0
    [&lt;ffffffff817b6bee&gt;] entry_SYSCALL_64_fastpath+0x12/0x76
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: dd662667e6d3 ("ovl: add mutli-layer infrastructure")
Cc: &lt;stable@vger.kernel.org&gt; # v4.0+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes memory leak after umount.

Kmemleak report:

unreferenced object 0xffff8800ba791010 (size 8):
  comm "mount", pid 2394, jiffies 4294996294 (age 53.920s)
  hex dump (first 8 bytes):
    20 1c 13 02 00 88 ff ff                           .......
  backtrace:
    [&lt;ffffffff811f8cd4&gt;] create_object+0x124/0x2c0
    [&lt;ffffffff817a059b&gt;] kmemleak_alloc+0x7b/0xc0
    [&lt;ffffffff811dffe6&gt;] __kmalloc+0x106/0x340
    [&lt;ffffffffa0152bfc&gt;] ovl_fill_super+0x55c/0x9b0 [overlay]
    [&lt;ffffffff81200ac4&gt;] mount_nodev+0x54/0xa0
    [&lt;ffffffffa0152118&gt;] ovl_mount+0x18/0x20 [overlay]
    [&lt;ffffffff81201ab3&gt;] mount_fs+0x43/0x170
    [&lt;ffffffff81220d34&gt;] vfs_kern_mount+0x74/0x170
    [&lt;ffffffff812233ad&gt;] do_mount+0x22d/0xdf0
    [&lt;ffffffff812242cb&gt;] SyS_mount+0x7b/0xc0
    [&lt;ffffffff817b6bee&gt;] entry_SYSCALL_64_fastpath+0x12/0x76
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: dd662667e6d3 ("ovl: add mutli-layer infrastructure")
Cc: &lt;stable@vger.kernel.org&gt; # v4.0+
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: free stack of paths in ovl_fill_super</title>
<updated>2015-10-12T15:11:43+00:00</updated>
<author>
<name>Konstantin Khlebnikov</name>
<email>khlebnikov@yandex-team.ru</email>
</author>
<published>2015-08-24T12:57:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0f95502ad84874b3c05fc7cdd9d4d9d5cddf7859'/>
<id>0f95502ad84874b3c05fc7cdd9d4d9d5cddf7859</id>
<content type='text'>
This fixes small memory leak after mount.

Kmemleak report:

unreferenced object 0xffff88003683fe00 (size 16):
  comm "mount", pid 2029, jiffies 4294909563 (age 33.380s)
  hex dump (first 16 bytes):
    20 27 1f bb 00 88 ff ff 40 4b 0f 36 02 88 ff ff   '......@K.6....
  backtrace:
    [&lt;ffffffff811f8cd4&gt;] create_object+0x124/0x2c0
    [&lt;ffffffff817a059b&gt;] kmemleak_alloc+0x7b/0xc0
    [&lt;ffffffff811dffe6&gt;] __kmalloc+0x106/0x340
    [&lt;ffffffffa01b7a29&gt;] ovl_fill_super+0x389/0x9a0 [overlay]
    [&lt;ffffffff81200ac4&gt;] mount_nodev+0x54/0xa0
    [&lt;ffffffffa01b7118&gt;] ovl_mount+0x18/0x20 [overlay]
    [&lt;ffffffff81201ab3&gt;] mount_fs+0x43/0x170
    [&lt;ffffffff81220d34&gt;] vfs_kern_mount+0x74/0x170
    [&lt;ffffffff812233ad&gt;] do_mount+0x22d/0xdf0
    [&lt;ffffffff812242cb&gt;] SyS_mount+0x7b/0xc0
    [&lt;ffffffff817b6bee&gt;] entry_SYSCALL_64_fastpath+0x12/0x76
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: a78d9f0d5d5c ("ovl: support multiple lower layers")
Cc: &lt;stable@vger.kernel.org&gt; # v4.0+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This fixes small memory leak after mount.

Kmemleak report:

unreferenced object 0xffff88003683fe00 (size 16):
  comm "mount", pid 2029, jiffies 4294909563 (age 33.380s)
  hex dump (first 16 bytes):
    20 27 1f bb 00 88 ff ff 40 4b 0f 36 02 88 ff ff   '......@K.6....
  backtrace:
    [&lt;ffffffff811f8cd4&gt;] create_object+0x124/0x2c0
    [&lt;ffffffff817a059b&gt;] kmemleak_alloc+0x7b/0xc0
    [&lt;ffffffff811dffe6&gt;] __kmalloc+0x106/0x340
    [&lt;ffffffffa01b7a29&gt;] ovl_fill_super+0x389/0x9a0 [overlay]
    [&lt;ffffffff81200ac4&gt;] mount_nodev+0x54/0xa0
    [&lt;ffffffffa01b7118&gt;] ovl_mount+0x18/0x20 [overlay]
    [&lt;ffffffff81201ab3&gt;] mount_fs+0x43/0x170
    [&lt;ffffffff81220d34&gt;] vfs_kern_mount+0x74/0x170
    [&lt;ffffffff812233ad&gt;] do_mount+0x22d/0xdf0
    [&lt;ffffffff812242cb&gt;] SyS_mount+0x7b/0xc0
    [&lt;ffffffff817b6bee&gt;] entry_SYSCALL_64_fastpath+0x12/0x76
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Konstantin Khlebnikov &lt;khlebnikov@yandex-team.ru&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: a78d9f0d5d5c ("ovl: support multiple lower layers")
Cc: &lt;stable@vger.kernel.org&gt; # v4.0+
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: fix open in stacked overlay</title>
<updated>2015-10-12T13:56:20+00:00</updated>
<author>
<name>Miklos Szeredi</name>
<email>miklos@szeredi.hu</email>
</author>
<published>2015-10-12T13:56:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2'/>
<id>1c8a47df36d72ace8cf78eb6c228aa0f8027d3c2</id>
<content type='text'>
If two overlayfs filesystems are stacked on top of each other, then we need
recursion in ovl_d_select_inode().

I guess d_backing_inode() is supposed to do that.  But currently it doesn't
and that functionality is open coded in vfs_open().  This is now copied
into ovl_d_select_inode() to fix this regression.

Reported-by: Alban Crequy &lt;alban.crequy@gmail.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...")
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v4.2+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If two overlayfs filesystems are stacked on top of each other, then we need
recursion in ovl_d_select_inode().

I guess d_backing_inode() is supposed to do that.  But currently it doesn't
and that functionality is open coded in vfs_open().  This is now copied
into ovl_d_select_inode() to fix this regression.

Reported-by: Alban Crequy &lt;alban.crequy@gmail.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay...")
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v4.2+
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: fix dentry reference leak</title>
<updated>2015-10-12T13:56:20+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2015-09-18T10:45:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ab79efab0a0ba01a74df782eb7fa44b044dae8b5'/>
<id>ab79efab0a0ba01a74df782eb7fa44b044dae8b5</id>
<content type='text'>
In ovl_copy_up_locked(), newdentry is leaked if the function exits through
out_cleanup as this just to out after calling ovl_cleanup() - which doesn't
actually release the ref on newdentry.

The out_cleanup segment should instead exit through out2 as certainly
newdentry leaks - and possibly upper does also, though this isn't caught
given the catch of newdentry.

Without this fix, something like the following is seen:

	BUG: Dentry ffff880023e9eb20{i=f861,n=#ffff880023e82d90} still in use (1) [unmount of tmpfs tmpfs]
	BUG: Dentry ffff880023ece640{i=0,n=bigfile}  still in use (1) [unmount of tmpfs tmpfs]

when unmounting the upper layer after an error occurred in copyup.

An error can be induced by creating a big file in a lower layer with
something like:

	dd if=/dev/zero of=/lower/a/bigfile bs=65536 count=1 seek=$((0xf000))

to create a large file (4.1G).  Overlay an upper layer that is too small
(on tmpfs might do) and then induce a copy up by opening it writably.

Reported-by: Ulrich Obergfell &lt;uobergfe@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v3.18+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In ovl_copy_up_locked(), newdentry is leaked if the function exits through
out_cleanup as this just to out after calling ovl_cleanup() - which doesn't
actually release the ref on newdentry.

The out_cleanup segment should instead exit through out2 as certainly
newdentry leaks - and possibly upper does also, though this isn't caught
given the catch of newdentry.

Without this fix, something like the following is seen:

	BUG: Dentry ffff880023e9eb20{i=f861,n=#ffff880023e82d90} still in use (1) [unmount of tmpfs tmpfs]
	BUG: Dentry ffff880023ece640{i=0,n=bigfile}  still in use (1) [unmount of tmpfs tmpfs]

when unmounting the upper layer after an error occurred in copyup.

An error can be induced by creating a big file in a lower layer with
something like:

	dd if=/dev/zero of=/lower/a/bigfile bs=65536 count=1 seek=$((0xf000))

to create a large file (4.1G).  Overlay an upper layer that is too small
(on tmpfs might do) and then induce a copy up by opening it writably.

Reported-by: Ulrich Obergfell &lt;uobergfe@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v3.18+
</pre>
</div>
</content>
</entry>
<entry>
<title>ovl: use O_LARGEFILE in ovl_copy_up()</title>
<updated>2015-10-12T13:56:20+00:00</updated>
<author>
<name>David Howells</name>
<email>dhowells@redhat.com</email>
</author>
<published>2015-09-18T10:45:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0480334fa60488d12ae101a02d7d9e1a3d03d7dd'/>
<id>0480334fa60488d12ae101a02d7d9e1a3d03d7dd</id>
<content type='text'>
Open the lower file with O_LARGEFILE in ovl_copy_up().

Pass O_LARGEFILE unconditionally in ovl_copy_up_data() as it's purely for
catching 32-bit userspace dealing with a file large enough that it'll be
mishandled if the application isn't aware that there might be an integer
overflow.  Inside the kernel, there shouldn't be any problems.

Reported-by: Ulrich Obergfell &lt;uobergfe@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v3.18+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Open the lower file with O_LARGEFILE in ovl_copy_up().

Pass O_LARGEFILE unconditionally in ovl_copy_up_data() as it's purely for
catching 32-bit userspace dealing with a file large enough that it'll be
mishandled if the application isn't aware that there might be an integer
overflow.  Inside the kernel, there shouldn't be any problems.

Reported-by: Ulrich Obergfell &lt;uobergfe@redhat.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v3.18+
</pre>
</div>
</content>
</entry>
<entry>
<title>fs: create and use seq_show_option for escaping</title>
<updated>2015-09-04T23:54:41+00:00</updated>
<author>
<name>Kees Cook</name>
<email>keescook@chromium.org</email>
</author>
<published>2015-09-04T22:44:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a068acf2ee77693e0bf39d6e07139ba704f461c3'/>
<id>a068acf2ee77693e0bf39d6e07139ba704f461c3</id>
<content type='text'>
Many file systems that implement the show_options hook fail to correctly
escape their output which could lead to unescaped characters (e.g.  new
lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files.  This
could lead to confusion, spoofed entries (resulting in things like
systemd issuing false d-bus "mount" notifications), and who knows what
else.  This looks like it would only be the root user stepping on
themselves, but it's possible weird things could happen in containers or
in other situations with delegated mount privileges.

Here's an example using overlay with setuid fusermount trusting the
contents of /proc/mounts (via the /etc/mtab symlink).  Imagine the use
of "sudo" is something more sneaky:

  $ BASE="ovl"
  $ MNT="$BASE/mnt"
  $ LOW="$BASE/lower"
  $ UP="$BASE/upper"
  $ WORK="$BASE/work/ 0 0
  none /proc fuse.pwn user_id=1000"
  $ mkdir -p "$LOW" "$UP" "$WORK"
  $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none /mnt
  $ cat /proc/mounts
  none /root/ovl/mnt overlay rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
  none /proc fuse.pwn user_id=1000 0 0
  $ fusermount -u /proc
  $ cat /proc/mounts
  cat: /proc/mounts: No such file or directory

This fixes the problem by adding new seq_show_option and
seq_show_option_n helpers, and updating the vulnerable show_option
handlers to use them as needed.  Some, like SELinux, need to be open
coded due to unusual existing escape mechanisms.

[akpm@linux-foundation.org: add lost chunk, per Kees]
[keescook@chromium.org: seq_show_option should be using const parameters]
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Acked-by: Jan Kara &lt;jack@suse.com&gt;
Acked-by: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: J. R. Okajima &lt;hooanon05g@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Many file systems that implement the show_options hook fail to correctly
escape their output which could lead to unescaped characters (e.g.  new
lines) leaking into /proc/mounts and /proc/[pid]/mountinfo files.  This
could lead to confusion, spoofed entries (resulting in things like
systemd issuing false d-bus "mount" notifications), and who knows what
else.  This looks like it would only be the root user stepping on
themselves, but it's possible weird things could happen in containers or
in other situations with delegated mount privileges.

Here's an example using overlay with setuid fusermount trusting the
contents of /proc/mounts (via the /etc/mtab symlink).  Imagine the use
of "sudo" is something more sneaky:

  $ BASE="ovl"
  $ MNT="$BASE/mnt"
  $ LOW="$BASE/lower"
  $ UP="$BASE/upper"
  $ WORK="$BASE/work/ 0 0
  none /proc fuse.pwn user_id=1000"
  $ mkdir -p "$LOW" "$UP" "$WORK"
  $ sudo mount -t overlay -o "lowerdir=$LOW,upperdir=$UP,workdir=$WORK" none /mnt
  $ cat /proc/mounts
  none /root/ovl/mnt overlay rw,relatime,lowerdir=ovl/lower,upperdir=ovl/upper,workdir=ovl/work/ 0 0
  none /proc fuse.pwn user_id=1000 0 0
  $ fusermount -u /proc
  $ cat /proc/mounts
  cat: /proc/mounts: No such file or directory

This fixes the problem by adding new seq_show_option and
seq_show_option_n helpers, and updating the vulnerable show_option
handlers to use them as needed.  Some, like SELinux, need to be open
coded due to unusual existing escape mechanisms.

[akpm@linux-foundation.org: add lost chunk, per Kees]
[keescook@chromium.org: seq_show_option should be using const parameters]
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Serge Hallyn &lt;serge.hallyn@canonical.com&gt;
Acked-by: Jan Kara &lt;jack@suse.com&gt;
Acked-by: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: J. R. Okajima &lt;hooanon05g@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix a braino in ovl_d_select_inode()</title>
<updated>2015-07-12T15:22:05+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2015-07-12T14:39:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9391dd00d13c853ab4f2a85435288ae2202e0e43'/>
<id>9391dd00d13c853ab4f2a85435288ae2202e0e43</id>
<content type='text'>
when opening a directory we want the overlayfs inode, not one from
the topmost layer.

Reported-By: Andrey Jr. Melnikov &lt;temnota.am@gmail.com&gt;
Tested-By: Andrey Jr. Melnikov &lt;temnota.am@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
when opening a directory we want the overlayfs inode, not one from
the topmost layer.

Reported-By: Andrey Jr. Melnikov &lt;temnota.am@gmail.com&gt;
Tested-By: Andrey Jr. Melnikov &lt;temnota.am@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
</feed>
