From: Nathan Chancellor <nathan@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Weili Qian <qianweili@huawei.com>,
Zhou Wang <wangzhou1@hisilicon.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] crypto: hisilicon: Wipe entire pool on error
Date: Fri, 6 Jan 2023 09:07:33 -0700 [thread overview]
Message-ID: <Y7hHRYUk6NypdZxT@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20230106041945.never.831-kees@kernel.org>
On Thu, Jan 05, 2023 at 08:19:48PM -0800, Kees Cook wrote:
> To work around a Clang __builtin_object_size bug that shows up under
> CONFIG_FORTIFY_SOURCE and UBSAN_BOUNDS, move the per-loop-iteration
> mem_block wipe into a single wipe of the entire pool structure after
> the loop.
>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Link: https://github.com/ClangBuiltLinux/linux/issues/1780
> Cc: Weili Qian <qianweili@huawei.com>
> Cc: Zhou Wang <wangzhou1@hisilicon.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-crypto@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
Thanks for the patch!
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
> ---
> drivers/crypto/hisilicon/sgl.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/hisilicon/sgl.c b/drivers/crypto/hisilicon/sgl.c
> index 2b6f2281cfd6..0974b0041405 100644
> --- a/drivers/crypto/hisilicon/sgl.c
> +++ b/drivers/crypto/hisilicon/sgl.c
> @@ -124,9 +124,8 @@ struct hisi_acc_sgl_pool *hisi_acc_create_sgl_pool(struct device *dev,
> for (j = 0; j < i; j++) {
> dma_free_coherent(dev, block_size, block[j].sgl,
> block[j].sgl_dma);
> - memset(block + j, 0, sizeof(*block));
> }
> - kfree(pool);
> + kfree_sensitive(pool);
> return ERR_PTR(-ENOMEM);
> }
> EXPORT_SYMBOL_GPL(hisi_acc_create_sgl_pool);
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-01-06 16:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-06 4:19 [PATCH] crypto: hisilicon: Wipe entire pool on error Kees Cook
2023-01-06 16:07 ` Nathan Chancellor [this message]
2023-01-07 1:55 ` Weili Qian
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=Y7hHRYUk6NypdZxT@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=keescook@chromium.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=ndesaulniers@google.com \
--cc=qianweili@huawei.com \
--cc=trix@redhat.com \
--cc=wangzhou1@hisilicon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox