linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401)
commit65341f7bbea824d2ff9d37db15d8be162df42bd3
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 28 Sep 2023 16:56:21 +0000 (28 13:56 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 20 Nov 2023 16:15:24 +0000 (20 13:15 -0300)
treeff89d7074d0602f93b0c872966c4bc288ac5d7d3
parentc52c2c32db15aba8bbe1a0b4d3235f97d9c1a525
linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401)

Linux 6.6 (09da082b07bbae1c) added support for fchmodat2, which has
similar semantics as fchmodat with an extra flag argument.  This
allows fchmodat to implement AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH
without the need for procfs.

The syscall is registered on all architectures (with value of 452
except on alpha which is 562, commit 78252deb023cf087).

The tst-lchmod.c requires a small fix where fchmodat checks two
contradictory assertions ('(st.st_mode & 0777) == 2' and
'(st.st_mode & 0777) == 3').

Checked on x86_64-linux-gnu on a 6.6 kernel.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
io/tst-lchmod.c
sysdeps/unix/sysv/linux/fchmodat.c
sysdeps/unix/sysv/linux/kernel-features.h