mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Norbert van Bolhuis <norbert.vanbolhuis@evbox.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] no 32bit timestamp compatible stat/lstat/fstat?
Date: Mon, 29 Nov 2021 19:48:23 -0500	[thread overview]
Message-ID: <20211130004822.GE7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <dffe8309-6a9c-149d-ceb2-24ea285712bc@ev-box.com>

On Tue, Nov 30, 2021 at 12:15:59AM +0100, Norbert van Bolhuis wrote:
> Hi Rich,
> 
> Thanks for your answer!
> 
> Ah, it's about 32-bit off_t compatibility, but then why
> does musl-1.1.24 (and the corresponding libc6-compat package on
> Alpine 3.12) provide this (ancient) __fxstat function?

The symbol there in 1.1.x didn't behave as needed to make 32-bit-off_t
glibc code work. It just happened to be there as an alternate name for
the 64-bit-off_t function __fxstat64 as a consequence of 32-bit archs
not being special-cased.

> So this can never work properly and the reason why it worked with
> Alpine 3.12 (musl-1.1.24) is that the 3rd-party binary never really
> used __fxstat (because there is no way the 64-bit structure is
> compatible with the 32-bit one), right?

Right. Well, it might have 'worked' if it didn't actually inspect the
fields of the structure, but since the 64-bit structure is larger than
the object the caller provided, it was overflowing a buffer and
probably clobbering other data.

> Glibc does provide the ancient 32-bit variant, see:
> nm -D --defined-only /lib/arm-linux-gnueabihf/libc.so.6 | grep __fxstat
> 00093e68 T __fxstat
> 00093fdc T __fxstat64
> 000942a4 T __fxstatat
> 00094320 T __fxstatat64
> I would expect musl libc6-compat package to provide it, why it doesn't?

There's no way to support the 32-bit-off_t ABI with just a library,
because the symbol names clash. It would require musl's dynamic linker
to be specifically aware of foreign glibc libraries and remap their
symbol references. This would be something of a cooperative project
between musl and the folks working on gcompat to come up with a
contract between them for making it all work -- something we've talked
about as a vague future goal.

Rich

      reply	other threads:[~2021-11-30  0:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 13:11 Norbert van Bolhuis
2021-11-29 17:35 ` Rich Felker
2021-11-29 23:15   ` Norbert van Bolhuis
2021-11-30  0:48     ` Rich Felker [this message]

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=20211130004822.GE7074@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=norbert.vanbolhuis@evbox.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).