From patchwork Wed Sep 18 23:54:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34580 Received: (qmail 22318 invoked by alias); 18 Sep 2019 23:59:05 -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 22236 invoked by uid 89); 18 Sep 2019 23:59:04 -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=1568851143; x=1600387143; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=C3o2tGRB/LYj2izZQKmNV6M8CEkGGg3dO116Xgs6bxc=; b=VoukPdrW9yBwdREJ0Y417USZpWzkSI35wT3r5l8cL25TxPUT0wYElYWk XPgxD0JZd3LxXHXrSbfr38ao+32RRJjvmFibQ4h/ep7MF9DrmZPYvF3xk /jxTg/EcWmT1V7oG8gL2ytSm2r9JIgtWsnLLRxOlVglveABOceIm+M9U7 pS8toXUL5pv0DdJQHv40WkMVCBKTcKslE4sPjGiJM/fba+dpX+K9MnOX0 4J6w6w37xiO6Kml6VrSLaN+iVsc58CIjru1XbureB7ba+vlhfvUO9GXVi q+X6U6Kcep7t++DPj/W93xEuvN+8nRuKPIbrEQatMnFL4pa8xsDKF1WL0 w==; IronPort-SDR: CuTo23km6MRzuyqoHJKQgHR/psmBj8MwyOugdUfDtYcn1Lf87FItRwZF4euQc67VygcP/Yxjhk SrYe3ufHXPRGcmSzhJqrI6Yymtd8t+6AN7NPVWl3yZn+R2LyReK2HjVlz6CAaa5Xe4HyVWVTVr BL5xQhQG5+OwGRqKUWvSc88e/LXzeDXBkInyiG5vk0UQS/tLdxyOlUEOZCO1CAcSMoGrft5c9S acdDNfYDK3iJMfE+vLF6vRo1dBM9G+FhPhMGU8KLVPl1k6bYFtof1UHYJlnDHs+uCeQGjydIJF xpc= IronPort-SDR: BEMAIVzkSJanr2q2miak52kpN0+MV3Gd5bN6skHadLhhrcnciLmVIzGVzX+3uijv1LdKgGXTN4 3e+3u0PK8RTYqeB84ql1iDvw3uhd5m9ovDfcNQnF3mNjlm/m+tKPd1V/Tpt+7QAgpuXk4OAhSV MqTk4rXuL9Fe/tqAfai69yyDIu0ZlVG/Ir9zXqPgkCUlxpVIdkO4MtRsF+p68mNNDkuDr077t+ MJAhhzGqVnjL6kcp097VyxRAq5OfaXnuQTPU8wngC27RLE1D15FSwsu3icD53yzg09S6WKlNFc jqWOIe3nwP9hISSct5C9/p6A IronPort-SDR: zs4r6ujgMcuQmpfjs4/H9oFmyc8E59hQvVSuVxJYkdZVjsEDWwrAbEGnvKbo6zSV5dSSbiPzMV T+Z5rSNHEus5klCQ3AXTw3XugVCV0nG0NauTjUDk11hEdcdKyGeaSb4hECtcXnZamHvf6ktvyk /BlhvpbIENz7pUxsQQfMb5KXOijFCwkFmYiBhMpMU6CBT7QiItzTF7JdcMxg3ASjWBb//C5jgT y6AsFTcEri95s/Q7TpYC4RvXEFVxJuslwkwKEw0q6FIzDmBVqCFnGGZ6vgSWt9ddd0sW6TZSlp f+s= 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 v2 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts Date: Wed, 18 Sep 2019 16:54:47 -0700 Message-Id: <20190918235448.5037-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. --- v2: - Fix the #if logic 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..7ae01c189eb 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 __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. */