Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1594944

Re: [PATCH] zram: set physical queue limits to avoid array out of bounds accesses

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH] zram: set physical queue limits to avoid array out of bounds accesses
Date 2017-03-08 09:50 +0100
Message-ID <tiFse-3Rn-7@gated-at.bofh.it> (permalink)
References (3 earlier) <tihJf-45F-1@gated-at.bofh.it> <tijrI-5mG-19@gated-at.bofh.it> <tijrI-5mG-17@gated-at.bofh.it> <tikxr-66H-1@gated-at.bofh.it> <tiCE1-1ZF-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 03/08/2017 06:11 AM, Minchan Kim wrote:
> And could you test this patch? It avoids split bio so no need new bio
> allocations and makes zram code simple.
> 
> From f778d7564d5cd772f25bb181329362c29548a257 Mon Sep 17 00:00:00 2001
> From: Minchan Kim <minchan@kernel.org>
> Date: Wed, 8 Mar 2017 13:35:29 +0900
> Subject: [PATCH] fix
> 
> Not-yet-Signed-off-by: Minchan Kim <minchan@kernel.org>
> ---

[...]

Yup, this works here.

I did a mkfs.xfs /dev/nvme0n1
dd if=/dev/urandom of=/test.bin bs=1M count=128
sha256sum test.bin
mount /dev/nvme0n1 /dir
mv test.bin /dir/
sha256sum /dir/test.bin

No panics and sha256sum of the 128MB test file still matches

Tested-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

Now that you removed the one page limit in zram_bvec_rw() you can also
add this hunk to remove the queue splitting:

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 85f4df8..27b168f6 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -868,8 +868,6 @@ static blk_qc_t zram_make_request(struct
request_queue *queue, struct bio *bio)
 {
        struct zram *zram = queue->queuedata;

-       blk_queue_split(queue, &bio, queue->bio_split);
-
        if (!valid_io_request(zram, bio->bi_iter.bi_sector,
                                        bio->bi_iter.bi_size)) {
                atomic64_inc(&zram->stats.invalid_io);

Byte,
	Johannes

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] zram: set physical queue limits to avoid array out of bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-06 11:30 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-06 11:50 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Andrew Morton <akpm@linux-foundation.org> - 2017-03-06 22:40 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 07:10 +0100
    Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 08:30 +0100
      Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 10:20 +0100
        Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-07 11:30 +0100
          Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-08 06:50 +0100
            Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-08 09:50 +0100
              Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-09 06:30 +0100
      Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Hannes Reinecke <hare@suse.de> - 2017-03-07 12:40 +0100
    Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Hannes Reinecke <hare@suse.de> - 2017-03-07 08:40 +0100

csiph-web