From patchwork Mon Sep 16 22:16:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1163118 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105193-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="smt0r0JU"; dkim=pass (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="VcT5Mc03"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XLLR1fdmz9sN1 for ; Tue, 17 Sep 2019 08:21:19 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=QST llFFaCy382N1DIerRkV6NfsckeUn1/Cic77cE5O4u7NavmwKDLp9BN0dLduWJxIP jR0bUIRHbfs8NLUqQD8agZpOm9bRHf3GCTnEWnxU7uV2NY4LwlnpNubIqRrM3NQB so+oSM5u0xQQjKHJImDJX6oln5GtZCGXA5FHm/hs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=VtSLrC6IJ 9rM+UBdWFG6nreAEyw=; b=smt0r0JUY++c4Om0B2vrviNVznvqsPVNbv9vC5cZ9 sOJ4cqICGth3d0b83UhvbExYDjc0f1FoC5UGT7JHq4HnO7nv9Ac1sp/qiO1dQjyG sjT+4uLBKKk2WjUlKw1QaeRtCuwGlGNvHQ1comsdnQAbYrq+HUGpyNmBF9D30sZS R8= Received: (qmail 22352 invoked by alias); 16 Sep 2019 22:21:13 -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 22344 invoked by uid 89); 16 Sep 2019 22:21:12 -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=HContent-Transfer-Encoding:8bit X-HELO: esa3.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=1568672471; x=1600208471; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/lzoIjpRlWGm1oyoq4SNbUcL2ou0F/3dxBQs3KutfH4=; b=VcT5Mc03RFgTUnM5+FQ7JdGkLPd+nxBo8mMayf7TKOiT0YSYfU3DsQiy DEic6XxuqEMvrUcUjhoYEuV6pPa1G2uyB8Xa5dPPGjw9CruGsgsdTedeX EQ4vEcfd2i2GbSttcKuqWVMr0n2wj7ScJCIz6ecq/x3/zb3S7bgt4lH6o VwQrt+J8l8TkAZDXeS3OCwPUH4+ZpQ1MYN2qPNh05fEvYumizBsxyQlzf aLQayaoozdxyouNJ00ILIXtklUczWKZy14VreYfdAFOMa0hnAlaAJA+Xv KXzHVixAbOzuRpilydsecLGHpnu827KC3Ce1cN6q5CPbsVuHckto6cfOq g==; IronPort-SDR: kpVYai3zx+u2GE4/mRYSa/ZjG8HWyOtAyNJG0oSx7oBAHS5f56bJcMr6OuJ9Xo20UieISfbRd2 ex4acMSLBrNrgC4K/zF/4ko5ymcWQ+H8pRZ2Y5YsailcTyPTuc1aUhpdTOHT3nJyZiRcMtED+H Dk+WDkRpAIRReB2dsGhE2hSc2tIrWw2DKn7FfPu5PmSjIEKcUTgtDn7ISYEQe/v9v6PF0gGtiN xCeBpBS507wmECtDdbFJ9UbOTTKkpYzxdjNkTyJEyKx4UYKIjZR9vB0y7lXsIxF+diJWdsPmxS zxk= IronPort-SDR: ig2R6Yg0zFncIm0zlpT1JX3KxXoN0Dh7/hAbEh8Gh0NBV8rUw/+wAuQeO+9vwdmNhllgEoqqLD QAb3YHV8nnVMI+nrnEWl+9IBsUjRohv9scpomF4qxJZyMy2nHwZ2xttf6VQu6eX5hOg8OUkLRg tbR4RDLYCC82a0roKZOiCN1seeXsMAb5M/CuJafIX9tzwv77psDixj0C1q6TM3apbzIbOBYSK1 HOZVldPOqBm7X5GYaLkvqG1XulzMVsJ6pJrbObBFGEPkAKi/gPqAJ2at1pTE8Yo3h6qN3YVmKg W4/YU6SlD0A45KWq9LWQ1k8g IronPort-SDR: C4WgxnpEXPoPpFOCaFp3d7Ww0T4zHqeeygZ95a7hN0nZYfsLg0Jh/ZQ7PepUgz+6f4/GUdXUZe qAIeUczmj6Y8oIqpe58/vzysC+z1aHdD4rxmx6FAXYvgM6GPWRYum8WkxW+mJbcRXn+aLpaNZP 7gm4SF2b2rzUwEATl3spU/YkB5VCXrhKzlWJI9m3WqlV2IW0jphiy8KvEuI1xEiDQONxrStKD6 j4YtqG/M/LEu01nDk6XL7elYwZGxYILCAn8JwohT6W9eCwkND8pzx83h2ocHiINSyKfZ0nK51m Avg= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, alistair.francis@wdc.com, macro@wdc.com, alistair23@gmail.com Subject: [PATCH 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts Date: Mon, 16 Sep 2019 15:16:59 -0700 Message-Id: <20190916221700.22039-1-alistair.francis@wdc.com> 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 stat 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. 2019-09-16 Alistair Francis * sysdeps/unix/sysv/linux/generic/bits/stat.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/stat.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/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h index 62aeea5a88d..acd8e7c79a6 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h @@ -40,7 +40,10 @@ /* Versions of the `xmknod' interface. */ #define _MKNOD_VER_LINUX 0 -#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 45efcd8fd34..3c21da501b2 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h @@ -36,12 +36,16 @@ static inline off_t lseek_overflow (loff_t res) static inline int stat_overflow (struct stat *buf) { +#if defined (__INO_T_MATCHES_INO64_T) + return 0; +#else if (buf->__st_ino_pad == 0 && buf->__st_size_pad == 0 && buf->__st_blocks_pad == 0) return 0; __set_errno (EOVERFLOW); return -1; +#endif } /* Note that f_files and f_ffree may validly be a sign-extended -1. */ From patchwork Mon Sep 16 22:17:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 1163119 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-105194-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="TCF8iORv"; dkim=pass (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="ZBjO/8/l"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46XLLb189hz9sN1 for ; Tue, 17 Sep 2019 08:21:26 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=UoRVHB9IWjZw5vNh4XvCAbKZw7OPMiN9g+NLA81J+V+QcKjY/LzTl NZwjOH17eHRJR68OVfRlUh6fHtFv958AbsdurSHV/+xiwmSj5oHZzSLNnckDdWI+ VXZO2vjOx2W19o9eVL5N9NtEuoxMKOv+zxfFE9BMKltfUBFNcepZjY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=LIDufpkkWW7S5Fswkl9Wmujn1nM=; b=TCF8iORvCuiG/LyRx8KYGi/TsdWH C+zd0026xktJfghuFp7foQOZE/OoBXHPDh0FH6lfWR/hE/jGWRTZJu8zzKVeassN /+yzTIYiEKfA5GR2JMVltU9yFzAGKqHY7bVR1UrN+pyJE9Bt2bY0jD/CD7NSeoFp tXcv7tM6ea473oA= Received: (qmail 22635 invoked by alias); 16 Sep 2019 22:21:14 -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 22559 invoked by uid 89); 16 Sep 2019 22:21:14 -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: esa3.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=1568672473; x=1600208473; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jiGprlhsIhx1bXbMirHuitdmMRYWimckJ+EGxdtzV+o=; b=ZBjO/8/ldKg+1iGl+oXlzY0vDR17JYECPnPvF+nx2E9Bvu53tEp9LBf7 WjT3q0PW9zhEsArZEXMKtgx6m24n/x9Nh6cekiWflOFKqOOr4atB7bnJX aHbIS2aHU+e3B551zx7GOnkXOyS7AeY5NGtnZ0TagjHqB3Xf5cWs6HBsp zZ/I1Uj2JUgtG0Ye73xkxrSD1r/Ucjo+9KQfuC2TQhQL2+buHQujieo/4 mWmOtQP4Ko5SsKpEYDyahonYuCfbNCRg1UJSoW18NZInprHu9rnWaQmJz dWLWoI6C4ICz3Hw942rSCVNm81ZaYbvTw5plaBcwRl85PL37rx7yIR4B0 Q==; IronPort-SDR: V1LCrrCUAikN1Yoh+QdciQ0xgqunhR4VZvX/zk4tO9jIgZUwuAm8LUDmdwOQbdnT/t+oYJHMaG zHgIQOZ2h5m4VnRXA4Jryx4WTvp7Gxo2Tek1S1FmbzMfznNcFmdcFBc6MVdWzbP33o9QtoL2cK vKw5Nej63vFLIpLdNtBB5vbGvnKE7QiDTjpaq1IQFHyxRCO6DaVZjLaU2UGm7JTN0oZp4khgYY Ok/Ur7VB1YA5IMvBDraCId2cW5Ptg3psDc7rR505MMDtAdGO9gEj9C6vBhipNN4oytvP+EERw5 qZ8= IronPort-SDR: j7nzqtu0t2IKXpzjzUIr1iL8RNy5sCv9vg/6WVDPRnOXHTJd/7rdslhoP9WFa7oY58fhUe7O99 BPm0cJTuNDI0Sz0kaPt9jPb2msLRL44OL2vaPLuEwT99mISx1i40ySoS21AZBr86kuIYGAb9lo uC+fDDV1HHJSxIugt4iaKky8RTvbxTDmPtR1b040/21JC/jPsb9v2Y8yGvffrrTdWMRzWbvT/x zfdROV7KmhnCgkUF7kF0iOMQS1/CnY5cx9kKWBjhBycDAIkJdzY4WRQdmbmT4QKTRusXHtyQs3 K4GgAbox9KLw6rmBiYLtpWsS IronPort-SDR: uVF0E3EX8i11c2Mg24ogwF9eACKmBQxwhVUBHBYVT3IdwQsqviMMn269u1McooEnWEnJbGbiGC mnSufXR5NnWLOXF/rJsiDGEUzh4TaHyKeENyb4wwHIcbZj+tCSAEq3z1WB3BPBGVlD3d17YrXC fHi92uCMFdnEnZgIkEoPYC7jQxIVUcWpuF18Nd6x0BuDBkoAQDVJbGgu3yL9ehv8DGlpZS512i EnCMZCMLQbqal6t4YoVglceREdA0jApADau8ucoXGIfXnTe2qhSHGEG4OlJAa14hqq1j+MWWRR n30= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, alistair.francis@wdc.com, macro@wdc.com, alistair23@gmail.com Subject: [PATCH 2/2] sysdeps/statfs: Handle 64-bit ino_t types on 32-bit hosts Date: Mon, 16 Sep 2019 15:17:00 -0700 Message-Id: <20190916221700.22039-2-alistair.francis@wdc.com> In-Reply-To: <20190916221700.22039-1-alistair.francis@wdc.com> References: <20190916221700.22039-1-alistair.francis@wdc.com> 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. 2019-09-16 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 3472084ade0..eab1439acff 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 3c21da501b2..df35c69c09f 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 }