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:	Thu, 15 Jan 2009 17:34:23 +0100
From:	Arnd Bergmann <arnd@...db.de>
To:	dedekind@...radead.org
Cc:	Geert Uytterhoeven <Geert.Uytterhoeven@...ycom.com>,
	linux-mtd <linux-mtd@...ts.infradead.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] UBI: add ioctl compatibility

On Thursday 15 January 2009, Artem Bityutskiy wrote:

> would you please glance if this patch all-right?

No, it's not. New ioctl numbers should not be added to fs/compat_ioctl.c
but rather to the file that implements the file operations (ubi/cdev.c).

The best way to do it would be to add functions that do

static long compat_vol_cdev_ioctl(struct file *file,
		unsigned int cmd, unsigned long arg)
{
	int ret;

	arg = (unsigned long)compat_ptr(arg);

	lock_kernel();
	ret = vol_cdev_locked_ioctl(file->f_inode, file, cmd, arg);
	unlock_kernel();

	return ret;
}

static long vol_cdev_ioctl(struct file *file,
		unsigned int cmd, unsigned long arg)
{
	int ret;

	lock_kernel();
	ret = vol_cdev_locked_ioctl(file->f_inode, file, cmd, arg);
	unlock_kernel();

	return ret;
}

and then use these two functions as your unlocked_ioctl and compat_ioctl
methods in file_operations.

If you can prove that you don't rely on the BKL, you can also drop the
{un,}lock_kernel() calls.


>  COMPATIBLE_IOCTL(MEMGETREGIONINFO)
>  COMPATIBLE_IOCTL(MEMGETBADBLOCK)
>  COMPATIBLE_IOCTL(MEMSETBADBLOCK)
> +/* UBI */
> +COMPATIBLE_IOCTL(UBI_IOCMKVOL)
> +ULONG_IOCTL(UBI_IOCRMVOL)
> +COMPATIBLE_IOCTL(UBI_IOCRSVOL)
> +COMPATIBLE_IOCTL(UBI_IOCRNVOL)
> +COMPATIBLE_IOCTL(UBI_IOCATT)
> +ULONG_IOCTL(UBI_IOCDET)
> +ULONG_IOCTL(UBI_IOCVOLUP)
> +ULONG_IOCTL(UBI_IOCEBER)
> +ULONG_IOCTL(UBI_IOCEBCH)
> +ULONG_IOCTL(UBI_IOCEBMAP)
> +ULONG_IOCTL(UBI_IOCEBUNMAP)
> +ULONG_IOCTL(UBI_IOCEBISMAP)

ULONG_IOCTL() would be wrong here, all your ioctl handlers expect
a pointer, not an unsigned long

	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