All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Potapenko <glider@google.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Damien Le Moal <damien.lemoal@wdc.com>,
	Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Dmitriy Vyukov <dvyukov@google.com>
Subject: Re: null_handle_cmd() doesn't initialize data when reading
Date: Mon, 11 May 2020 14:58:02 +0200	[thread overview]
Message-ID: <CAG_fn=WQXuTuGmC8oQ25f6DYJ4CiMSz7_S7Nkp+z6L1QL7Zokw@mail.gmail.com> (raw)
In-Reply-To: <277579c9-9e33-89ea-bfcd-bc14a543726c@acm.org>

On Sun, May 10, 2020 at 6:20 PM Bart Van Assche <bvanassche@acm.org> wrote:
>
> On 2020-05-10 03:03, Alexander Potapenko wrote:
> > Thanks for the explanation!
> > The code has changed recently, and my patch does not apply anymore,
> > yet the problem still persists.
> > I ended up just calling null_handle_rq() at the end of
> > null_process_cmd(), but we probably need a cleaner fix.
>
> Does this (totally untested) patch help? copy_to_nullb() guarantees that
> it will write some data to the pages that it allocates but does not
> guarantee yet that all data of the pages it allocates is initialized.

No, this does not help. Apparently null_insert_page() is never called
in this scenario.
If I modify __page_cache_alloc() to allocate zero-initialized pages,
the reports go away.
This means there's no other uninitialized buffer that's copied to the
page cache, the nullb driver just forgets to write anything to the
page cache.

> diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
> index 8efd8778e209..06f5761fccb6 100644
> --- a/drivers/block/null_blk_main.c
> +++ b/drivers/block/null_blk_main.c
> @@ -848,7 +848,7 @@ static struct nullb_page *null_insert_page(struct
> nullb *nullb,
>
>         spin_unlock_irq(&nullb->lock);
>
> -       t_page = null_alloc_page(GFP_NOIO);
> +       t_page = null_alloc_page(GFP_NOIO | __GFP_ZERO);
>         if (!t_page)
>                 goto out_lock;
>


-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

  reply	other threads:[~2020-05-11 12:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-15 10:16 null_handle_cmd() doesn't initialize data when reading Alexander Potapenko
2019-11-20 23:12 ` Jens Axboe
2019-11-22 11:58   ` Alexander Potapenko
2019-11-25  4:01     ` Chaitanya Kulkarni
2020-05-10 10:03       ` Alexander Potapenko
2020-05-10 16:20         ` Bart Van Assche
2020-05-11 12:58           ` Alexander Potapenko [this message]
2020-05-11 13:01             ` Damien Le Moal
2020-05-11 13:09               ` Alexander Potapenko
2020-05-11 23:18             ` Bart Van Assche
2020-05-12  1:25               ` Bart Van Assche
2020-05-12  1:42                 ` Damien Le Moal
2020-05-12  2:43                   ` Bart Van Assche
2020-05-12  3:23                     ` Damien Le Moal

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='CAG_fn=WQXuTuGmC8oQ25f6DYJ4CiMSz7_S7Nkp+z6L1QL7Zokw@mail.gmail.com' \
    --to=glider@google.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@wdc.com \
    --cc=dvyukov@google.com \
    --cc=linux-block@vger.kernel.org \
    --cc=willemb@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.