From patchwork Tue Nov 1 21:29:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 1697908 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=aurel32.net header.i=@aurel32.net header.a=rsa-sha256 header.s=202004.hall header.b=b+hB8W/X; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N238S2BrYz23l6 for ; Wed, 2 Nov 2022 08:30:16 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64BA93858CDA for ; Tue, 1 Nov 2022 21:30:13 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hall.aurel32.net (hall.aurel32.net [IPv6:2001:bc8:30d7:100::1]) by sourceware.org (Postfix) with ESMTPS id BC1493858C2F for ; Tue, 1 Nov 2022 21:30:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC1493858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=aurel32.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=aurel32.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Content-Type:From:Reply-To:Subject:Content-ID: Content-Description:In-Reply-To:References:X-Debbugs-Cc; bh=Osd3lO5gs0EZ7BrxfUxtrfp90gXXZdUMcwqbuzqlfrY=; b=b+hB8W/XLA7NLUtwbdYYCNPXPn Eqj8MGM5B4VBE0gApdu3mT80W07T4IRLXLrVuObumayvSebOvrfXNNGH+N/t2KavKD+bHVxGxcgHD zqoJC5BOW8jJhS7sQBqMfmH2phD79kI8laY+dRI7dJuQqC7dNokny+zyTrCqCoPysLxAoc5B/GP25 IJino/MDANCs/uqehRQSHDoKR1+etlnWRWcFqS/x+NpfLqhU7ZK0mEcskUajxSbhOODlgjaLYPvJC isSRW1sBSTA+lWkHP4z5SvJT8AhztyunwKR1mfbwPFXK3+IW0lgiZP+q3vSbI7YSPH7D++htdSBJF Tg5NBxQw==; Received: from [2a01:e34:ec5d:a741:8a4c:7c4e:dc4c:1787] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1opypc-002WXR-7W; Tue, 01 Nov 2022 22:30:00 +0100 Received: from aurel32 by ohm.rr44.fr with local (Exim 4.96) (envelope-from ) id 1opypb-0005ml-2H; Tue, 01 Nov 2022 22:29:59 +0100 From: Aurelien Jarno To: libc-alpha@sourceware.org Subject: [PATCH] linux: Fix fstatat on MIPSn64 (BZ #29730) Date: Tue, 1 Nov 2022 22:29:48 +0100 Message-Id: <20221101212948.22222-1-aurelien@aurel32.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, 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.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: YunQiang Su , Aurelien Jarno Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Commit 6e8a0aac2f883 ("time: Fix overflow itimer tests on 32-bit systems") changed in_time_t_range to assume a 32-bit time_t. This broke fstatat on MIPSn64 that was using it with a 64-bit time_t due to difference between stat and stat64. This commit fix that by adding a MIPSn64 specific version, which bypasses the EOVERFLOW tests. Resolves: BZ #29730 Reviewed-by: Adhemerval Zanella --- .../unix/sysv/linux/mips/mips64/n64/fstatat.c | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fstatat.c This is similar to patch "linux: Fix fstatat with !XSTAT_IS_XSTAT64 and __TIMESIZE=64 (BZ #29730)", but using a separate file for MIPSn64 instead of #ifdef, as suggested by Adhemerval. diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatat.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatat.c new file mode 100644 index 0000000000..fe6c3a0dda --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatat.c @@ -0,0 +1,51 @@ +/* Get file status. Linux/MIPSn64 version. + Copyright (C) 2022 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 +#include + +/* Different than other ABIs, mips64 has different layouts for non-LFS + and LFS struct stat. */ +int +__fstatat (int fd, const char *file, struct stat *buf, int flag) +{ + struct __stat64_t64 st64; + int r = __fstatat64_time64 (fd, file, &st64, flag); + if (r == 0) + { + /* Clear internal pad and reserved fields. */ + memset (buf, 0, sizeof (*buf)); + + buf->st_dev = st64.st_dev; + buf->st_ino = st64.st_ino; + buf->st_mode = st64.st_mode; + buf->st_nlink = st64.st_nlink; + buf->st_uid = st64.st_uid; + buf->st_gid = st64.st_gid; + buf->st_rdev = st64.st_rdev; + buf->st_size = st64.st_size; + buf->st_blksize = st64.st_blksize; + buf->st_blocks = st64.st_blocks; + buf->st_atim = st64.st_atim; + buf->st_mtim = st64.st_mtim; + buf->st_ctim = st64.st_ctim; + } + return r; +} + +weak_alias (__fstatat, fstatat)