Linux Test Project
 help / color / mirror / Atom feed
From: Andrea Cervesato <andrea.cervesato@suse.de>
To: Linux Test Project <ltp@lists.linux.it>
Subject: [LTP] [PATCH v3 00/15] fchroot: add fchroot() testing suite
Date: Fri, 28 Aug 2026 16:11:34 +0200	[thread overview]
Message-ID: <20260828-fchroot-v3-0-656a2b515726@suse.com> (raw)

fchroot() is a new syscall introduced in the Linux v7.3 development
cycle together with failfs, a kernel internal filesystem where every
operation fails with EOPNOTSUPP. The syscall is the fd-based
counterpart of chroot(2): it moves the process root to the directory
referenced by a file descriptor, or to the failfs root via the
FD_FAILFS_ROOT sentinel.

The series first updates the architecture syscall number tables and
adds lapi fallback definitions for the new fd sentinels, then adds 13
tests covering:

- the basic directory fd use case and the argument error paths
  (EINVAL, EBADF, ENOTDIR)
- the permission checks, both execute permission and CAP_SYS_CHROOT
- entering failfs as root: EOPNOTSUPP on every absolute lookup,
  unreachable working directory, root that can not be referenced or
  pinned, path walks anchored at file descriptors, execve blocked,
  fork inheritance and the setns() escape
- the unprivileged entry rules: no_new_privs, shared fs_struct and
  the already chrooted case

fchroot() is not part of any released kernel yet, so the tests are
added to runtest/staging and each patch carries the [STAGING] prefix
as required by the LTP ground rules.

The testing suite creation has been assisted by GLM 5.3.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v3:
- remove order specific tests inside the descriptions
- fchroot07: add child
- fix snprintf() possible overflows
- fix tests using TST_EXP_* macros
- use stat(".", ..) where it's needed
- Link to v2: https://lore.kernel.org/20260820-fchroot-v2-0-062ed20957a0@suse.com

Changes in v2:
- make description more readable
- invert fork() logic for the main test process
- fix the issues found by the agent
- Link to v1: https://lore.kernel.org/20260819-fchroot-v1-0-2dc2c3c3cf29@suse.com

To: Linux Test Project <ltp@lists.linux.it>

---
Andrea Cervesato (15):
      syscalls: add v7.3 syscall numbers
      syscalls: update outdated syscall entries
      [STAGING] lapi: fallback fchroot() parameters
      [STAGING] fchroot01: test fchroot() with a directory fd
      [STAGING] fchroot02: test fchroot() invalid arguments
      [STAGING] fchroot03: test fchroot() permission checks
      [STAGING] fchroot04: test fchroot() into failfs as root
      [STAGING] fchroot05: test failfs root can not be referenced
      [STAGING] fchroot06: test path walks under failfs root
      [STAGING] fchroot07: test execve blocked by failfs root
      [STAGING] fchroot09: test setns escape from failfs root
      [STAGING] fchroot10: test failfs entry without no_new_privs
      [STAGING] fchroot11: test failfs entry with no_new_privs
      [STAGING] fchroot12: test failfs entry with shared fs_struct
      [STAGING] fchroot13: test failfs entry when chrooted

 include/lapi/fcntl.h                               |  13 +++
 include/lapi/syscalls/arc.in                       |   3 +
 include/lapi/syscalls/arm.in                       |   4 +-
 include/lapi/syscalls/arm64.in                     |   3 +
 include/lapi/syscalls/i386.in                      |   4 +-
 include/lapi/syscalls/loongarch64.in               |   3 +
 include/lapi/syscalls/mips64.in                    |   5 +-
 include/lapi/syscalls/mips64n32.in                 |   5 +-
 include/lapi/syscalls/mipso32.in                   |   5 +-
 include/lapi/syscalls/parisc.in                    |   4 +-
 include/lapi/syscalls/powerpc.in                   |   4 +-
 include/lapi/syscalls/powerpc64.in                 |   4 +-
 include/lapi/syscalls/s390.in                      |   5 +-
 include/lapi/syscalls/s390x.in                     |   5 +-
 include/lapi/syscalls/sh.in                        |   4 +-
 include/lapi/syscalls/sparc.in                     |   5 +-
 include/lapi/syscalls/sparc64.in                   |   5 +-
 include/lapi/syscalls/x86_64.in                    |   5 +-
 runtest/staging                                    |  14 +++
 testcases/kernel/syscalls/fchroot/.gitignore       |  14 +++
 testcases/kernel/syscalls/fchroot/Makefile         |   7 ++
 testcases/kernel/syscalls/fchroot/fchroot01.c      |  58 ++++++++++
 testcases/kernel/syscalls/fchroot/fchroot02.c      |  75 ++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot03.c      |  72 ++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot04.c      |  70 ++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot05.c      |  75 ++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot06.c      | 126 +++++++++++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot07.c      |  56 +++++++++
 .../kernel/syscalls/fchroot/fchroot07_child.c      |  16 +++
 testcases/kernel/syscalls/fchroot/fchroot08.c      |  69 +++++++++++
 testcases/kernel/syscalls/fchroot/fchroot09.c      |  86 ++++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot10.c      |  50 ++++++++
 testcases/kernel/syscalls/fchroot/fchroot11.c      |  70 ++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot12.c      |  85 ++++++++++++++
 testcases/kernel/syscalls/fchroot/fchroot13.c      |  63 +++++++++++
 35 files changed, 1073 insertions(+), 19 deletions(-)
---
base-commit: 3c0271a307bd765c2fd652c325762a90ddf5d46f
change-id: 20260819-fchroot-66115fd0d497

Best regards,
--  
Andrea Cervesato <andrea.cervesato@suse.com>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-08-28 14:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 14:11 Andrea Cervesato [this message]
2026-08-28 14:11 ` [LTP] [PATCH v3 01/15] syscalls: add v7.3 syscall numbers Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH v3 02/15] syscalls: update outdated syscall entries Andrea Cervesato
2026-08-28 21:14   ` [LTP] syscalls: add v7.3 syscall numbers linuxtestproject.agent
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 03/15] lapi: fallback fchroot() parameters Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 04/15] fchroot01: test fchroot() with a directory fd Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 05/15] fchroot02: test fchroot() invalid arguments Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 06/15] fchroot03: test fchroot() permission checks Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 07/15] fchroot04: test fchroot() into failfs as root Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 08/15] fchroot05: test failfs root can not be referenced Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 09/15] fchroot06: test path walks under failfs root Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 10/15] fchroot07: test execve blocked by " Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 11/15] fchroot09: test setns escape from " Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 12/15] fchroot10: test failfs entry without no_new_privs Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 13/15] fchroot11: test failfs entry with no_new_privs Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 14/15] fchroot12: test failfs entry with shared fs_struct Andrea Cervesato
2026-08-28 14:11 ` [LTP] [PATCH STAGING v3 15/15] fchroot13: test failfs entry when chrooted Andrea Cervesato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260828-fchroot-v3-0-656a2b515726@suse.com \
    --to=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox