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]
Date:	Fri, 21 May 2010 08:25:32 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Tyler Hicks <tyhicks@...ux.vnet.ibm.com>
Cc:	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...e.hu>,
	LKML <linux-kernel@...r.kernel.org>,
	Dustin Kirkland <kirkland@...onical.com>,
	Ecryptfs <ecryptfs-devel@...ts.launchpad.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	John Kacur <jkacur@...hat.com>,
	Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] vfs/eCryptfs: Handle ioctl calls with unlocked and compat functions

On Friday 21 May 2010, Tyler Hicks wrote:
> Lower filesystems that only implement unlocked_ioctl aren't being
> passed ioctl calls because eCryptfs only checked for
> lower_file->f_op->ioctl and returned -ENOTTY if it was NULL.
> 
> eCryptfs shouldn't implement ioctl(), since it doesn't require the BKL.
> Instead, unlocked_ioctl() should be used and vfs_ioctl() can be called
> on the lower file since it handles locking, if necessary.  This requires
> vfs_ioctl() to be exported.

Calling vfs_ioctl doesn't help you at all here, you could simply call
the ->unlocked_ioctl function of the lower fs directly to do the same,
because ->ioctl will be gone soon.

You are howevers still missing a few calls that are done through do_vfs_ioctl
or file_ioctl.  To implement these, you need to add the file and super operations
that these call and forward the functions to the lower fs.

> +#ifdef CONFIG_COMPAT
> +static long
> +ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> +{
> +	long rc = -ENOTTY;
> +	struct file *lower_file = NULL;
> +
> +	if (ecryptfs_file_to_private(file))
> +		lower_file = ecryptfs_file_to_lower(file);
> +	if (lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl)
> +		rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
> +	return rc;
> +}
> +#endif

You need to return -ENOIOCTLCMD here, not ENOTTY to cover the case where
the lower file system does not have a ->compat_ioctl function but has its
calls listed in fs/compat_ioctl.c.

	Arnd
--
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