aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/freebsd32
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2022-03-29 17:55:21 +0000
committerEd Maste <emaste@FreeBSD.org>2022-03-29 20:10:04 +0000
commitf90cd1ae30b5f49e9f6ea58a0628ce1c8d8822bc (patch)
tree23dcdf56a830fc9531963ff68d3ab2f00427ff92 /sys/compat/freebsd32
parente123e2294cb50deb288916b79a8c05a006f8bca3 (diff)
downloadsrc-f90cd1ae30b5f49e9f6ea58a0628ce1c8d8822bc.tar.gz
src-f90cd1ae30b5f49e9f6ea58a0628ce1c8d8822bc.zip
Diffstat (limited to 'sys/compat/freebsd32')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 01337ea51c50..2b20170bfd2f 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -2176,6 +2176,17 @@ static void
copy_stat(struct stat *in, struct stat32 *out)
{
+#ifndef __amd64__
+ /*
+ * 32-bit architectures other than i386 have 64-bit time_t. This
+ * results in struct timespec32 with 12 bytes for tv_sec and tv_nsec,
+ * and 4 bytes of padding. Zero the padding holes in struct stat32.
+ */
+ bzero(&out->st_atim, sizeof(out->st_atim));
+ bzero(&out->st_mtim, sizeof(out->st_mtim));
+ bzero(&out->st_ctim, sizeof(out->st_ctim));
+ bzero(&out->st_birthtim, sizeof(out->st_birthtim));
+#endif
CP(*in, *out, st_dev);
CP(*in, *out, st_ino);
CP(*in, *out, st_mode);
@@ -2337,6 +2348,18 @@ static int
freebsd11_cvtstat32(struct stat *in, struct freebsd11_stat32 *out)
{
+#ifndef __amd64__
+ /*
+ * 32-bit architectures other than i386 have 64-bit time_t. This
+ * results in struct timespec32 with 12 bytes for tv_sec and tv_nsec,
+ * and 4 bytes of padding. Zero the padding holes in freebsd11_stat32.
+ */
+ bzero(&out->st_atim, sizeof(out->st_atim));
+ bzero(&out->st_mtim, sizeof(out->st_mtim));
+ bzero(&out->st_ctim, sizeof(out->st_ctim));
+ bzero(&out->st_birthtim, sizeof(out->st_birthtim));
+#endif
+
CP(*in, *out, st_ino);
if (in->st_ino != out->st_ino) {
switch (ino64_trunc_error) {