[PATCH 0/2] Support overlayfs in the idmapped mount tests
Christian Brauner <[email protected]> Mon, 15 Jun 2026 17:33:28 +0200
| Newsgroups | org.kernel.vger.linux-unionfs,org.kernel.vger.fstests,org.kernel.vger.linux-fsdevel |
|---|---|
| Message-ID | <[email protected]> |
This change is required to make the series in [1] which makes idmapped
overlayfs mounts work compatible with the idmapped mount test suite.
The vfstest idmapped mount tests behind generic/633, generic/696 and
generic/697 fail on overlayfs for two reasons that are specific to
overlayfs and unrelated to idmapped mount semantics:
- They create a whiteout device, mknod(S_IFCHR, makedev(0, 0)), as a
fixture -- it is the only character device an unprivileged caller may
create, being exempt from the CAP_MKNOD check. overlayfs reserves a
0:0 character device as its on-disk whiteout marker, so ovl_mknod()
returns -EPERM and the fixture cannot be created.
- openat_tmpfile_supported() probes O_TMPFILE on the idmapped mount as
the test's fsuid, which that mount does not map. On overlayfs the
backing tmpfile then ends up owned by an unmapped id, overlayfs opens
it with O_NOATIME, and may_open() returns -EPERM, so the probe
wrongly concludes O_TMPFILE is unsupported and the tmpfile sub-tests
are skipped.
Patch 1 fixes the probe: O_TMPFILE support is a property of the
filesystem, not of the idmapped mount or the caller's mapping, so it
probes info->t_dir1_fd (the base mount, which the caller owns) just like
the non-idmapped setgid tests already do. This is a general correctness
fix and a no-op on every other filesystem.
Patch 2 adds an is_overlayfs() helper and skips the whiteout-device
fixtures (and the checks that depend on them) on overlayfs, which
genuinely cannot create them; the makedev(5, 1) "creation must fail"
probes keep running.
With both patches generic/633, generic/696 and generic/697 pass on an
idmapped overlayfs mount with no change on any other filesystem; tested
on overlayfs and tmpfs.
The underlying overlayfs O_NOATIME behaviour that turns an unmapped-fsuid
O_TMPFILE into -EPERM is being addressed separately on the kernel side;
these test changes are independent of it.
Link:
https://patch.msgid.link/[email protected] [1]
Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
Christian Brauner (2):
src/vfs: probe O_TMPFILE support on the base mount in the idmapped tests
src/vfs: skip whiteout-device fixtures on overlayfs
src/vfs/idmapped-mounts.c | 166 ++++++++++++++++++++++++----------------------
src/vfs/utils.c | 5 ++
src/vfs/utils.h | 1 +
3 files changed, 93 insertions(+), 79 deletions(-)
---
base-commit: ffc8bad17e5b2f56e48dbac43f7c5ae8ac368fe5
change-id: 20260615-overlay-idmapped-vfstest-b262d3084eea