public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: ioctl: fix information leak to userland
@ 2010-11-04 14:48 Vasiliy Kulikov
  2010-11-08 13:42 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Vasiliy Kulikov @ 2010-11-04 14:48 UTC (permalink / raw)
  To: kernel-janitors; +Cc: Jens Axboe, linux-kernel

Structure hd_geometry is copied to userland with 4 padding bytes
between cylinders and start fields uninitialized on 64-bit platforms.
It leads to leaking of contents of kernel stack memory.

Currently there is no memset() in real implementations of getgeo()
in drivers/block/, so it makes sense to have memset() in blkdev_ioctl().

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 block/ioctl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/block/ioctl.c b/block/ioctl.c
index d724ceb..60bae81 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -242,6 +242,7 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
 		 * We need to set the startsect first, the driver may
 		 * want to override it.
 		 */
+		memset(&geo, 0, sizeof(geo));
 		geo.start = get_start_sect(bdev);
 		ret = disk->fops->getgeo(bdev, &geo);
 		if (ret)
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: ioctl: fix information leak to userland
  2010-11-04 14:48 [PATCH] block: ioctl: fix information leak to userland Vasiliy Kulikov
@ 2010-11-08 13:42 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2010-11-08 13:42 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: kernel-janitors, linux-kernel

On 2010-11-04 15:48, Vasiliy Kulikov wrote:
> Structure hd_geometry is copied to userland with 4 padding bytes
> between cylinders and start fields uninitialized on 64-bit platforms.
> It leads to leaking of contents of kernel stack memory.
> 
> Currently there is no memset() in real implementations of getgeo()
> in drivers/block/, so it makes sense to have memset() in blkdev_ioctl().

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-08 13:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 14:48 [PATCH] block: ioctl: fix information leak to userland Vasiliy Kulikov
2010-11-08 13:42 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox