Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Thara Gopinath <thara.gopinath@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Stanimir Varbanov <svarbanov@mm-sol.com>,
	Eneas U de Queiroz <cotequeiroz@gmail.com>,
	Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>,
	Eric Biggers <ebiggers@kernel.org>,
	Demi Marie Obenour <demiobenour@gmail.com>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Russell King <linux@armlinux.org.uk>,
	Abel Vesa <abelvesa@kernel.org>,
	linux-crypto@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: Re: [PATCH v9 00/14] crypto: qce - Fix crypto self-test failures
Date: Thu, 8 Oct 2026 19:35:21 +1100	[thread overview]
Message-ID: <asdVyUKWndnZ1Mxv@gondor.apana.org.au> (raw)
In-Reply-To: <CAMRc=MdRBu5gg7Q3pz8Wn9Da4RpmmiKLP2-LwiszKCd3o8jQdQ@mail.gmail.com>

On Fri, Oct 02, 2026 at 10:31:41PM +0300, Bartosz Golaszewski wrote:
>
> > Please check the Sashiko comments:
> >
> > https://sashiko.dev/#/patchset/20260922-qce-fix-self-tests-v9-0-b1aa742e79af%40oss.qualcomm.com
> >
> 
> I've gone through them. None of the issues were introduced by this series, all
> are pre-existing. I've added them to my list and will fix them. Can we not
> delay this series any longer and instead work in smaller steps since the crypto
> algos will be disabled by default anyway?

The very first comment appears to be pointing to new code:

> > +/*
> > + * BAM DMA cannot handle zero-length transfers, so the driver always holds
> > + * back at least one byte to submit to the engine. A zero rctx->buflen at
> > + * finalization time does not necessarily mean the message is empty: the
> > + * caller may have imported a state that already reflects some hashed data
> > + * with nothing currently buffered. Handle both cases through the software
> > + * fallback: reconstruct the running state when there is one instead of
> > + * assuming the message is empty.
> > + */
> > +static int qce_ahash_finalize_zero(struct ahash_request *req)
> > +{
> > +	struct qce_sha_reqctx *rctx = ahash_request_ctx_dma(req);
> > +	HASH_FBREQ_ON_STACK(fbreq, req);
> > +	struct __sha256_ctx core;
> > +	struct scatterlist sg;
> > +	int ret;
> > +
> > +	sg_init_one(&sg, NULL, 0);
> Can this trigger a kernel panic during zero-length finalization?
> qce_ahash_finalize_zero() creates a dummy scatterlist by calling
> sg_init_one(&sg, NULL, 0).
> sg_init_one() unconditionally calls sg_set_buf(), which attempts to resolve
> the page via virt_to_page(NULL).
> If CONFIG_DEBUG_SG is enabled, this triggers a BUG_ON(!virt_addr_valid(buf))
> kernel panic, because 0 is not a valid linear map address.
> If disabled, it results in a bogus PFN being stored in the scatterlist,
> leading to potential invalid memory access during software fallback operations.
> This path appears reachable by untrusted userspace via AF_ALG performing a
> zero-length HMAC finalization.

How is this a pre-existing issue?

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


      reply	other threads:[~2026-10-08  8:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 12:57 [PATCH v9 00/14] crypto: qce - Fix crypto self-test failures Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 01/14] crypto: qce - Fix HMAC self-test failures for empty messages Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 02/14] crypto: qce - Reject empty messages for AES-XTS Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 03/14] crypto: qce - Fix CTR-AES for partial block requests Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 04/14] crypto: qce - Use a fallback for AES-CTR with a partial final block Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 05/14] crypto: qce - Use fallback for fragmented skcipher payloads Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 06/14] crypto: qce - Fix xts-aes-qce for weak keys Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 07/14] crypto: qce - Use a fallback for CCM with a partial final block Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 08/14] crypto: qce - Use fallback for CCM with a fragmented payload Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 09/14] crypto: qce - Only register algos if the user really wants it Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 10/14] Revert "crypto: qce - Mark QCE as BROKEN" Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 11/14] crypto: qce - convert to auxiliary bus Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 12/14] soc: qcom: add core driver for the Qualcomm Crypto Engine Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 13/14] arm64: defconfig: enable the Qualcomm Crypto Engine core driver Bartosz Golaszewski
2026-09-22 12:57 ` [PATCH v9 14/14] arm: multi_v7_defconfig: " Bartosz Golaszewski
2026-09-23  9:14   ` Konrad Dybcio
2026-09-29 11:52 ` [PATCH v9 00/14] crypto: qce - Fix crypto self-test failures Pankaj Patil
2026-10-02  8:24 ` Herbert Xu
2026-10-02 19:31   ` Bartosz Golaszewski
2026-10-08  8:35     ` Herbert Xu [this message]

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=asdVyUKWndnZ1Mxv@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=abelvesa@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=cotequeiroz@gmail.com \
    --cc=davem@davemloft.net \
    --cc=demiobenour@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=kuldeep.singh@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=stable@vger.kernel.org \
    --cc=svarbanov@mm-sol.com \
    --cc=thara.gopinath@gmail.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