lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200902052244.GA54052@sol.localdomain>
Date:   Tue, 1 Sep 2020 22:22:44 -0700
From:   Eric Biggers <ebiggers@...nel.org>
To:     linmiaohe <linmiaohe@...wei.com>
Cc:     "axboe@...nel.dk" <axboe@...nel.dk>,
        "satyat@...gle.com" <satyat@...gle.com>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] block: Fix potential NULL pointer dereference in
 __bio_crypt_clone()

On Wed, Sep 02, 2020 at 01:56:53AM +0000, linmiaohe wrote:
> Eric Biggers <ebiggers@...nel.org> wrote:
> >On Tue, Sep 01, 2020 at 07:59:21AM -0400, Miaohe Lin wrote:
> >> mempool_alloc() may return NULL if __GFP_DIRECT_RECLAIM is not set in 
> >> gfp_mask under memory pressure. So we should check the return value of
> >> mempool_alloc() against NULL before dereference.
> >> 
> >> Fixes: a892c8d52c02 ("block: Inline encryption support for blk-mq")
> >> Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
> >
> >It's intended that __GFP_DIRECT_RECLAIM always be set here.
> >Do you have an example where it isn't set here?
> 
> map_request() only pass GFP_ATOMIC to gfp_mask, though bio crypt is not used yet.
> 
> >Also, if this can indeed happen, then we need to make __bio_crypt_clone() (and bio_crypt_clone()) return a bool (or an error code) to indicate whether it succeeded or failed.  We can't just ignore the allocation failure.
> >
> >- Eric
> 
> IMO, just the allocation failure is ok or we would break KABI.
> Many thanks.
> 

Ignoring the allocation failure isn't okay, since it would cause encrypted I/O
to fall back to unencrypted I/O, which would cause data corruption.

Also, upstream doesn't have a stable KABI.

I sent out a patch with what I have in mind; can you take a look?
https://lkml.kernel.org/r/20200902051511.79821-1-ebiggers@kernel.org

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ