GNU bug report logs -
#43513
readdir misbehaves when running 32-bit user space on a 64-bit-kernel - kernel/userspace interface mismatch in getdents64
Previous Next
Full log
Message #29 received at 43513 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Ludo,
On Fri, 25 Sep 2020 12:13:40 +0200
Ludovic Courtès <ludo <at> gnu.org> wrote:
> Let’s fix CMake (and JSON-C?) in ‘core-updates’ or ‘staging’ (using a
> graft for CMake wouldn’t help because CMake is used at build time.)
Sure--cmake upstream will fix it anyway and make a new release.
But I now opened bug# 43591 on guix-patches in order to find all the OTHER
problems this causes we didn't see yet. I already ran it on my laptop in
order to find all the users trying to stick a 64-bit value into a 32-bit
slot and it looks very bad--there are instances of this problem in libstdc++,
binutils bfd etcetc.
I suggest to delete all ARM substitutes that were built on x86_64 machines
and disable the builders using x86_64 to build ARM stuff in the mean time.
What that has built is VERY MUCH not reliable since readdir() was broken
sporadically--and compilers need that :P
> It doesn’t make sense to cross-compile from x86_64 to i686. Instead we
> should use a native build, but an i686 one:
>
> (package/inherit qemu
> (arguments `(#:system "i686-linux" ,@(package-arguments qemu))))
Sure.
I'm still hoping we can skip the workaround and do the right thing instead
(compiling everything with -D_FILE_OFFSET_BITS=64 regardless of architecture).
I thought this matter with making everyone use LFS was settled in about
2007--but no, here we go again :(
Even if we did the workaround with qemu here, that still means the kernel
(via a compatibility layer) is going to lie to qemu about file offsets and
directory entry hashes. That doesn't sound good for reproducibility.
Also, I want to be clear that qemu is not at fault here.
It's fundamentally unsound to call getdents64 and expect a value with less
than 64 bits back. But that is what glibc does.
Users (other packages) who use _FILE_OFFSET_BITS=32 (by not setting
_FILE_OFFSET_BITS at all) in 2020, those are at fault.
> Likewise for AArch64/ARMv7.
I do not think the X86_32 compatibility layer works on aarch64, so now we have
a problem. That means building stuff for ARMv7 on aarch64 is not reliable at
all.
The right fix is to always use "-D_FILE_OFFSET_BITS=64" in user space. Then
none of this weird stuff needs to be done.
[Message part 2 (application/pgp-signature, inline)]
This bug report was last modified 4 years and 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.