public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Mateusz Guzik <mjguzik@gmail.com>,
	Andreas Schwab <schwab@suse.de>, Rich Felker <dalias@libc.org>
Cc: Mateusz Guzik via Libc-alpha <libc-alpha@sourceware.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: fstat(2) penalized by using newfstatat(6, "", buf, AT_EMPTY_PATH)
Date: Tue, 5 Sep 2023 10:01:59 -0300	[thread overview]
Message-ID: <680b330d-6ef3-adc5-9ba6-cf74dd53e422@linaro.org> (raw)
In-Reply-To: <CAGudoHFvxtaxAp975vC7HQ=_Kuro3u44N3b2iVCmEPTXFsPo=g@mail.gmail.com>



On 04/09/23 07:11, Mateusz Guzik via Libc-alpha wrote:
> On 9/4/23, Andreas Schwab <schwab@suse.de> wrote:
>> On Sep 04 2023, Mateusz Guzik via Libc-alpha wrote:
>>
>>> Commit 4d97cc8cf3da ("io: Remove xstat implementations") reimplemented
>>> fstat entry point on top of newfstatat (as opposed to newfstat).
>>
>> You are looking at the wrong commit.  See 30f1c74394 instead.
>>
> 
> I still got the right person and the question stands. ;)
> 

The glibc has started to implement some symbols over more generic syscalls
because it simplifies *a lot* the required code (just check how messy was the
stat family implementation back then).  So I would really like to avoid the
need to get back on arch-specific syscall to fix very specific corner cases.

If I understand correctly, the issue seems to be the usage of a empty string 
sentinel ("") to indicate the argument it not really used (which trigger all
the SMAP issues since kernel will always try to copy the argument from
userland).  This also means on x86_64 you will also have this performance
penalty on syscalls that use AT_EMPTY_PATH (i.e, execveat, name_to_handle_at,
open_tree, faccessat, etc.).  I really think it would better fixed in the
kernel instead of adding extra constraints for the userland.

CCing Rich, from musl, which seems to be also affected it and to have another
view from a libc implementation.

  reply	other threads:[~2023-09-05 13:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  9:55 Mateusz Guzik
2023-09-04 10:08 ` Andreas Schwab
2023-09-04 10:11   ` Mateusz Guzik
2023-09-05 13:01     ` Adhemerval Zanella Netto [this message]
2023-09-05 13:14       ` Mateusz Guzik
2023-09-05 17:28         ` Adhemerval Zanella Netto
2023-09-05 17:45           ` Linus Torvalds
2023-09-05 18:22             ` Adhemerval Zanella Netto
2023-09-05 19:16               ` Adhemerval Zanella Netto
2023-09-05 19:21                 ` Linus Torvalds
2023-09-05 21:42             ` Rich Felker
2023-09-05 21:46               ` Mateusz Guzik
2023-09-05 17:29         ` Linus Torvalds

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=680b330d-6ef3-adc5-9ba6-cf74dd53e422@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=dalias@libc.org \
    --cc=libc-alpha@sourceware.org \
    --cc=mjguzik@gmail.com \
    --cc=schwab@suse.de \
    --cc=torvalds@linux-foundation.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).