linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mateusz Guzik <mjguzik@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	brauner@kernel.org, viro@zeniv.linux.org.uk,  jack@suse.cz,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	 pfalcato@suse.de
Subject: Re: [PATCH v4] fs: hide names_cachep behind runtime access machinery
Date: Thu, 30 Oct 2025 22:39:46 +0100	[thread overview]
Message-ID: <CAGudoHH817CKv0ts4dO08j5FOfEAWtvoBeoT06KarjzOh_U6ug@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wgGFUAPb7z5RzUq=jxRh2PO7yApd9ujMnC5OwXa-_e3Qw@mail.gmail.com>

On Thu, Oct 30, 2025 at 7:07 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> [ Adding Thomas, because he's been working on our x86 uaccess code,
> and I actually think we get this all wrong for access_ok() etc ]
>
> On Thu, 30 Oct 2025 at 09:35, Mateusz Guzik <mjguzik@gmail.com> wrote:
> >
> > I don't know if you are suggesting to make the entire thing fail to
> > compile if included for a module, or to transparently convert
> > runtime-optimized access into plain access.
> >
> > I presume the former.
>
> I think *including* it should be ok, because we have things like
> <asm/uaccess.h> - or your addition to <linux/fs.h> - that use it for
> core functionality that is then not supported for module use.
>
> Yeah, in a perfect world we'd have those things only in "internal"
> headers and people couldn't include them even by mistake, but that
> ends up being a pain.
>
> So I don't think your
>
> +#ifdef MODULE
> +#error "this functionality is not available for modules"
> +#endif
>
> model works, because I think it might be too painful to fix (but hey,
> maybe I'm wrong).
>

In my proposal the patch which messes with the namei cache address
would have the following in fs.h:
#ifndef MODULE
#include <asm/runtime-const.h>
#endif

As in, unless the kernel itself is being compiled, it would pretend
the runtime machinery does not even exist, which imo is preferable to
failing later at link time.

Then whatever functionality using runtime-const is straight up not
available and code insisting on providing something for modules anyway
is forced to provide an ifdefed implementation.

Ignoring the safety vs modules thing and back to the names_cachep
patch: the reported riscv build failure has proven problematic to fix.
Turns out mm.h includes mm_huge.h, which then includes fs.h(!). Adding
the runtime-const.h include into fs.h then results in compilation
failure on that platform as it depends on vmalloc-related symbols
which are only getting declared *after* fs.h gets included.

I tried to get rid of the fs.h inclusion in mm_huge.h, but that
uncovered a bunch of other build failures where code works only
because fs.h got sneaked in by someone else.

Given the level of bullshit here it may be it is just straight up
infeasible to include runtime-const.h in fs.h without major
rototoiling, which I'm not signing up for.

I wonder if it would make sense to bypass the problem by moving the
pathname handling routines to a different header -- might be useful in
its own right to slim down the kitchen sink that fs.h turned out to
be, but that's another bikeshed-y material.

I may end up just ditching this for the time being.

  parent reply	other threads:[~2025-10-30 21:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 10:52 [PATCH v4] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
2025-10-30 13:13 ` kernel test robot
2025-10-30 13:19   ` Mateusz Guzik
2025-10-30 16:15 ` Linus Torvalds
2025-10-30 16:35   ` Mateusz Guzik
2025-10-30 18:07     ` Linus Torvalds
2025-10-30 18:25       ` Linus Torvalds
2025-10-30 21:39       ` Mateusz Guzik [this message]
2025-10-30 22:06         ` Mateusz Guzik
2025-10-31 12:08         ` Christian Brauner
2025-10-31 15:13           ` Mateusz Guzik
2025-10-31 16:04             ` Linus Torvalds
2025-10-31 16:25               ` Mateusz Guzik
2025-10-31 16:31                 ` Linus Torvalds
2025-10-31 17:42                   ` [WIP RFC PATCH 0/3] runtime-const header split and whatnot Mateusz Guzik
2025-10-31 17:42                     ` [PATCH 1/3] x86: fix access_ok() and valid_user_address() using wrong USER_PTR_MAX in modules Mateusz Guzik
2025-10-31 21:46                       ` Linus Torvalds
2025-10-31 22:01                         ` Mateusz Guzik
2025-11-01 11:26                       ` David Laight
2025-11-04  6:25                       ` Linus Torvalds
2025-11-04  8:56                         ` Mateusz Guzik
2025-11-04  9:37                           ` Linus Torvalds
2025-11-04 10:25                         ` Borislav Petkov
2025-11-04 16:13                           ` Borislav Petkov
2025-11-05  1:50                             ` Linus Torvalds
2025-11-05 11:37                               ` Borislav Petkov
2025-11-05 20:50                             ` Mateusz Guzik
2025-11-06 11:14                               ` Borislav Petkov
2025-11-06 12:06                                 ` Mateusz Guzik
2025-11-06 13:10                                   ` Borislav Petkov
2025-11-06 13:19                                     ` Mateusz Guzik
2025-11-06 13:36                                       ` Borislav Petkov
2025-11-06 14:49                                         ` Mateusz Guzik
2025-11-06 19:26                                       ` David Laight
2025-11-06 19:49                                         ` Linus Torvalds
2025-11-04 17:09                         ` Sean Christopherson
2025-11-04 19:07                           ` Linus Torvalds
2025-11-04 19:34                             ` Linus Torvalds
2025-11-04 21:53                               ` Sean Christopherson
2025-11-04 20:17                             ` Borislav Petkov
2025-11-04 22:06                               ` Linus Torvalds
2025-11-05 11:49                                 ` Borislav Petkov
2025-10-31 17:42                     ` [PATCH 2/3] runtime-const: split headers between accessors and fixup; disable for modules Mateusz Guzik
2025-10-31 17:42                     ` [PATCH 3/3] fs: hide names_cachep behind runtime access machinery Mateusz Guzik
2025-10-31 23:30                       ` kernel test robot
2025-10-31 23:30                       ` kernel test robot
2025-10-31 23:41                       ` kernel test robot
2025-11-01 17:49                       ` kernel test robot
2025-10-31 13:30 ` [PATCH v4] " kernel test robot
2025-10-31 22:43 ` kernel test robot
2025-11-01 23:06 ` kernel test robot

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=CAGudoHH817CKv0ts4dO08j5FOfEAWtvoBeoT06KarjzOh_U6ug@mail.gmail.com \
    --to=mjguzik@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pfalcato@suse.de \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 NNTP newsgroup(s).