public inbox for [email protected]
 help / color / mirror / Atom feed
From: Christian Brauner <[email protected]>
To: Linus Torvalds <[email protected]>
Cc: Xi Ruoyao <[email protected]>,
	[email protected],
	 "Andreas K. Huettel" <[email protected]>,
	Arnd Bergmann <[email protected]>,
	 Huacai Chen <[email protected]>,
	Mateusz Guzik <[email protected]>,
	 Alexander Viro <[email protected]>,
	Jan Kara <[email protected]>,
	[email protected],  [email protected],
	[email protected], Jens Axboe <[email protected]>,
	 [email protected]
Subject: Re: [PATCH 2/2] vfs: support statx(..., NULL, AT_EMPTY_PATH, ...)
Date: Wed, 3 Jul 2024 20:39:39 +0200	[thread overview]
Message-ID: <20240703-zusagen-allzu-214f7651ecfd@brauner> (raw)
In-Reply-To: <20240703-begossen-extrem-6ed55a165113@brauner>

On Wed, Jul 03, 2024 at 08:14:15PM GMT, Christian Brauner wrote:
> On Wed, Jul 03, 2024 at 10:54:53AM GMT, Linus Torvalds wrote:
> > On Wed, 3 Jul 2024 at 10:40, Linus Torvalds
> > <[email protected]> wrote:
> > >
> > > Oh wow. Shows just *how* long ago that was - and how long ago I looked
> > > at 32-bit code. Because clearly, I was wrong.
> > 
> > Ok, so clearly any *new* 32-bit architecture should use 'struct statx'
> > as 'struct stat', and at least avoid the conversion pain.
> > 
> > Of course, if using <asm-generic/stat.h> like loongarch does, that is
> > very much not what happens. You get those old models with just 'long'.
> > 
> > So any architecture that didn't do that 'stat == statx' and has
> > binaries with old stat models should just continue to have them.
> > 
> > It's not like we can get rid of the kernel side code for that all _anyway_.
> 
> Fwiw, the original motivation for that whole "let's do NULL with
> AT_EMPTY_PATH" (somewhat independent from the generic use of it) that
> somehow morphed into this discussion was that the Chrome Sandbox has
> rewrites fstatat() system calls to fstat() via SECCOMP_RET_TRAP:
> 
>   if (args.nr == __NR_fstatat_default) {
>     if (*reinterpret_cast<const char*>(args.args[1]) == '\0' &&
>         args.args[3] == static_cast<uint64_t>(AT_EMPTY_PATH)) {
>       return syscall(__NR_fstat_default, static_cast<int>(args.args[0]),
>                      reinterpret_cast<default_stat_struct*>(args.args[2]));
>     }
> 
> while also disabling statx() completely because they can't (easily)
> rewrite it and don't want to allow it unless we have NULL for
> AT_EMPTY_PATH (which we'll have soon ofc).
> 
> In any case in [1] I proposed they add back fstat()/fstatat64() which
> should get that problem solved because they can rewrite that thing.
> 
> In any case, which one of these does a new architecture have to add for
> reasonable backward compatibility:

Going by riscv added in 2017 it would be:

newstat()
newlstat()
newfstat()
newfstatat()
statx()

> 
> fstat()
> fstat64()
> fstatat64()
> 
> lstat()
> lstat64()
> 
> stat()
> stat64()
> statx()
> 
> newstat()
> newlstat()
> newfstat()
> newfstatat()
> 
> Because really that's a complete mess and we have all sorts of overflow
> issues and odd failures in the varioius variants. And the userspace
> ifdefery in libcs is just as bad if not very much worse.
> 
> [1]: https://lore.kernel.org/lkml/20240226-altmodisch-gedeutet-91c5ba2f6071@brauner

  reply	other threads:[~2024-07-03 18:39 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 11:00 [PATCH 0/2] statx NULL path support Mateusz Guzik
2024-06-25 11:00 ` [PATCH 1/2] vfs: add CLASS fd_raw Mateusz Guzik
2024-06-25 12:22   ` Xi Ruoyao
2024-06-25 13:13     ` Mateusz Guzik
2024-06-25 11:00 ` [PATCH 2/2] vfs: support statx(..., NULL, AT_EMPTY_PATH, ...) Mateusz Guzik
2024-06-25 13:24   ` Xi Ruoyao
2024-06-25 13:28     ` Xi Ruoyao
2024-06-25 13:28     ` Mateusz Guzik
2024-06-25 14:09   ` Huacai Chen
2024-06-25 14:58     ` Xi Ruoyao
2024-06-30  1:40       ` Huacai Chen
2024-06-30  2:39         ` Xi Ruoyao
2024-06-30 13:18           ` Huacai Chen
2024-07-01 11:59           ` Arnd Bergmann
2024-07-02 15:36             ` Huacai Chen
2024-07-02 17:06               ` Arnd Bergmann
2024-07-03  4:30                 ` Huacai Chen
2024-07-03  8:45                 ` Christian Brauner
2024-07-03  9:35                   ` Huacai Chen
2024-07-03 10:07                     ` Xi Ruoyao
2024-07-03 16:31                   ` Linus Torvalds
2024-07-03 16:54                     ` Xi Ruoyao
2024-07-03 17:09                       ` Linus Torvalds
2024-07-03 17:30                         ` Xi Ruoyao
2024-07-03 17:40                           ` Linus Torvalds
2024-07-03 17:54                             ` Linus Torvalds
2024-07-03 18:14                               ` Christian Brauner
2024-07-03 18:39                                 ` Christian Brauner [this message]
2024-07-03 19:00                                 ` Linus Torvalds
2024-07-03 19:18                                   ` Linus Torvalds
2024-07-03 18:48                               ` Xi Ruoyao
2024-07-03 19:05                                 ` Linus Torvalds
2024-07-03 19:33                                   ` Christian Brauner
2024-07-03 19:52                                     ` Linus Torvalds
2024-07-03 18:44                             ` Arnd Bergmann
2024-07-03 19:55                               ` Christian Brauner
2024-07-03 17:11                       ` Xi Ruoyao
2024-07-04  2:38                       ` Huacai Chen
2024-07-04  3:23                         ` Xi Ruoyao
2024-07-04  4:14                           ` Xi Ruoyao
2024-07-04  5:55                       ` Florian Weimer
2024-07-04  6:02                         ` Xi Ruoyao
2024-07-01  4:38 ` [PATCH 0/2] statx NULL path support Christoph Hellwig
2024-07-01  6:46   ` Xi Ruoyao

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=20240703-zusagen-allzu-214f7651ecfd@brauner \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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