From patchwork Tue Aug 20 12:27:51 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: 1974400 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=f1/XcH1D; 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 4Wp7zb23C9z1yf6 for ; Tue, 20 Aug 2024 22:28:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2384038449C6 for ; Tue, 20 Aug 2024 12:28:25 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by sourceware.org (Postfix) with ESMTPS id BE053384A433 for ; Tue, 20 Aug 2024 12:28:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BE053384A433 Authentication-Results: sourceware.org; dmarc=pass (p=none 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 BE053384A433 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=139.178.84.217 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724156887; cv=none; b=cBStClck3TLY9SsL41hFfRloo+epe9LiJqioy4pRdMo+MAFGLRBACb16bxOkDwz0KdrlP/RwCxeERTKl4bi1h7uhQuZvsBfpdbci2RMKD6jHy7qTgjZkR7yiA9WluibyIqmhuZMkd6xM7r/RUfr9mZ2pQdl2080MKNptbmDVwag= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724156887; c=relaxed/simple; bh=mGOFdlD/OE/uIIQxIcWVhBTDIQfxrgMYBS+f9+Z4T9g=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=m/C9c5dAC3zT8hMRfnQ60e9CcsJQYSlYtjwSm57PtCK3Eo7ZLG438HV5e5MobN23uZvlRdxrrDx4SbZLKpBlFM/Lh8t7rYXvVe/0J7XXN0JY//IDTen02SX82syIZlY/173uj2VkmwIQ53h9K2V+wZsezpQdwqrbf4QywLrGBVg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 34EA660E16; Tue, 20 Aug 2024 12:28:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id C499FC4AF1B; Tue, 20 Aug 2024 12:28:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724156882; bh=mGOFdlD/OE/uIIQxIcWVhBTDIQfxrgMYBS+f9+Z4T9g=; h=From:Date:Subject:To:Cc:Reply-To:From; b=f1/XcH1DzaxUcGo40zfi5DX+YodMYMBKsb/Y7amBlOJqbWYkXpEEqbbDCiEpwR8Xy 8TFwNjOwO04SUvpW4KoEe2cDQh/UGiNt7Am0C55Dn9IW0qW5Zpx/Fho60aiddvhK0D dvS/u/Ppu9saO1B37CVkyjMzBSPJhLMU6Rgno2zMEjFlwAP+S/vRDIoh2rTCLfaB/9 KkND0Gsm5PY5OzxqNjdvoN6WyQLqzTF2pnRo2L0DqBQ7GW2G4ImcqCP03LpGX97Ac9 /e0yOQer/Bx5nRl7x0vIjRKfztbcceDsC8/T7QHGv8kBtz2cmrNooHQXzK3EArjcAX Xvxj1CgNLiVmA== 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 A7768C3DA4A; Tue, 20 Aug 2024 12:28:02 +0000 (UTC) From: Miao Wang via B4 Relay Date: Tue, 20 Aug 2024 20:27:51 +0800 Subject: [PATCH] Loongarch: adapt for the re-introduction of fstat and newfstatat in 6.11 MIME-Version: 1.0 Message-Id: <20240820-loong-fstat-v1-1-799b6627bb2f@gmail.com> X-B4-Tracking: v=1; b=H4sIAMaLxGYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDCyMD3Zz8/Lx03bTiksQS3TRT8zSLpFQTC1NzUyWgjoKi1LTMCrBp0bG 1tQDKZlzCXQAAAA== To: libc-alpha@sourceware.org Cc: Adhemerval Zanella , Joseph Myers , b4-sent@kernel.org, Miao Wang X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=3975; i=shankerwangmiao@gmail.com; h=from:subject:message-id; bh=Zh2HgNAub7JJgXNZvEVyMiCH7kcM0TCZA32I/YLUcVU=; b=owEBbQKS/ZANAwAKAbAx48p7/tluAcsmYgBmxIvQrF0sCtQZ6786vtlAdMgZC8Q1dxvMF48Yf Con4K+RBK2JAjMEAAEKAB0WIQREqPWPgPJBxluezBOwMePKe/7ZbgUCZsSL0AAKCRCwMePKe/7Z bpg9D/4++D5ORomXcx3yamGI7sDNtP8s+ccXHi4KZR6IGj5HsCYyc/lks4ARHKEmmh1pjyZ9lDc fW/NJOzMfLqzdnsPTFYENQePjXPRJuOpthqvHGlHvvgEHvcK9Ig/j2z0CP0scnwKERS3/utWU1Q FF4I3uoW282nwTiqfUaeb7hthm0mw3K2mxQr42C91KViFA4iR5T3boYpxwbUVqfG7r+GINIsjtH FA323pj2YdwUWSXH7fVlT7BAzA2IBQn67l+Ebk9zyu+h3bNcqNj1b3mGqbboghDqGy+hLgW4EoB p09m9AtEq1aywxzTWSTsI6vL565t7JWGKy10qyulrg3IUHd59GincCcVSDRC+GdcZZ4GYZ6+3CH f0sw1i1OOtzcOVugY90W/eAsvo3Z3BEldPsEHzRUR6BOvNabHKlgpjMtIafdqD+V7GcQJ1gczN3 aV1TRrllUakmi+Nbz1GeeKcOTW7Q5IjFfbvrH/0FHV/lrK75+EeUkL3Xm7hXrwjS1fyN6GPp3aI 64ONOYwA6/AOGKwIY2v5X+o0zPeEIFfPq8Sqlls1MC3jhnzPKEHR5CWSHkaIaC7cqgenqnWJwzn dML+F/eK1QfCnYvjEEETEcvqEbVeMcOYnUbV4/w8C62K57icBU4Q9Sv2U3kj9FIX5GvMGN/JlLE QOCJo1m/hgdkRGA== 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=-10.6 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 defination of the two syscalls will be removed when the targeted kernel version is below 6.11 in loongarch/sysdep.h. 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"). With kernel headers from 6.11, make update-syscall-lists will generate the following diffs: --- base-commit: 2eee835eca960c9d4119279804214b7a1ed5d156 change-id: 20240820-loong-fstat-f57f8be48575 Best regards, 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 that changed, the compiled libraries will unexpectedly include calls to these two syscalls, and be incompatible with previous kernel versions. This patch addresses this issue by removing the two definations if the targeted kernel version is below 6.11. I have tested this patch along with the change to arch-syscall.h with or without the configuration option --enable-kernel=6.11. --- .../unix/sysv/linux/loongarch/kernel-features.h | 27 ++++++++++++++++++++++ sysdeps/unix/sysv/linux/loongarch/sysdep.h | 5 ++++ 2 files changed, 32 insertions(+) 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..c0e7ccb5de --- /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-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.11. */ +#if __LINUX_KERNEL_VERSION < 0x060b00 +# 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"