From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: sct@redhat.com
Subject: [PATCH] Fix root hole in raw device
Date: Mon, 16 May 2005 21:37:48 -0700 [thread overview]
Message-ID: <11163046681444@kroah.com> (raw)
In-Reply-To: <11163046682662@kroah.com>
[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>
---
commit 68f66feb300423bb9ee5daecb1951af394425a38
tree ae5ce87f061f76da06cb78ce5c9cf3c8284fc0fc
parent a84a505956f5c795a9ab3d60d97b6b91a27aa571
author Stephen Tweedie <sct@redhat.com> Fri, 13 May 2005 23:31:19 -0400
committer Greg KH <gregkh@suse.de> Mon, 16 May 2005 21:07:21 -0700
drivers/block/ioctl.c | 2 ++
drivers/char/raw.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
Index: drivers/block/ioctl.c
===================================================================
--- 440fdf47fcddf8b0d615667b418981a511d16e30/drivers/block/ioctl.c (mode:100644)
+++ ae5ce87f061f76da06cb78ce5c9cf3c8284fc0fc/drivers/block/ioctl.c (mode:100644)
@@ -237,3 +237,5 @@
}
return ret;
}
+
+EXPORT_SYMBOL_GPL(blkdev_ioctl);
Index: drivers/char/raw.c
===================================================================
--- 440fdf47fcddf8b0d615667b418981a511d16e30/drivers/char/raw.c (mode:100644)
+++ ae5ce87f061f76da06cb78ce5c9cf3c8284fc0fc/drivers/char/raw.c (mode:100644)
@@ -122,7 +122,7 @@
{
struct block_device *bdev = filp->private_data;
- return ioctl_by_bdev(bdev, command, arg);
+ return blkdev_ioctl(bdev->bd_inode, filp, command, arg);
}
static void bind_device(struct raw_config_request *rq)
next prev parent reply other threads:[~2005-05-17 4:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-17 4:37 [GIT PATCH] Stable bugfixes for 2.6.12-rc4 Greg KH
2005-05-17 4:37 ` [PATCH] fix Linux kernel ELF core dump privilege elevation Greg KH
2005-05-17 4:37 ` Greg KH [this message]
2005-05-17 4:37 ` [PATCH] Fix root hole in pktcdvd Greg KH
2005-05-17 5:00 ` Al Viro
2005-05-17 5:54 ` Al Viro
2005-05-17 18:12 ` Peter Osterlund
2005-05-17 15:35 ` Greg KH
2005-05-17 4:57 ` [PATCH] Fix root hole in raw device Al Viro
2005-05-17 7:03 ` Willy Tarreau
2005-05-17 7:07 ` Willy Tarreau
2005-05-17 7:38 ` Al Viro
2005-05-17 7:32 ` Al Viro
2005-05-17 13:04 ` Stephen C. Tweedie
2005-05-17 16:53 ` Al Viro
2005-05-22 11:55 ` Peter Osterlund
2005-05-22 11:57 ` Peter Osterlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11163046681444@kroah.com \
--to=gregkh@suse.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox