generic: add test for detached mount propagation
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 12 Apr 2021 11:57:03 +0000 (13:57 +0200)
committerEryu Guan <guaneryu@gmail.com>
Sun, 18 Apr 2021 12:53:53 +0000 (20:53 +0800)
commita7f90c1433f383e337d67f310ec7878781108ec4
tree835e7a63690266268956b03bb40ea02555766b91
parent718f490a718feadfa133d1b7d2f01a31c4270dee
generic: add test for detached mount propagation

Regression test to verify that creating a series of detached mounts,
attaching them to the filesystem, and unmounting them does not trigger an
integer overflow in ns->mounts causing the kernel to block any new mounts in
count_mounts() and returning ENOSPC because it falsely assumes that the
maximum number of mounts in the mount namespace has been reached, i.e. it
thinks it can't fit the new mounts into the mount namespace anymore.

The test is written in a way that it will leave the host's mount
namespace intact so we are sure to never make the host's mount namespace
unuseable!

Link: https://git.kernel.org/torvalds/c/ee2e3f50629f17b0752b55b2566c15ce8dafb557
Cc: Eryu Guan <guan@eryu.me>
Cc: David Howells <dhowells@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
.gitignore
src/Makefile
src/detached_mounts_propagation.c [new file with mode: 0644]
tests/generic/632 [new file with mode: 0755]
tests/generic/632.out [new file with mode: 0644]
tests/generic/group