lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200721165539.GT2786714@ZenIV.linux.org.uk>
Date:   Tue, 21 Jul 2020 17:55:39 +0100
From:   Al Viro <viro@...iv.linux.org.uk>
To:     Christoph Hellwig <hch@....de>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-api@...r.kernel.org
Subject: Re: [PATCH 06/24] md: open code vfs_stat in md_setup_drive

On Tue, Jul 21, 2020 at 06:28:00PM +0200, Christoph Hellwig wrote:
> Instead of passing a kernel pointer to vfs_stat by relying on the
> implicit set_fs(KERNEL_DS) in md_setup_drive, just open code the
> trivial getattr, and use the opportunity to move a little bit more
> code from the caller into the new helper.

Ugh...

> +static void __init md_lookup_dev(const char *devname, dev_t *dev)
> +{
> +	struct kstat stat;
> +	struct path path;
> +	char filename[64];
> +
> +	if (strncmp(devname, "/dev/", 5) == 0)
> +		devname += 5;
> +	snprintf(filename, 63, "/dev/%s", devname);
> +
> +	if (!kern_path(filename, LOOKUP_FOLLOW, &path) &&
> +	    !vfs_getattr(&path, &stat, STATX_BASIC_STATS, AT_NO_AUTOMOUNT) &&
> +	    S_ISBLK(stat.mode))
> +		*dev = new_decode_dev(stat.rdev);
> +	path_put(&path);
> +}

How about fs/for_init.c and putting the damn helpers there?  With
calling conventions as close to syscalls as possible, and a fat
comment regarding their intended use being _ONLY_ the setup
in should-have-been-done-in-userland parts of init?

I really want to keep the surface as small as possible - we had
fun shite several releases ago when somebody tried that kind of
crap (with open(), IIRC).  Let's not go there again...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ