[LTP] [PATCH 0/5] Add fchmodat2 testing suite

Andrea Cervesato andrea.cervesato@suse.de
Tue May 21 08:15:26 CEST 2024


This is a patch-set that implements fchmodat2() syscall coverage.
fchmodat2() has been added in kernel 6.6 in order to support
AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH in fchmodat().

- fchmodat2_01 tests AT_SYMLINK_NOFOLLOW on regular file
- fchmodat2_02 tests AT_SYMLINK_NOFOLLOW on symbolic file
- fchmodat2_03 tests AT_EMPTY_PATH

There's no man pages yet, so please take the following links as
main documentation along with kernel source code:

https://www.phoronix.com/news/fchmodat2-For-Linux-6.6
https://lore.kernel.org/lkml/20230824-frohlocken-vorabend-725f6fdaad50@brauner/

***********
* WARNING *
***********

fchmodat2_02 fails with EOPNOTSUPP because of missing feature.
According to documentation, the feature has been implemented in
kernel 6.6, but __in reality__ AT_SYMLINK_NOFOLLOW is not working
on symbolic files. Also kselftests, which are meant to test the
functionality, are not working and they are treating fchmodat2()
syscall failure as SKIP. Please take a look at the following code
before reviewing:

https://github.com/torvalds/linux/blob/8f6a15f095a63a83b096d9b29aaff4f0fbe6f6e6/tools/testing/selftests/fchmodat2/fchmodat2_test.c#L123

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Andrea Cervesato (5):
      Add SAFE_SYMLINKAT macro
      Add fchmodat2 syscall definitions
      Add fchmodat2_01 test
      Add fchmodat2_02 test
      Add fchmodat2_03 test

 include/lapi/syscalls/aarch64.in                   |  1 +
 include/lapi/syscalls/arc.in                       |  1 +
 include/lapi/syscalls/arm.in                       |  1 +
 include/lapi/syscalls/hppa.in                      |  1 +
 include/lapi/syscalls/i386.in                      |  1 +
 include/lapi/syscalls/ia64.in                      |  1 +
 include/lapi/syscalls/loongarch.in                 |  1 +
 include/lapi/syscalls/mips_n32.in                  |  1 +
 include/lapi/syscalls/mips_n64.in                  |  1 +
 include/lapi/syscalls/mips_o32.in                  |  1 +
 include/lapi/syscalls/powerpc.in                   |  1 +
 include/lapi/syscalls/powerpc64.in                 |  1 +
 include/lapi/syscalls/s390.in                      |  1 +
 include/lapi/syscalls/s390x.in                     |  1 +
 include/lapi/syscalls/sh.in                        |  1 +
 include/lapi/syscalls/sparc.in                     |  1 +
 include/lapi/syscalls/sparc64.in                   |  1 +
 include/lapi/syscalls/x86_64.in                    |  1 +
 include/safe_macros_fn.h                           |  4 ++
 include/tst_safe_macros.h                          |  3 ++
 lib/safe_macros.c                                  | 20 +++++++
 runtest/syscalls                                   |  4 ++
 testcases/kernel/syscalls/fchmodat2/.gitignore     |  3 ++
 testcases/kernel/syscalls/fchmodat2/Makefile       |  7 +++
 testcases/kernel/syscalls/fchmodat2/fchmodat2.h    | 32 +++++++++++
 testcases/kernel/syscalls/fchmodat2/fchmodat2_01.c | 54 +++++++++++++++++++
 testcases/kernel/syscalls/fchmodat2/fchmodat2_02.c | 63 ++++++++++++++++++++++
 testcases/kernel/syscalls/fchmodat2/fchmodat2_03.c | 46 ++++++++++++++++
 28 files changed, 254 insertions(+)
---
base-commit: e644691d30c3948a9788b735c51e09ca849ea47f
change-id: 20240517-fchmodat2-5b82867d71fc

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



More information about the ltp mailing list