public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "danny.milo at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/23960] [2.28 Regression]: New getdents{64} implementation breaks qemu-user
Date: Fri, 02 Oct 2020 10:41:42 +0000	[thread overview]
Message-ID: <bug-23960-131-A44tK6UJPj@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23960-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=23960

--- Comment #61 from Danny Milosavljevic <danny.milo at gmail dot com> ---
(In reply to Florian Weimer from comment #60)
> (In reply to Danny Milosavljevic from comment #59)
> > It's impossible to store a 64 bit result into a 32 bit slot.
> 
> You can do something like that if you can maintain a translation table. The
> kernel cannot do it due to the way the getdents64 system call works. glibc
> can do it for telldir/seekdir (allocating table slots on demand), which are
> the interfaces that are actually problematic.
> LFS does not change the return type of telldir.

>So it does not fix the issue. 

I know what you mean.  Given the seekdir and telldir interface as it is now,
mandating LFS does not fix telldir and seekdir, because they use "long", not
"off_t".

The correct solution is to change the POSIX standard, too.  Short term, that
won't be done.  But it still SHOULD be done.

In the mean time, I agree, you could make a mapping table for the rare cases
where telldir and seekdir are actually used.  The question is where to store
the latest (64 bit) d_off in the mean time (until telldir is called and you
need it)...

However, the current practical problem is much worse:

32 bit apps on 64 bits cannot reliably call *readdir* without using LFS.  So
far, Guix distribution has had to patch: gcc's libstdc++-v3, libidn2,
fontconfig, libtasn1, openssl, libtool/libltdl, rhash, cmake-bootstrap, cmake,
cyrus-sasl in order to even be able to *compile any end user program* as a
distribution using cmake.  That had broken the entire distribution on 32 bit,
to the point I'm now asking to remove 32 bit support entirely from our
homepage.

Just to be clear, that is *without* using qemu.

This problem affects even 32 bit distributions without LFS on 32 bit kernels
(that is not a typo)!

And if you enable LFS, it totally works fine in practice.

I estimate that compared to that, seekdir users are few.  And I agree that
those  users still have a problem even after enabling LFS.

> We need to maintain a translation table for telldir and seekdir in
> DIR. It can be filled on demand, so that applications that do not call
> telldir are pretty much unaffected. The only thing that is a bit tricky is
> that we have to pre-allocate the slot during readdir because telldir must
> not fail.

I argue the easiest fixing step to do is still to mandate LFS.
Then glibc works in practice.  Without, it *really* does not work--even in
theory.

But sure, also put workarounds into telldir and seekdir.  If possible.  Is it
possible?

(readdir has been broken the last few glibc releases--I had thought it was my
imagination that the compilation of gcc would always be stuck in an endless
loop on armhf--but now it all makes sense).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2020-10-02 10:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-23960-131@http.sourceware.org/bugzilla/>
2019-05-01 20:33 ` chewi at gentoo dot org
2020-09-17 21:42 ` tg at mirbsd dot de
2020-10-02  8:54 ` danny.milo at gmail dot com
2020-10-02  9:36 ` danny.milo at gmail dot com
2020-10-02  9:46 ` fweimer at redhat dot com
2020-10-02 10:41 ` danny.milo at gmail dot com [this message]
2020-10-02 11:03 ` danny.milo at gmail dot com
2020-10-02 13:17 ` jrtc27 at jrtc27 dot com
2020-10-02 14:22 ` adhemerval.zanella at linaro dot org
2020-10-02 23:06 ` tg at mirbsd dot de
2020-10-03 13:54 ` fweimer at redhat dot com
2020-10-03 13:55 ` fweimer at redhat dot com
2021-08-24 11:48 ` glaubitz at physik dot fu-berlin.de
2022-05-15 20:53 ` glaubitz at physik dot fu-berlin.de
2022-05-16 12:06 ` adhemerval.zanella at linaro dot org
2022-05-16 20:11 ` glaubitz at physik dot fu-berlin.de
2022-05-16 20:15 ` adhemerval.zanella at linaro dot org
2022-05-17  4:39 ` sam at gentoo dot org
2022-12-06 15:50 ` glaubitz at physik dot fu-berlin.de
2023-01-13  4:52 ` deller at gmx dot de
2023-12-29 23:52 ` sam at gentoo dot org
2024-01-05  8:33 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-23960-131-A44tK6UJPj@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).