From: Brian Belleville <bbellevi@uci.edu>
To: Jiri Kosina <jikos@kernel.org>, linux-kernel@vger.kernel.org
Cc: Brian Belleville <bbellevi@uci.edu>
Subject: [PATCH] floppy: Do not copy a kernel pointer to user memory in FDGETPRM ioctl
Date: Wed, 7 Mar 2018 16:02:45 -0800 [thread overview]
Message-ID: <1520467365-7194-1-git-send-email-bbellevi@uci.edu> (raw)
The final field of a floppy_struct is the field "name", which is a
pointer to a string in kernel memory. The kernel pointer should not be
copied to user memory. The FDGETPRM ioctl copies a floppy_struct to
user memory, including the "name" field. This pointer cannot be used
by the user, and it will leak a kernel address to user-space, which
will reveal the location of kernel code and data and undermine KASLR
protection. Instead, copy the floppy_struct except for the "name"
field.
Signed-off-by: Brian Belleville <bbellevi@uci.edu>
---
drivers/block/floppy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index eae484a..4d4a422 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3470,6 +3470,7 @@ static int fd_locked_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
(struct floppy_struct **)&outparam);
if (ret)
return ret;
+ size = offsetof(struct floppy_struct, name);
break;
case FDMSGON:
UDP->flags |= FTD_MSG;
--
2.7.4
next reply other threads:[~2018-03-08 0:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-08 0:02 Brian Belleville [this message]
2018-03-22 19:59 ` Brian Belleville
2018-05-29 13:27 ` Andy Whitcroft
2018-07-09 23:14 ` Ben Hutchings
2018-08-27 7:45 ` Kees Cook
2018-09-20 14:01 ` Joe Lawrence
2018-09-20 15:10 ` Jens Axboe
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=1520467365-7194-1-git-send-email-bbellevi@uci.edu \
--to=bbellevi@uci.edu \
--cc=jikos@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®