public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Clear kernel memory before copying to user
@ 2018-11-07 14:37 Keith Busch
  2018-11-07 14:46 ` Laurence Oberman
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Keith Busch @ 2018-11-07 14:37 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: Keith Busch

If the kernel allocates a bounce buffer for user read data, this memory
needs to be cleared before copying it to the user, otherwise it may leak
kernel memory to user space.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bio.c b/block/bio.c
index d5368a445561..a50d59236b19 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1260,6 +1260,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
 		if (ret)
 			goto cleanup;
 	} else {
+		zero_fill_bio(bio);
 		iov_iter_advance(iter, bio->bi_iter.bi_size);
 	}
 
-- 
2.14.4

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

end of thread, other threads:[~2018-11-08 15:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07 14:37 [PATCH] block: Clear kernel memory before copying to user Keith Busch
2018-11-07 14:46 ` Laurence Oberman
2018-11-07 15:09 ` Ming Lei
2018-11-07 15:15   ` Keith Busch
2018-11-07 15:44     ` Ming Lei
2018-11-07 15:44       ` Keith Busch
2018-11-07 16:03         ` Ming Lei
2018-11-07 16:09           ` Keith Busch
2018-11-08  1:12             ` Ming Lei
2018-11-08  1:22               ` Keith Busch
2018-11-08 10:07                 ` Johannes Thumshirn
2018-11-08 11:10                   ` Ming Lei
2018-11-08 15:37                     ` Keith Busch
2018-11-08  1:31               ` Jens Axboe
2018-11-07 22:41 ` Jens Axboe

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