[LTP] [PATCH STAGING v2 07/16] fchroot04: test fchroot() into failfs as root

Cyril Hrubis chrubis@suse.cz
Thu Aug 20 16:24:43 CEST 2026


Hi!
> +/*\
> + * Test :manpage:`fchroot(2)` with the ``FD_FAILFS_ROOT`` sentinel as a
> + * privileged process.
> + *
> + * :manpage:`fchroot(2)` was introduced in Linux v7.3 together with failfs,
> + * a kernel internal filesystem where every operation fails with
> + * ``EOPNOTSUPP``. The ``FD_FAILFS_ROOT`` sentinel moves the process root
> + * there without needing a file descriptor: it is the ``fs_struct`` equivalent
> + * of ``RESOLVE_BENEATH``.
> + *
> + * The test verifies that entering failfs succeeds with ``CAP_SYS_CHROOT`` and
> + * that every absolute path lookup then fails with ``EOPNOTSUPP``. The working
> + * directory, left behind in the real filesystem, is consequently reported
> + * as unreachable by :manpage:`getcwd(2)`.
> + *
> + * The syscall runs in a forked child because leaving failfs requires a
> + * mount namespace file descriptor and the parent needs its root for the
> + * test framework cleanup.

Here as well no need for the fork().

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list