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] [day] [month] [year] [list]
Date:	Wed, 26 Sep 2007 16:03:45 +0100
From:	Christoph Hellwig <hch@...radead.org>
To:	Miklos Szeredi <miklos@...redi.hu>
Cc:	haveblue@...ibm.com, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [patch] fix sys_mknodat breakage from r/o bind mounts

On Wed, Sep 26, 2007 at 12:58:47AM +0200, Miklos Szeredi wrote:
>  	if (!S_ISREG(mode)  && !S_ISCHR(mode)  && !S_ISBLK(mode) &&
> -	    !S_ISFIFO(mode) && !S_ISSOCK(mode) && mode != 0) {
> +	    !S_ISFIFO(mode) && !S_ISSOCK(mode) && (mode & S_IFMT) != 0) {

FYI this whole section might be cleaner as


static int may_mknod(mode_t mode)
{
	switch (mode & S_IFMT) {
	case S_IFREG:
	case S_IFCHR:
	case S_IFBLK:
	case S_IFFIFO:
	case S_IFSOCK:
	case 0:	/* zero mode translates to S_IFREG *
		return 0;
	case S_IFDIR:
		return -EPERM;
	default:
		return -EINVAL;
	}
}

and then in sys_mknodat just a

	error = may_mknod(mode);
	if (error)
		goto out_dput;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ