From: Alexey Zaytsev <alexey.zaytsev@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James.Bottomley@hansenpartnership.com,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
jens.axboe@oracle.com
Subject: Re: [PATCH] Fix sg_io_hdr.info corruption.
Date: Thu, 01 Jan 2009 14:08:00 +0300 [thread overview]
Message-ID: <20090101110133.14065.98145.stgit@zaytsev.su> (raw)
In-Reply-To: <20081231180759X.fujita.tomonori@lab.ntt.co.jp>
[resending in case you missed the one I sent with broken headers]
On Wed, Dec 31, 2008 at 12:08, FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> wrote:
> On Tue, 30 Dec 2008 15:46:03 -0800
> Andrew Morton <akpm@linux-foundation.org> wrote:
[...]
>> the code has been like this for years and years. Why hasn't anyone
>> noticed?
>
> The members from 'status' in struct sg_io_hdr to the last are used to
> transfer information from kernel to user space. The values that user
> space sets are just ignored.
>
Then probably there is no need to copy those fields, right?
There should be no data leak from the kernel, as sgio is
allocated on the userspace stack, and the appropriate ioctl
handler should set/zero all those fields anyway, as it expects
them to come directly from the user (did not check).
So, in the worst case the user gets his own garbage insted of
the values he left in the fields that the kernel was supposed
to set.
If so, please drop my previous patch and take this one.
From: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Subject: [PATCH] Don't perform unneeded copy.
FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> says:
The members from 'status' in struct sg_io_hdr to the last are used to
transfer information from kernel to user space. The values that user
space sets are just ignored.
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
---
fs/compat_ioctl.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5235c67..23b1f5a 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -782,12 +782,6 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
if (put_user(compat_ptr(data), &sgio->usr_ptr))
return -EFAULT;
- if (copy_in_user(&sgio->status, &sgio32->status,
- (4 * sizeof(unsigned char)) +
- (2 * sizeof(unsigned (short))) +
- (3 * sizeof(int))))
- return -EFAULT;
-
err = sys_ioctl(fd, cmd, (unsigned long) sgio);
if (err >= 0) {
next prev parent reply other threads:[~2009-01-01 10:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-28 14:50 Alexey Zaytsev
2008-12-30 23:46 ` Andrew Morton
2008-12-31 9:08 ` FUJITA Tomonori
2008-12-31 9:15 ` Andrew Morton
2008-12-31 10:51 ` Alexey Zaytsev
2009-01-01 11:08 ` Alexey Zaytsev [this message]
2009-01-01 14:54 ` [PATCH] Fix sg_io_hdr.info corruption Douglas Gilbert
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=20090101110133.14065.98145.stgit@zaytsev.su \
--to=alexey.zaytsev@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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
Powered by JetHome