kernel-hacking-2024-linux-s.../drivers/block
Stephen Tweedie 68f66feb30 [PATCH] Fix root hole in raw device
[Patch] Fix raw device ioctl pass-through

Raw character devices are supposed to pass ioctls through to the block
devices they are bound to.  Unfortunately, they are using the wrong
function for this: ioctl_by_bdev(), instead of blkdev_ioctl().

ioctl_by_bdev() performs a set_fs(KERNEL_DS) before calling the ioctl,
redirecting the user-space buffer access to the kernel address space.
This is, needless to say, a bad thing.

This was noticed first on s390, where raw IO was non-functioning.  The
s390 driver config does not actually allow raw IO to be enabled, which
was the first part of the problem.  Secondly, the s390 kernel address
space is distinct from user, causing legal raw ioctls to fail.  I've
reproduced this on a kernel built with 4G:4G split on x86, which fails
in the same way (-EFAULT if the address does not exist kernel-side;
returns success without actually populating the user buffer if it does.)

The patch below fixes both the config and address-space problems.  It's
based closely on a patch by Jan Glauber <jang@de.ibm.com>, which has
been tested on s390 at IBM.  I've tested it on x86 4G:4G (split address
space) and x86_64 (common address space).

Kernel-address-space access has been assigned CAN-2005-1264.

Signed-off-by: Stephen Tweedie <sct@redhat.com>
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-05-16 21:07:21 -07:00
..
aoe [PATCH] aoe: update version number to 10 2005-05-03 23:34:55 -07:00
paride Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
acsi.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
acsi_slm.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
amiflop.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
as-iosched.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ataflop.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cciss.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cciss.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cciss_cmd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cciss_scsi.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cciss_scsi.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cfq-iosched.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpqarray.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpqarray.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cryptoloop.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
DAC960.c [PATCH] DAC960: add support for Mylex AcceleRAID 4/5/600 2005-05-05 16:36:43 -07:00
DAC960.h [PATCH] DAC960: add support for Mylex AcceleRAID 4/5/600 2005-05-05 16:36:43 -07:00
deadline-iosched.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
elevator.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
floppy.c [PATCH] remove do_sync parameter from __invalidate_device 2005-05-05 16:36:44 -07:00
genhd.c [PATCH] remove do_sync parameter from __invalidate_device 2005-05-05 16:36:44 -07:00
ida_cmd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ida_ioctl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ioctl.c [PATCH] Fix root hole in raw device 2005-05-16 21:07:21 -07:00
Kconfig [PATCH] ISA DMA Kconfig fixes - part 3 2005-05-04 07:33:14 -07:00
Kconfig.iosched Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ll_rw_blk.c [PATCH] fix NMI lockup with CFQ scheduler 2005-04-16 20:10:09 -05:00
loop.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
nbd.c [PATCH] nbd: Don't create all MAX_NBD devices by default all the time 2005-05-01 08:59:07 -07:00
noop-iosched.c [PATCH] noop-iosched: kill O(N) merge scan 2005-05-01 08:59:06 -07:00
pktcdvd.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ps2esdi.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rd.c [PATCH] drivers/block/rd.c: rd_size shouldn't be static 2005-05-06 16:58:18 -07:00
scsi_ioctl.c [PATCH] consolidate timeout defintions in scsi.h 2005-04-18 12:31:52 -05:00
smart1,2.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
swim3.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
swim_iop.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sx8.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
ub.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
umem.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
viodasd.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xd.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
xd.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
z2ram.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00