mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Mike Gilbert <floppym@gentoo.org>
To: musl@lists.openwall.com
Cc: "Michael Gilbert (floppym)" <floppym@gentoo.org>
Subject: [musl] faccessat behavior on old kernels (<5.8)
Date: Mon, 19 Jun 2023 14:14:39 -0400	[thread overview]
Message-ID: <CAJ0EP43QiTHZMsmLFrE5qFCgyq+FE7QSk=povbPT-VjF=FEusA@mail.gmail.com> (raw)

I am not subscribed, so please CC me on replies.

I received a bug report on Gentoo Linux.

https://bugs.gentoo.org/908765

There appears to be a difference in behavior between musl and glibc
when running on Linux kernels that lack support for the faccessat2
system call.

On glibc, the following call returns 0. On musl, it returns -1 and
sets errno to EINVAL.

faccessat(AT_FDCWD, "/dev/null", F_OK, AT_SYMLINK_NOFOLLOW);

On older kernels, the underlying faccessat2 syscall returns -1 / ENOSYS.
glibc follows that up with an fstatat64 with equivalent arguments.
musl immediately fails with -1 / EINVAL.

Relevant code:

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/faccessat.c;h=0ccbd778b5f4d61f9121b6aeb59782c21ae647a0;hb=a704fd9a133bfb10510e18702f48a6a9c88dbbd5#l36

https://git.musl-libc.org/cgit/musl/tree/src/unistd/faccessat.c?h=v1.2.4#n34

             reply	other threads:[~2023-06-19 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-19 18:14 Mike Gilbert [this message]
2023-06-19 21:49 ` Gabriel Ravier
2023-06-19 23:59   ` Rich Felker
2023-06-20  0:52     ` Mike Gilbert
2023-06-20  1:25       ` Rich Felker

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='CAJ0EP43QiTHZMsmLFrE5qFCgyq+FE7QSk=povbPT-VjF=FEusA@mail.gmail.com' \
    --to=floppym@gentoo.org \
    --cc=musl@lists.openwall.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).