glibc/sysdeps
Adhemerval Zanella 42d6270439 linux: mips: Fix getdents64 fallback on mips64-n32
GCC mainline shows the following error:

../sysdeps/unix/sysv/linux/mips/mips64/getdents64.c: In function '__getdents64':
../sysdeps/unix/sysv/linux/mips/mips64/getdents64.c:121:7: error: 'memcpy' forming offset [4, 7] is out of the bounds [0, 4] [-Werror=array-bounds]
  121 |       memcpy (((char *) dp + offsetof (struct dirent64, d_ino)),
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122 |               KDP_MEMBER (kdp, d_ino), sizeof ((struct dirent64){0}.d_ino));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/mips/mips64/getdents64.c:123:7: error: 'memcpy' forming offset [4, 7] is out of the bounds [0, 4] [-Werror=array-bounds]
  123 |       memcpy (((char *) dp + offsetof (struct dirent64, d_off)),
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  124 |               KDP_MEMBER (kdp, d_off), sizeof ((struct dirent64){0}.d_off));
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The issue is due both d_ino and d_off fields for mips64-n32
kernel_dirent are 32-bits, while this is using memcpy to copy 64 bits
from it into the glibc dirent64.

The fix is to use a temporary buffer to read the correct type
from kernel_dirent.

Checked with a build-many-glibcs.py for mips64el-linux-gnu and I
also checked the tst-getdents64 on mips64el 4.1.4 kernel with
and without fallback enabled (by manually setting the
getdents64_supported).
2021-01-22 15:44:41 -03:00
..
aarch64 aarch64: revert memcpy optimze for kunpeng to avoid performance degradation 2021-01-21 16:44:15 +00:00
alpha Remove dbl-64/wordsize-64 (part 2) 2021-01-07 15:26:26 +00:00
arc ARC: nofpu: Regenerate ulps 2021-01-17 16:39:45 -08:00
arm Update arm libm-test-ulps. 2021-01-18 20:22:51 +00:00
csky Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
generic Use <startup.h> in __libc_init_secure 2021-01-19 09:55:47 -08:00
gnu Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hppa Update hppa libm-test-ulps 2021-01-18 14:23:10 +00:00
htl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 configure: Check for static PIE support 2021-01-21 15:54:50 +00:00
ia64 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
ieee754 math: Add BZ#18980 fix back on dbl-64 cosh 2021-01-11 16:56:33 -03:00
m68k Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mach Revert "linux: Move {f}xstat{at} to compat symbols" for static build 2021-01-21 14:11:53 -03:00
microblaze Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
mips Update MIPS libm-test-ulps. 2021-01-18 21:36:00 +00:00
nios2 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
nptl Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
posix posix: consume less entropy on tempname 2021-01-12 09:50:54 -03:00
powerpc powerpc64: Select POWER9 machine for the scv instruction 2021-01-22 10:45:27 +01:00
pthread Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
riscv riscv: Initialize $gp before resolving the IRELATIVE relocation 2021-01-10 21:25:16 -05:00
s390 Remove dbl-64/wordsize-64 (part 2) 2021-01-07 15:26:26 +00:00
sh Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
sparc Remove dbl-64/wordsize-64 (part 2) 2021-01-07 15:26:26 +00:00
unix linux: mips: Fix getdents64 fallback on mips64-n32 2021-01-22 15:44:41 -03:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
x86 x86: Properly match CPU features in /proc/cpuinfo [BZ #27222] 2021-01-22 10:15:46 -08:00
x86_64 configure: Check for static PIE support 2021-01-21 15:54:50 +00:00