Re: [RFC][PATCH 10/13] get rid of audit_reusename()

Christian Brauner
2025-11-12T09:27:02Z

On Mon, Nov 10, 2025 at 08:41:45AM -0800, Linus Torvalds wrote:
> On Sun, 9 Nov 2025 at 21:17, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > That's more about weird callers of getname(), but...
> >
> > #ifdef CONFIG_SYSFS_SYSCALL
> > static int fs_index(const char __user * __name)
> > {
> > struct file_system_type * tmp;
> > struct filename *name;
> > int err, index;
> >
> > name = getname(__name);
>
> Yeah, ok, this is certainly a somewhat unusual pattern in that "name"
> here is not a pathname, but at the same time I can't fault this code
> for using a convenient function for "allocate and copy a string from
> user space".
>
> > Yes, really - echo $((`sed -ne "/.\<$1$/=" </proc/filesystems` - 1))
> > apparently does deserve a syscall. Multiplexor, as well (other
> > subfunctions are about as hard to implement in userland)...
>
> I think those are all "crazy legacy from back in the dark ages when we
> thought iBCS2 was a goal".
>
> I doubt anybody uses that 'sysfs()' system call, and it's behind the
> SYSFS_SYSCALL config variable that was finally made "default n" this
> year, but has actually had a help-message that called it obsolete
> since at least 2014.
>
> The code predates not just git, but the bitkeeper history too - and
> we've long since removed all the actual iBCS2 code (see for example
> commit 612a95b4e053: "x86: remove iBCS support", which removed some
> binfmt left-overs - back in 2008).
>
> > IMO things like "xfs" or "ceph" don't look like pathnames - if
> > anything, we ought to use copy_mount_string() for consistency with
> > mount(2)...
>
> Oh, absolutely not.
>
> But that code certainly could just do strndup_user(). That's the
> normal thing for "get a string from user space" these days, but it
> didn't historically exist..
>
> That said, I think that code will just get removed, so it's not even
> worth worrying about. I don't think anybody even *noticed* that we
> made it "default n" after all these years.

Nobody noticed at all when I flipped the switch earlier this year. I
explicitly dit it to prepare for removal of the sysfs() system call so
I'm happy to pull the trigger any time!