From patchwork Wed Aug 21 16:15:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Wang via B4 Relay X-Patchwork-Id: 1975005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Fa55CvU4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wprzg5p36z1yXf for ; Thu, 22 Aug 2024 02:15:59 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3B77385E45E for ; Wed, 21 Aug 2024 16:15:57 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from nyc.source.kernel.org (nyc.source.kernel.org [IPv6:2604:1380:45d1:ec00::3]) by sourceware.org (Postfix) with ESMTPS id D0A9E3858C78 for ; Wed, 21 Aug 2024 16:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0A9E3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kernel.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0A9E3858C78 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2604:1380:45d1:ec00::3 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724256941; cv=none; b=KysL8zu6Z4gFcdBqcuJiIF5cjud83F4a/2hyAGt1FyEzq5ppsVPpG7F/Ji7Ue9mVXyyIr3h3g4NIF81Cmx+tqZ5bqHrALJ2FTXDG+OT4bF+9eJq0wxbmPpwI0HvuvN6bMpmlt82wgZzu617qD+RcEflee6hDFmNuf8uHYGtiALQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724256941; c=relaxed/simple; bh=+tQSXgvu3F406+wgS97ejLXohOtxstFqsmpEbWMAYnc=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=rcqy4IdMB8IK5vIvcdoIqaP9P4EVbJirTzqth6wp1OQ70DmJM+bvOatwKHvP/SYY8he5XCM9O2T716WclXI1za5dtvzuuJy8t7kgcNhYx9BdJznvDvyFRccCKlZ1F61zCPRshMID5yV7uQKLDcY6qqZq3H83gBEZTuJlrEajHJU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id BF6FEA41D64; Wed, 21 Aug 2024 16:15:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 0B1C2C32781; Wed, 21 Aug 2024 16:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724256939; bh=+tQSXgvu3F406+wgS97ejLXohOtxstFqsmpEbWMAYnc=; h=From:Date:Subject:To:Cc:Reply-To:From; b=Fa55CvU4yIawJDBV+nXwx8cX9yNQrNkUZJv9DeB8LgdlqPrG5Win+GZ9I5/wH6u64 bEq/Npar+ZPcech5QYeolF8CSZR29arRa5rgA4yEQJoLFctDYrXUfFnEHz/azp7q5G fXEqgaxSZMSc7nGJC5irODnWMDgKFxue6AE0I5pWmCgBxBtrTiwjiLZqd9jWBp2K72 c/bLOWjNsJ5igHtquI+s2ahMJ9XhXtTRedJekr2ilmI1Z1afyDOvW+bPbzZ1+/g4RD TOwXelyvRb40wLvPvfU8hdjnKW+8Z1terSWEsRb6mVyVvIMCVbx+whxhusVqrv/A+5 N/8XYRqEcT31Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00C30C52D6F; Wed, 21 Aug 2024 16:15:38 +0000 (UTC) From: Miao Wang via B4 Relay Date: Thu, 22 Aug 2024 00:15:34 +0800 Subject: [PATCH v4] Loongarch: adapt for the re-introduction of fstat and newfstatat in 6.11 MIME-Version: 1.0 Message-Id: <20240822-loong-fstat-v4-1-1c6c5f8d2437@gmail.com> X-B4-Tracking: v=1; b=H4sIAKUSxmYC/33M0Q6CIBiG4VtxHEcDBNGOuo/WASC/sqk0cKzmv PfQI2utw+/bnndB0QZnI7oUCwo2uej8lAc/Fcj0auosdm3eiBHGSc0IHryfOgxxVjMGIaHWltd CCpTFI1hwz712u+fduzj78NrjiW7v706imGLZNLqqmNSawbUblRvOxo9o6yT2x7JshWKCgwUij P225dHST1tigkkLjW45SKOqo13X9Q2pK6GkHgEAAA== To: libc-alpha@sourceware.org Cc: Adhemerval Zanella , Joseph Myers , Xi Ruoyao , =?utf-8?b?V8OBTkcgWHXEm3J1w6w=?= , b4-sent@kernel.org, Miao Wang X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4734; i=shankerwangmiao@gmail.com; h=from:subject:message-id; bh=JEMcCDuav2A7PyeIaifBvUx2xwQB3BsPqJEjDxa7oKo=; b=owEBbQKS/ZANAwAKAbAx48p7/tluAcsmYgBmxhKp8SEd8taxaX3+KrPNHlguTSizjUZz9KChz kfYcVLBMd6JAjMEAAEKAB0WIQREqPWPgPJBxluezBOwMePKe/7ZbgUCZsYSqQAKCRCwMePKe/7Z bp4ND/44ZmCP0eLb9qrvWhallf2tXyGBn4/32zTsezEPmVHpErH7N3yZYPmpZCMWzfZK2V4UGZP 5F2E/MIok4cUcJ/HKAz241dsIKANL0F72H/wIDzoiryOAGPpyHy8bpJPKIRz1DHgkCzXZsAgfzx x8hhY8/7rvgcl2ew1HDI0np5rv3XfdYYwtZVQXDjzEx4heXIUdwBV0u9dhIDArgIe3E2snhroUD DICrGgDJ8r7cHczoQpR7/RXiXLG4JDckE7ClvlWWqP48vQdRGfSjz4LaOQHn+RkOKxBOUj/2UW5 lQthoQGoJwS1m2UrWMVCXGn6zmrsXE2E1pi9iyEmlrW35x2bMmXCPrLPWD1ByMBpRS4fdIi81Ve sZqlO8aUVqE7FfDVHxwms6ap+dkEwWj/g4BeBZLa/HCFa4s+N6YPb1N9E9cpAs/Yqdu94tFugom 3WJ27LrYIdtv2SsYCFi31kicTGveR2LswFMF+EBzDKc8+3mGaI0BMpGmH5iR0U74Urv1Vo9nvhJ ZauwGESE2Yty84xcmlgvx3EYqQGo23HQFKTXYQOTVOyk0ooL6HXS7HDHMJco8ci2FlqA931BwjP foBPtaCKOnRwIfO+8zWLn/lNKpt4t3IqEUBbzZqLCPouJkw7j/04nsvxlFPz4Hmqvn3u/iopbgQ QOiKTXr95KOFaVw== X-Developer-Key: i=shankerwangmiao@gmail.com; a=openpgp; fpr=6FAEFF06B7D212A774C60BFDFA0D166D6632EF4A X-Endpoint-Received: by B4 Relay for shankerwangmiao@gmail.com/default with auth_id=189 X-Original-From: Miao Wang X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FORGED_REPLYTO, GIT_PATCH_0, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: , Reply-To: shankerwangmiao@gmail.com Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org From: Miao Wang In Linux 6.11, fstat and newfstatat are added back. We need to include this change in kernel-features.h to avoid producing libraries incompatible with previous linux versions with new headers. The definition of the two syscalls will be removed when the targeted kernel version is below 6.10.6 in loongarch/sysdep.h, since the feature has already been backported to 6.10.6 in the stable tree. Signed-off-by: Miao Wang --- Kernel 6.11 adds back fstat and newfstatat in commit 7697a0fe0154 ("LoongArch: Define __ARCH_WANT_NEW_STAT in unistd.h") for loongarch. With kernel headers from 6.11, make update-syscall-lists will generate the following diffs: > diff --git a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h > index 8bb82448a7..7e732256fd 100644 > --- a/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h > +++ b/sysdeps/unix/sysv/linux/loongarch/arch-syscall.h > @@ -59,6 +59,7 @@ > #define __NR_fsmount 432 > #define __NR_fsopen 430 > #define __NR_fspick 433 > +#define __NR_fstat 80 > #define __NR_fstatfs 44 > #define __NR_fsync 82 > #define __NR_ftruncate 46 > @@ -166,6 +167,7 @@ > #define __NR_munmap 215 > #define __NR_name_to_handle_at 264 > #define __NR_nanosleep 101 > +#define __NR_newfstatat 79 > #define __NR_nfsservctl 42 > #define __NR_open_by_handle_at 265 > #define __NR_open_tree 428 With the changes, the compiled libraries will unexpectedly include calls to these two syscalls, and be incompatible withi the previous kernel versions. This patch addresses this issue by removing the two definitions if the targeted kernel version is below 6.10.6. I have tested this patch along with the change to arch-syscall.h with or without the configuration option --enable-kernel=6.10.6. --- Changes in v4: - Separate the support of statx(fd, NULL, AT_EMPTY_PATH) away from this series. - Link to v3: https://sourceware.org/pipermail/libc-alpha/2024-August/159331.html Changes in v3: - Changed the starting version where fstat/newfstatat are supported to 6.10.6. - Add a new patch to this series, addressing the support of statx(fd, NULL, AT_EMPTY_PATH). - Link to v2: https://sourceware.org/pipermail/libc-alpha/2024-August/159300.html Changes in v2: - Improve commit message for better patch handling - Link to v1: https://sourceware.org/pipermail/libc-alpha/2024-August/159295.html --- .../unix/sysv/linux/loongarch/kernel-features.h | 27 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/loongarch/sysdep.h | 5 ++++ 2 files changed, 32 insertions(+) --- base-commit: 2eee835eca960c9d4119279804214b7a1ed5d156 change-id: 20240820-loong-fstat-f57f8be48575 Best regards, diff --git a/sysdeps/unix/sysv/linux/loongarch/kernel-features.h b/sysdeps/unix/sysv/linux/loongarch/kernel-features.h new file mode 100644 index 0000000000..8e2927c501 --- /dev/null +++ b/sysdeps/unix/sysv/linux/loongarch/kernel-features.h @@ -0,0 +1,27 @@ +/* Set flags signalling availability of kernel features based on given + kernel version number. Loongarch version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include_next + +#define __ASSUME_LOONGARCH_NEWSTAT 1 + +/* No support for fstat or newfstatat before 6.10.6. */ +#if __LINUX_KERNEL_VERSION < 0x060a06 +# undef __ASSUME_LOONGARCH_NEWSTAT +#endif diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h index eb0ba790da..1fdf18197f 100644 --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h @@ -109,6 +109,11 @@ #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name +#ifndef __ASSUME_LOONGARCH_NEWSTAT +#undef __NR_fstat +#undef __NR_newfstatat +#endif + #ifndef __ASSEMBLER__ #define VDSO_NAME "LINUX_5.10"