From patchwork Thu Aug 29 16:50:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34333 Received: (qmail 129014 invoked by alias); 29 Aug 2019 16:54:06 -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 128965 invoked by uid 89); 29 Aug 2019 16:54:05 -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=+J/T+NIuBzdwf4W5K5OKObTi2MmZuE3h2GZbKO9PWfk=; b=K3XZXbX4BeGHQ9xmoFD6PX9ygwCExHLv9wiRDl+ezifSN+FPXS3oaZeb NHbKCXzbuVQfiQtCEoztdIOyhg+eotl96eDkp2JgxOmNCoBJCzDS4cyy1 e2ypnB4nILOaoXV3bjUAH/EF0z0mhf7S71rT78kc0Qco0q0oAPvwkCdZc 8OAg85FFvsqFnu+ob9WnHD74RUeD8lX9qugV9MwbOXC2PLfJuk1U+GySw FcKW/xebjHnOBSDAoqjUhMn0MGuKOhJPbBCBFe8in8pCdG4ixi52pU2f/ vX8jjDsgELur6JAK/al3SbDc9dDjO18y//00hogNq11PREMTFgBwnFGnu g==; IronPort-SDR: 9U04TZYx4kBOzMimHEWGESK7m4GR/AqzihBMg0BupWqqxTBJfHQHCzsFKvxqoNfvkJCWcO+G09 Uro0D/R352MHuNvKD1q1VnuueKD2tLsWzaZshoJNeZQAgEt3Xvgz3zgIImfAKhvfVbaVJ9dtuP Oepf+be4/UYSKyJnlXPt0p6OZjiQGSWmayxoQWTp/CITChXve+SHrkvy3wZBsPup2Khgrba2Y1 RMqxEPEf10NdPIvhQ1jPWhEFotf0IGnY1fXB8LQphRHLEvpNm4xoSmalENGnhEu14krlNBEA53 hdc= IronPort-SDR: BhBghGooJtpnw6yeCEZjJAc3nFng17FnfGY8UsK3mJVjgmXZaw6wOiH9aYnGIeTLvanqQT9Eg0 9O/MG6mXRyosbL6si+AatwV+8ddIFVT+8cEzD3DU7Ipg0A3HweFbLs0DVnBziZSmZXLTeitCZX G2ECrfi+K5iXcVbND4620wThcmGCLwF56/qbcq8qL9OmS9Vc/XVQAlfZZ4V7eno7iKvY2sm/wg /edjzVgJr/c79jU8L2L/NbXDNqdgmBWfPYONALX0wGpJuRJowgBb/We7bVnoK9ilO/4gzAcHob /1u36L9NyPLtMrdo9cDPptzr IronPort-SDR: 1hLMFe2CwTIqMsPdGwt2v18Ad6Je0c78ftw79Ctfnf3CDVx3l+kfqZxdrbB+3k3k7vH1EmprHM DGF0gW1wf2WrBjKvoshPODcZe9sgDPM6wJoqg5sZdocVQhO691qMxwJ+HfxOjymgjok/tiRt+p 9GZ+vWs19ZUEXq63ltqS7J2LeOjolY7zLYPl5yzXLBLIkt7ps3FtXZglIAqJF/Otmf5QxWWq96 AZBICvcSgT7TYSMDJ4WHAcrRSPJvG6hbgjltuqbUUb9U3SuUsDFlSiwXMsSabIjMxOytUj3l4V xL4= 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 07/21] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts Date: Thu, 29 Aug 2019 09:50:19 -0700 Message-Id: <1596e099b974615e2a7c9ff54c340ca791a40473.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 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. Signed-off-by: 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 e5c26501047..ddb1e593051 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 6c17047e4c6..d402d139329 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. */