From patchwork Thu Sep 28 16:56:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 727093 Delivered-To: patch@linaro.org Received: by 2002:a5d:60c8:0:b0:31d:da82:a3b4 with SMTP id x8csp19663wrt; Thu, 28 Sep 2023 09:56:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESGRVWEp4p2AfxBI7OiSt+XfddB84ZP4XlD3KlciGSqnRrY+odmOK/z/rCwcVAs5yulWMG X-Received: by 2002:aa7:d150:0:b0:533:20ab:5d7c with SMTP id r16-20020aa7d150000000b0053320ab5d7cmr1545657edo.22.1695920203667; Thu, 28 Sep 2023 09:56:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695920203; cv=none; d=google.com; s=arc-20160816; b=yDtixnBZ0IaN9/ey/Tv6wbW9FZV43E7zdQ/fCEE7NEGkhKrrwmLKlyEtpg90HzLAbo EBcDHHr2Zl/HH73tvybm1lh3CJQvHNZxamzFCcYhn0MQZlWwl3wu7DYxiKY5uPa/ghtB q3C7ClELjf/P7FC1zb+NZ74pk9raA4I19Lu/xof8/RLXppJmumSu/0KtlXV8+lyxSKLi SgGvRN4pMDeLBhiiJQHT0Iy4eDwZoxPmipQNmteJOMDm5cphQeJbdO28aOzhclaUAS74 WHLCmB/vhVu7TYEuh/TeXHrAO7/a5FRq9eFicsCvycgrNvspA4kv9xiSLJi58pqbxKcA l3cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :dmarc-filter:delivered-to; bh=rMvEPKIk/DTOOAxQnaGrKSvE8nzBmQGGL+g/0UMBPEM=; fh=dHLBnA+MhGtNtN2B2JMAELi4oD+gmgMg7DL8H0jYbkI=; b=pXcWJQk5yfPJwnaCg6OxATD+nS6nEv0Atfw+06iUFP00zD1NlK78ZR1FlTkfhjq53J gyL7ZagZRLcF80H2byfite8W3FFZmtrozNf4yOHIRmq52hQYOnTlZxZI5EKWiGkCAYBM OCStrC5GogNpmmbv79QpWDTHNVXUbd8+4uoXqVFfITV1vdT+C8kHDII1Uy3JlC8Gux/H Mqx7Fn329mmD57cZQVm4wMFSk22NpU3bKhDPKDBjJU30okc5FLc6lmARG0ykxN1hLGRb D5xFBInSNJLSvBJvSMD9utdCg5IzOxTBPVi+D/V5dUyd6gZapRcuA60eM40xQ9wBppQN 9oWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eukhy5W7; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c18-20020aa7df12000000b0052fa80b83ccsi14755547edy.307.2023.09.28.09.56.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 09:56:43 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eukhy5W7; spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 563323861912 for ; Thu, 28 Sep 2023 16:56:42 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by sourceware.org (Postfix) with ESMTPS id 12D313858C52 for ; Thu, 28 Sep 2023 16:56:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 12D313858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3ae0135c4deso7589567b6e.3 for ; Thu, 28 Sep 2023 09:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695920187; x=1696524987; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=rMvEPKIk/DTOOAxQnaGrKSvE8nzBmQGGL+g/0UMBPEM=; b=eukhy5W7ISlkmz0Y7VTR0n2VBixc8XY8kweHMWxWlnRNmbYXLXIlZFIuGliOZDCx40 AbWIL55Y64clL+AOSWFUai3pgyxPXGeJUGta2ksN8ZUcp12g87+OvxAcjl1ycX1ukfNr eQLTkh1SvBRsM7vJEVlFyCx7tu3nlAHKYG6V1pQvVpCPcxKqocb9ZZUxovQjCvJiAmv0 4qTLb/vD/z+VIplEmJY+jhJYNYd1GA47cepETc9ZeolXBCbxvNqljKMLPvTFd6Ys3LEP AUROvyPKeAuS5GwvWsVuSD5ulGGbfA+EKXCjfQyoLzlAjAsujFBODJ37GPHVLCcjY5fs LKjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695920187; x=1696524987; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rMvEPKIk/DTOOAxQnaGrKSvE8nzBmQGGL+g/0UMBPEM=; b=S1blfT6NkiD6R+9atfXXpQoS2ntbZyZL/8L8dGu+VuCfO0XH8hS6xrETMpf1OFHZ6I VXUySMrlvvPLfPIhvGGyBAYLVUJzIL49V2EvwXphdEXt4vtgjMYgjEf2PyFjP+9wuqo9 5PpCf5AJ5HxzAVb9D/0zjXzMXNtROqz4AChRhs/AcfaiCwsyQA1T+ptZbt9SOcGlo1es 7P/ylFkqvYghA9XIpJLSVbbNWHBmdl/yhBdKy4CoAZA9O/cmqNBZ99habV7YnPsoEv9a DdymbTzAUHg+kr7THG90H+5R4JBc0Ls4P97d7M4HxnGuAGw3lA7iU4MQCYbwhpLC6psJ UdQQ== X-Gm-Message-State: AOJu0YxeryCoOSCROQWePeDWiqohigW6oX3gm2EUMUT6xVZHTYNLXlbv 7ANOW7c+aTJugXF96D/5OyKVoK48+cF78spUT15r9w== X-Received: by 2002:a05:6808:c4:b0:3ab:8431:8037 with SMTP id t4-20020a05680800c400b003ab84318037mr1628397oic.32.1695920186929; Thu, 28 Sep 2023 09:56:26 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c1:6eb0:234b:421b:60d7:f191]) by smtp.gmail.com with ESMTPSA id j14-20020aa78dce000000b006906aaf1e4dsm13604809pfr.150.2023.09.28.09.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 09:56:25 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [RFC] linux: Use fchmodat2 on fchmod for flags different than 0 (BZ 26401) Date: Thu, 28 Sep 2023 13:56:21 -0300 Message-Id: <20230928165621.372548-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org Linux 6.6 (09da082b07bbae1c) added support for fchmodat2, which is has similar semantic of fchmodat with an extra flag argument. This allow fchmodat to implement AT_SYMLINK_NOFOLLOW and AT_EMPTY_PATH without the need to procfs. The syscall is registered on all architectures (with value of 452 except on alpha which is 562, commit 78252deb023cf087). Checked on x86_64-linux-gnu on a 6.6 kernel. PS: setting it as RFC because there is no Linux 6.6 release yet. --- io/tst-lchmod.c | 4 +- .../unix/sysv/linux/aarch64/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/alpha/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/arc/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/arm/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/csky/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/fchmodat.c | 120 ++++++++++-------- sysdeps/unix/sysv/linux/hppa/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/i386/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/ia64/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/kernel-features.h | 8 ++ .../unix/sysv/linux/loongarch/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/m68k/arch-syscall.h | 1 + .../unix/sysv/linux/microblaze/arch-syscall.h | 1 + .../sysv/linux/mips/mips32/arch-syscall.h | 1 + .../sysv/linux/mips/mips64/n32/arch-syscall.h | 1 + .../sysv/linux/mips/mips64/n64/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/nios2/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/or1k/arch-syscall.h | 1 + .../linux/powerpc/powerpc32/arch-syscall.h | 1 + .../linux/powerpc/powerpc64/arch-syscall.h | 1 + .../unix/sysv/linux/riscv/rv32/arch-syscall.h | 1 + .../unix/sysv/linux/riscv/rv64/arch-syscall.h | 1 + .../sysv/linux/s390/s390-32/arch-syscall.h | 1 + .../sysv/linux/s390/s390-64/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/sh/arch-syscall.h | 1 + .../sysv/linux/sparc/sparc32/arch-syscall.h | 1 + .../sysv/linux/sparc/sparc64/arch-syscall.h | 1 + sysdeps/unix/sysv/linux/syscall-names.list | 1 + .../unix/sysv/linux/x86_64/64/arch-syscall.h | 1 + .../unix/sysv/linux/x86_64/x32/arch-syscall.h | 1 + 31 files changed, 105 insertions(+), 55 deletions(-) diff --git a/io/tst-lchmod.c b/io/tst-lchmod.c index 2bf4835b05..6496dc61e0 100644 --- a/io/tst-lchmod.c +++ b/io/tst-lchmod.c @@ -219,9 +219,9 @@ test_1 (bool do_relative_path, int (*chmod_func) (int fd, const char *, mode_t, /* The error code from the openat fallback leaks out. */ if (errno != ENFILE && errno != EMFILE) TEST_COMPARE (errno, EOPNOTSUPP); + xstat (path_file, &st); + TEST_COMPARE (st.st_mode & 0777, 3); } - xstat (path_file, &st); - TEST_COMPARE (st.st_mode & 0777, 3); /* Close the descriptors. */ for (int *pfd = fd_list_begin (&fd_list); pfd < fd_list_end (&fd_list); diff --git a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h index 8f21ee66a0..746991aa2f 100644 --- a/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/aarch64/arch-syscall.h @@ -44,6 +44,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl 25 diff --git a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h index c5802a5fec..32efe51267 100644 --- a/sysdeps/unix/sysv/linux/alpha/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/alpha/arch-syscall.h @@ -56,6 +56,7 @@ #define __NR_fchdir 13 #define __NR_fchmod 124 #define __NR_fchmodat 461 +#define __NR_fchmodat2 562 #define __NR_fchown 123 #define __NR_fchownat 453 #define __NR_fcntl 92 diff --git a/sysdeps/unix/sysv/linux/arc/arch-syscall.h b/sysdeps/unix/sysv/linux/arc/arch-syscall.h index f23f9e1154..1d2879e877 100644 --- a/sysdeps/unix/sysv/linux/arc/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/arc/arch-syscall.h @@ -48,6 +48,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl64 25 diff --git a/sysdeps/unix/sysv/linux/arm/arch-syscall.h b/sysdeps/unix/sysv/linux/arm/arch-syscall.h index 7edf574899..6711981e78 100644 --- a/sysdeps/unix/sysv/linux/arm/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/arm/arch-syscall.h @@ -64,6 +64,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 333 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 325 diff --git a/sysdeps/unix/sysv/linux/csky/arch-syscall.h b/sysdeps/unix/sysv/linux/csky/arch-syscall.h index d74a06e063..92d9a703ea 100644 --- a/sysdeps/unix/sysv/linux/csky/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/csky/arch-syscall.h @@ -50,6 +50,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl64 25 diff --git a/sysdeps/unix/sysv/linux/fchmodat.c b/sysdeps/unix/sysv/linux/fchmodat.c index 99527a3727..99d3df6440 100644 --- a/sysdeps/unix/sysv/linux/fchmodat.c +++ b/sysdeps/unix/sysv/linux/fchmodat.c @@ -26,66 +26,80 @@ #include #include -int -fchmodat (int fd, const char *file, mode_t mode, int flag) +#if !__ASSUME_FCHMODAT2 +static int +fchmodat_fallback (int fd, const char *file, mode_t mode, int flag) { - if (flag == 0) - return INLINE_SYSCALL (fchmodat, 3, fd, file, mode); - else if (flag != AT_SYMLINK_NOFOLLOW) + if (flag != AT_SYMLINK_NOFOLLOW) return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL); - else - { - /* The kernel system call does not have a mode argument. - However, we can create an O_PATH descriptor and change that - via /proc (which does not resolve symbolic links). */ - int pathfd = __openat_nocancel (fd, file, - O_PATH | O_NOFOLLOW | O_CLOEXEC); - if (pathfd < 0) - /* This may report errors such as ENFILE and EMFILE. The - caller can treat them as temporary if necessary. */ - return pathfd; + /* The kernel system call does not have a mode argument. + However, we can create an O_PATH descriptor and change that + via /proc (which does not resolve symbolic links). */ - /* Use fstatat because fstat does not work on O_PATH descriptors - before Linux 3.6. */ - struct __stat64_t64 st; - if (__fstatat64_time64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) - { - __close_nocancel (pathfd); - return -1; - } + int pathfd = __openat_nocancel (fd, file, + O_PATH | O_NOFOLLOW | O_CLOEXEC); + if (pathfd < 0) + /* This may report errors such as ENFILE and EMFILE. The + caller can treat them as temporary if necessary. */ + return pathfd; - /* Some Linux versions with some file systems can actually - change symbolic link permissions via /proc, but this is not - intentional, and it gives inconsistent results (e.g., error - return despite mode change). The expected behavior is that - symbolic link modes cannot be changed at all, and this check - enforces that. */ - if (S_ISLNK (st.st_mode)) - { - __close_nocancel (pathfd); - __set_errno (EOPNOTSUPP); - return -1; - } + /* Use fstatat because fstat does not work on O_PATH descriptors + before Linux 3.6. */ + struct __stat64_t64 st; + if (__fstatat64_time64 (pathfd, "", &st, AT_EMPTY_PATH) != 0) + { + __close_nocancel (pathfd); + return -1; + } - /* For most file systems, fchmod does not operate on O_PATH - descriptors, so go through /proc. */ - struct fd_to_filename filename; - int ret = __chmod (__fd_to_filename (pathfd, &filename), mode); - if (ret != 0) - { - if (errno == ENOENT) - /* /proc has not been mounted. Without /proc, there is no - way to upgrade the O_PATH descriptor to a full - descriptor. It is also not possible to re-open the - file without O_PATH because the file name may refer to - another file, and opening that without O_PATH may have - side effects (such as blocking, device rewinding, or - releasing POSIX locks). */ - __set_errno (EOPNOTSUPP); - } + /* Some Linux versions with some file systems can actually + change symbolic link permissions via /proc, but this is not + intentional, and it gives inconsistent results (e.g., error + return despite mode change). The expected behavior is that + symbolic link modes cannot be changed at all, and this check + enforces that. */ + if (S_ISLNK (st.st_mode)) + { __close_nocancel (pathfd); - return ret; + __set_errno (EOPNOTSUPP); + return -1; + } + + /* For most file systems, fchmod does not operate on O_PATH + descriptors, so go through /proc. */ + struct fd_to_filename filename; + int ret = __chmod (__fd_to_filename (pathfd, &filename), mode); + if (ret != 0) + { + if (errno == ENOENT) + /* /proc has not been mounted. Without /proc, there is no + way to upgrade the O_PATH descriptor to a full + descriptor. It is also not possible to re-open the + file without O_PATH because the file name may refer to + another file, and opening that without O_PATH may have + side effects (such as blocking, device rewinding, or + releasing POSIX locks). */ + __set_errno (EOPNOTSUPP); } + __close_nocancel (pathfd); + return ret; +} +#endif + +int +fchmodat (int fd, const char *file, mode_t mode, int flag) +{ +#if __ASSUME_FCHMODAT2 + return INLINE_SYSCALL_CALL (fchmodat2, fd, file, mode, flag); +#else + if (flag == 0) + return INLINE_SYSCALL_CALL (fchmodat, fd, file, mode); + + int r = INLINE_SYSCALL_CALL (fchmodat2, fd, file, mode, flag); + if (r != 0 && errno == ENOSYS) + return fchmodat_fallback (fd, file, mode, flag); + return r; +#endif } libc_hidden_def (fchmodat) diff --git a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h index 5568b94cd3..fbac124b70 100644 --- a/sysdeps/unix/sysv/linux/hppa/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/hppa/arch-syscall.h @@ -63,6 +63,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 286 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchownat 278 #define __NR_fcntl 55 diff --git a/sysdeps/unix/sysv/linux/i386/arch-syscall.h b/sysdeps/unix/sysv/linux/i386/arch-syscall.h index 3af21a15cb..8961788a96 100644 --- a/sysdeps/unix/sysv/linux/i386/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/i386/arch-syscall.h @@ -67,6 +67,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 306 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 298 diff --git a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h index 39b270e642..d11d3a9e63 100644 --- a/sysdeps/unix/sysv/linux/ia64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/ia64/arch-syscall.h @@ -55,6 +55,7 @@ #define __NR_fchdir 1035 #define __NR_fchmod 1099 #define __NR_fchmodat 1292 +#define __NR_fchmodat2 452 #define __NR_fchown 1100 #define __NR_fchownat 1284 #define __NR_fcntl 1066 diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 07b440f4ee..670d2604d2 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -252,4 +252,12 @@ # define __ASSUME_CLONE3 0 #endif +/* The fchmodat2 system call was introduced across all architectures + in Linux 6.6. */ +#if __LINUX_KERNEL_VERSION >= 0x060600 +# define __ASSUME_FCHMODAT2 1 +#else +# define __ASSUME_FCHMODAT2 0 +#endif + #endif /* kernel-features.h */ diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h index fdefe8bb6f..3664e6f7c8 100644 --- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h @@ -44,6 +44,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl 25 diff --git a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h index 315e49cd33..2053d5d392 100644 --- a/sysdeps/unix/sysv/linux/m68k/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/m68k/arch-syscall.h @@ -67,6 +67,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 299 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 291 diff --git a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h index 54af12780c..6865b1693c 100644 --- a/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/microblaze/arch-syscall.h @@ -67,6 +67,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 306 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 298 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h index a2aa1ffa1b..b13ace8e1c 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/arch-syscall.h @@ -67,6 +67,7 @@ #define __NR_fchdir 4133 #define __NR_fchmod 4094 #define __NR_fchmodat 4299 +#define __NR_fchmodat2 4452 #define __NR_fchown 4095 #define __NR_fchownat 4291 #define __NR_fcntl 4055 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h index 5bec858040..b7a7c0dfa7 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/arch-syscall.h @@ -64,6 +64,7 @@ #define __NR_fchdir 6079 #define __NR_fchmod 6089 #define __NR_fchmodat 6262 +#define __NR_fchmodat2 6452 #define __NR_fchown 6091 #define __NR_fchownat 6254 #define __NR_fcntl 6070 diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h index 0166371ee2..e5d7f91f48 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/arch-syscall.h @@ -59,6 +59,7 @@ #define __NR_fchdir 5079 #define __NR_fchmod 5089 #define __NR_fchmodat 5258 +#define __NR_fchmodat2 5452 #define __NR_fchown 5091 #define __NR_fchownat 5250 #define __NR_fcntl 5070 diff --git a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h index 29a4cfa988..89950cc33a 100644 --- a/sysdeps/unix/sysv/linux/nios2/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/nios2/arch-syscall.h @@ -49,6 +49,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl64 25 diff --git a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h index f5a3729663..4c07d9c204 100644 --- a/sysdeps/unix/sysv/linux/or1k/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/or1k/arch-syscall.h @@ -49,6 +49,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl64 25 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h index 3a212a0269..64683bcb76 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/arch-syscall.h @@ -66,6 +66,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 297 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchownat 289 #define __NR_fcntl 55 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h index 1038ead227..af1bbf32e8 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/arch-syscall.h @@ -60,6 +60,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 297 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchownat 289 #define __NR_fcntl 55 diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h index 57b043ffb5..56e3088cbf 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h @@ -43,6 +43,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl64 25 diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h index 1041a0f8c9..508161b47a 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/riscv/rv64/arch-syscall.h @@ -44,6 +44,7 @@ #define __NR_fchdir 50 #define __NR_fchmod 52 #define __NR_fchmodat 53 +#define __NR_fchmodat2 452 #define __NR_fchown 55 #define __NR_fchownat 54 #define __NR_fcntl 25 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h index 70d4c6782e..1498ebf42e 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/arch-syscall.h @@ -65,6 +65,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 299 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 291 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h index 65a8a9e316..624d71b56d 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/arch-syscall.h @@ -56,6 +56,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 299 +#define __NR_fchmodat2 452 #define __NR_fchown 207 #define __NR_fchownat 291 #define __NR_fcntl 55 diff --git a/sysdeps/unix/sysv/linux/sh/arch-syscall.h b/sysdeps/unix/sysv/linux/sh/arch-syscall.h index 94aad0f119..37211f5f8c 100644 --- a/sysdeps/unix/sysv/linux/sh/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/sh/arch-syscall.h @@ -64,6 +64,7 @@ #define __NR_fchdir 133 #define __NR_fchmod 94 #define __NR_fchmodat 306 +#define __NR_fchmodat2 452 #define __NR_fchown 95 #define __NR_fchown32 207 #define __NR_fchownat 298 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h index d630306c75..8093abcc9c 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/arch-syscall.h @@ -66,6 +66,7 @@ #define __NR_fchdir 176 #define __NR_fchmod 124 #define __NR_fchmodat 295 +#define __NR_fchmodat2 452 #define __NR_fchown 123 #define __NR_fchown32 32 #define __NR_fchownat 287 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h index 930f29b4d2..d25ccfb571 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/arch-syscall.h @@ -60,6 +60,7 @@ #define __NR_fchdir 176 #define __NR_fchmod 124 #define __NR_fchmodat 295 +#define __NR_fchmodat2 452 #define __NR_fchown 123 #define __NR_fchownat 287 #define __NR_fcntl 92 diff --git a/sysdeps/unix/sysv/linux/syscall-names.list b/sysdeps/unix/sysv/linux/syscall-names.list index cf6f70ecd9..e478037b74 100644 --- a/sysdeps/unix/sysv/linux/syscall-names.list +++ b/sysdeps/unix/sysv/linux/syscall-names.list @@ -117,6 +117,7 @@ fanotify_mark fchdir fchmod fchmodat +fchmodat2 fchown fchown32 fchownat diff --git a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h index 58646cf0bd..de6e6323a4 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/x86_64/64/arch-syscall.h @@ -59,6 +59,7 @@ #define __NR_fchdir 81 #define __NR_fchmod 91 #define __NR_fchmodat 268 +#define __NR_fchmodat2 452 #define __NR_fchown 93 #define __NR_fchownat 260 #define __NR_fcntl 72 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h index 604bcdfa5b..dd5e196272 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h @@ -55,6 +55,7 @@ #define __NR_fchdir 1073741905 #define __NR_fchmod 1073741915 #define __NR_fchmodat 1073742092 +#define __NR_fchmodat2 1073742276 #define __NR_fchown 1073741917 #define __NR_fchownat 1073742084 #define __NR_fcntl 1073741896