From patchwork Thu Aug 29 16:50:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34334 Received: (qmail 129246 invoked by alias); 29 Aug 2019 16:54:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 129178 invoked by uid 89); 29 Aug 2019 16:54:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa2.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1567097647; x=1598633647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dEg7jNE0m7kAY/tN/vHvlQluQ5qOv6sv/OB/Pun5f74=; b=gjGHc2e9U5jl3OwG+sVH6WMoZig6HzLFF4Ar3Uii3XPIO5vEf587w31+ Gnd3wd0A5k54l4bC60BW2iDSlo814aDVhUh4fZ3u96esQErFVqXfqQVwE NYH7XPf/I6DORCVv/6viwxuqky3SwTD9PbTh2X9Z+dPoas90ne11lE5J3 01z8XT1cs3m4haYicP8yzmH4V1qA2gcQczbLTZ1lgfiYsOy2hGG874Qxu PhwS7vS/krFD7BCVqyQYTK+4uaeeiTS2cEYJYr0ZpOCxs+HK6ikIr8hed FtC2YqD5PTkgyPMlfS8OsimrYMwMRwY805OfPPecT5sd2qL2QQPhMio8r Q==; IronPort-SDR: dIFZhNSMjXvFp34FW+EBIJFfayCW9L40HXpJswkuYuO0bkwCdtliILZFLGa7nU5OwVwvUchz1o D6cXxYCWu2oVVX9v7caZAQ9t09SJTBiyzrDh/F/v4fT45QNNAs7ZXeAIlNbft3JJfKjrEJqajE pE9Wa7WG03FJ1z8YPnpPakhJLRIBVrb2BOAFfj5eRBKy1feIYHKqcUAKKtg3gxzoBhJi3M3nVu C/jM76b5fMR6FosiV2nZf2fupvwDfmyCar0jz6i5lk1bJEhYg1IYD0hn5TQg27e5Ds5eAQd2PV yJ0= IronPort-SDR: ibnOhlJfH4gpWjiKLC2bcnPQv5FzPTpUBWjdaqEURZl4RQg4LIQVOxoe8R+ESzyFKOw7Yio2J7 11yP6Yv4vkQTOcIc/rjk7DYFMmh6UCB2zxliNqpD0gf/3n8oft47zg1vp3o07K9cuAqO6c+M+7 LZyKI+HM8z0Cuj3oZ4ELlAfQ1u98ypXjR9Ka3DmERV1pt/1PoddS3477IM2U41GM/8cFOXdZQT XoRibDmGrfuKMElwF4BWLsGMuhBf/AsRO587MBhm2Px3rUeT1a3oJEBdo5OzhYfqov2OHLXZzL Vu8ZrrQb1xk5Y1PdBeXGS6S+ IronPort-SDR: RSJPN0qIpdOGpd8ICIDLp1aLfPb+XX3VlOrKBp8QSmGgqm9gqwQGlf/MrISV5Htu3URyR/wk6o 0x3B+4I9DfnC1SlpUI+vEbADl65QRxCjzVAZoF8eou6KHaYW8Mc0nLBZsgk1pPjECT6+DUtUwr kMIGYieVpuRdHq0e6mLKoOSFn/vL+u8gTK+JuTOnHcAPZvhDsNTgolw47wZI7tguJ2B+AhbfvS p8TLo8jH/d/uUYlxA0V4vmCON3c4uj+FeOyfmxpg809LYnZ4kVSM+iznVMmyRgdmxOkKy/tIxK UOU= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com, palmer@sifive.com, macro@wdc.com, zongbox@gmail.com, alistair.francis@wdc.com, alistair23@gmail.com Subject: [RFC v5 08/21] sysdeps/statfs: Handle 64-bit ino_t types on 32-bit hosts Date: Thu, 29 Aug 2019 09:50:21 -0700 Message-Id: <7aad2cad9fddcadf91a6b91b348029a8801554eb.1567097252.git.alistair.francis@wdc.com> In-Reply-To: References: MIME-Version: 1.0 On a 32-bit platform with a 64-bit ino_t type (__INO_T_MATCHES_INO64_T defined) we want to update the statfs struct to remove the padding as it isn't required. As we don't have the padding we also need to update the overflow checker to not access the undefined members. Signed-off-by: Alistair Francis * sysdeps/unix/sysv/linux/generic/bits/statfs.h: Handle 64-bit ino_t types on 32-bit hosts. * sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h: Likewise. --- sysdeps/unix/sysv/linux/generic/bits/statfs.h | 5 ++++- sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h index 77de4d2fd00..a22e059ddc6 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h +++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h @@ -32,7 +32,10 @@ using __USE_FILE_OFFSET64 only see the low 32 bits of some of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ -#if defined __USE_FILE_OFFSET64 +#if defined(__USE_FILE_OFFSET64) || __INO_T_MATCHES_INO64_T == 1 +# if __INO_T_MATCHES_INO64_T == 1 && __OFF_T_MATCHES_OFF64_T != 1 +# error "ino_t and off_t must both be the same type" +# endif # define __field64(type, type64, name) type64 name #elif __WORDSIZE == 64 # define __field64(type, type64, name) type name diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h index d402d139329..4c2e43f9d67 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h @@ -51,6 +51,9 @@ static inline int stat_overflow (struct stat *buf) /* Note that f_files and f_ffree may validly be a sign-extended -1. */ static inline int statfs_overflow (struct statfs *buf) { +#if defined (__INO_T_MATCHES_INO64_T) + return 0; +#else if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0 && buf->__f_bavail_pad == 0 && (buf->__f_files_pad == 0 @@ -61,4 +64,5 @@ static inline int statfs_overflow (struct statfs *buf) __set_errno (EOVERFLOW); return -1; +#endif }