From patchwork Thu Oct 3 17:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34819 Received: (qmail 97522 invoked by alias); 3 Oct 2019 17:46: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 97512 invoked by uid 89); 3 Oct 2019 17:46: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=HContent-Transfer-Encoding:8bit X-HELO: esa1.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=1570124764; x=1601660764; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wDBjW442KGn0/jQ1gIHl/RzjOnISEs8NsBZjld/Wue0=; b=XL7rHsBc33XH/Y7aWJAh0vnEWTzjTPaIXFecYZJZ88SjFA8yhas8CMxg ktVM57L0ZVhO0SCyp2QWwDg9S9UgvsFh+Er/izcfNlJcyQpv/XP/T2ZLp /Tx3dCx2CeYNEXXhjcil2b3MoDbmmlLiJSslmj6JaCLuVlzhFRkOh/q74 GUT7YIwHGM8QhMOjPXIyuRFC+ZvUXyfF+HqIPTsbj1UrrjW0Sl/q8ilZT NvtsOAif0Tn094AKbhe0UieZoF/8b2YfKmknYRrU5gIKsWf1de70XXry8 5u6oxAVoGPqCVzRWyhAjLX1eH5ucY/KKT/9m3UEjK2DtuLtSSumE8DJF7 w==; IronPort-SDR: Xo6AjCXrqXoRlM1ZNnD0jtt3a//uRbwi1Ob57esZj3TE2uqEVYqe8d5gfJNl/klxAs8s5p2mgU IlL3+glWdJFv+oC08CqHzOig2OQ217BfsXihxK+P2MvIuIOoiaa2kA+4KjWuw0KGdDQZEtm3+j gne1LJ5H8kM0NbtN2BMD7SONk+hKqBlKAfg7bYE3fIo6Kq3uMwmqwVPsWePKcS9DgP4mA/dHFP 2IFPdITXSzZ88Dt5O1nyIuwlrCsmquSLy9sFjzSNGDflb2/vFfN1Wnlh53CENKpPwXm/3o67gt L5U= IronPort-SDR: sJrd/DpoYk3Evnm0ckllSyb9Uo1qdQoG5QSjYBFHqlHWxGnQB+E7pdTtIwe2IpxatdYdCuKVNg ti6lpIHVP/xw2O6pmU0DMic8rbl9kfYIh9qmQgm+0q/VWqtfessMAltm3ycDBEKycS2Rt+THq7 2ngUK1Ddy3FnKx4ZoGzKALtKbT/FaszN/ikBujKXzHXgxxQOL+ObLwKtsNIwm27MG1+hEuMsT3 RTatf9dqdU2+xSzkYhahmN0RlrOrePWT1lEcr56jetKagT1N7dMMXM1NKppzHRZzFTExEMAp7/ NAz00GM2vhdO7oYjOjJQcZBo IronPort-SDR: WAKlHkKrlpANQGWcSqflMxpIQDsa4m8WmT7jfOYaVTpL4dAT8JKBF5xVG/gxI0uS3XvSgx8/kZ Mx48a4OqDaBU0+7X0gXArAUxJq4oeNL6yxfQUfyifAAkF1ryK54FOfcDfs7kKQIkhUVGygCD9Z zWCKIWfwdwg6f1p/BIsqq2/eYLfMnhgVa5ThGqst0w4aguWmIBY5zGtpr4lBme3UapOR1DGxki DVNoyFbwV2HGNWVjaYQwXqv76AqQG+tktdLax1oZdqWNY+Z8RRLZZ53KUUi7voiSNMbqoZgqGd CSI= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v3 1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts Date: Thu, 3 Oct 2019 10:41:30 -0700 Message-Id: <20191003174131.18673-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. * 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. --- v3: - Don't use brackets around the defined v2: - Change to if defined instead of if == 1 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 1565f3f8248..0c1850322be 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 || defined __INO_T_MATCHES_INO64_T +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T +# 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..66546b07ccd 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. */