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

Al Viro
2025-11-10T05:17:51Z

On Sun, Nov 09, 2025 at 02:18:04PM -0800, Linus Torvalds wrote:

> Anyway, slightly updated patch that makes "names_cachep" local to
> fs/namei.c just because there is absolutely _no_ reason for anybody
> else to ever use it. Except for that insane legacy one of __getname(),
> that is now just a kmalloc.
>
> I also made EMBEDDED_NAME_MAX be 128 as per Mateusz' comment, although
> to avoid double allocations it should probably be even bigger. A
> "small" value is good for testing that the new logic works, though.
>
> I haven't actually dared trying to boot into this, so it's still
> entirely untested. But I've at least looked through that patch a bit
> more and tried to search for other insane patterns, and so far that
> oddity in ntfs3 was the only related thing I've found.

*snort*
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);
err = PTR_ERR(name);
if (IS_ERR(name))
return err;

err = -EINVAL;
read_lock(&file_systems_lock);
for (tmp=file_systems, index=0 ; tmp ; tmp=tmp->next, index++) {
if (strcmp(tmp->name, name->name) == 0) {
err = index;
break;
}
}
read_unlock(&file_systems_lock);
putname(name);
return err;
}

in fs/filesystems.c

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)...

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)...