Re: [LTP] [PATCH STAGING v2 05/16] fchroot02: test fchroot() invalid arguments

Cyril Hrubis <[email protected]>
Newsgroups it.linux.lists.ltp
Message-ID <[email protected]>
Hi!
> +/*\
> + * Test the :manpage:`fchroot(2)` error paths for invalid arguments.
> + *
> + * :manpage:`fchroot(2)` was introduced in Linux v7.3. The syscall checks its
> + * arguments in this order:
> + *
> + * - a non-zero flags argument fails with ``EINVAL`` before anything else,
> + *   including with the ``FD_FAILFS_ROOT`` sentinel and with an invalid fd
> + * - an invalid fd fails with ``EBADF``, including the ``FD_PIDFS_ROOT`` and
> + *   ``FD_NSFS_ROOT`` sentinels which :manpage:`fchroot(2)` does not accept
> + * - a fd referring to a regular file fails with ``ENOTDIR``
> + *
> + * All these checks happen before the ``CAP_SYS_CHROOT`` check, so the test
> + * needs no privileges.

The order of check in kernel is never guaranteed and subject to change
at any time. We shouldn't rely on particular check being done first.


-- 
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.