Re: [v2 PATCH] crypto: sa2ul - Use proper helpers to setup request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Herbert,

On 13:04-20250327, Manorit Chawdhry wrote:
> Hi Herbert,
> 
> On 21:06-20250326, Herbert Xu wrote:
> > On Wed, Mar 26, 2025 at 06:01:20PM +0530, Manorit Chawdhry wrote:
> > >
> > > Thanks for the fix! Although, it still fails probably due to the
> > > introduction of multibuffer hash testing in "crypto: testmgr - Add
> > > multibuffer hash testing" but that we will have to fix for our driver I
> > > assume.
> > > 
> > > [   32.408283] alg: ahash: sha1-sa2ul digest() failed on test vector 0; expected_error=0, actual_error=-22, cfg="random: inplace_two_sglists may_sleep use_digest multibuffer(9/13/uneven) src_divs=[100.0%@+860] key_offset=17"
> > > [...]
> > > [   32.885927] alg: ahash: sha512-sa2ul digest() failed on test vector 0; expected_error=0, actual_error=-22, cfg="random: use_digest multibuffer(6/9/uneven) nosimd src_divs=[93.34%@+3634, 6.66%@+16] iv_offset=9 key_offset=70"
> > > [...]
> > > [   33.135286] alg: ahash: sha256-sa2ul digest() failed on test vector 0; expected_error=0, actual_error=-22, cfg="random: inplace_two_sglists may_sleep use_digest multibuffer(15/16/uneven) src_divs=[100.0%@alignmask+26] key_offset=1"

[..]

> > 
> > This means that one of the filler test requests triggered an EINVAL
> > from your driver.  A filler request in an uneven test can range from
> > 0 to 2 * PAGE_SIZE bytes long.
> > 
> 
> I tracked it down and see [0] returning -EINVAL. Do you have any
> insights as to what changed that it's not working anymore...
> 
> [0]: https://github.com/torvalds/linux/blob/38fec10eb60d687e30c8c6b5420d86e8149f7557/drivers/crypto/sa2ul.c#L1177

Added some more prints.

diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 091612b066f1..0e7692ae60e5 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -1176,7 +1176,13 @@ static int sa_run(struct sa_req *req)
                mapped_sg->sgt.orig_nents = sg_nents;
                ret = dma_map_sgtable(ddev, &mapped_sg->sgt, dir_src, 0);
                if (ret) {
+                       for (struct scatterlist *temp = src; temp; temp = sg_next(temp)) {
+                               pr_info("%s: %d: temp->length: %d, temp->offset: %d\n", __func__, __LINE__, temp->length, temp->offset);
+                       }
+                       pr_info("%s: %d: req->size: %d, src: %p\n", __func__, __LINE__, req->size, req->src);
+                       pr_info("%s: %d: sgl: %p, orig_nents: %d\n", __func__, __LINE__, mapped_sg->sgt.sgl, mapped_sg->sgt.orig_nents);
                        kfree(rxd);
+                       pr_info("%s: %d: ret=%d\n", __func__, __LINE__, ret);
                        return ret;
                }


root@j721e-evm:~# modprobe sa2ul
[   32.890801] omap_rng 4e10000.rng: Random Number Generator ver. 241b34c
root@j721e-evm:~# [   32.981093] sa_run: 1180: temp->length: 8192, temp->offset: 0
[   32.996268] sa_run: 1180: temp->length: 8192, temp->offset: 0
[   33.002029] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.007512] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.012986] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.018458] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.023930] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.029402] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.034874] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.040345] sa_run: 1182: req->size: 40187, src: 00000000f1859ae0
[   33.046426] sa_run: 1183: sgl: 00000000f1859ae0, orig_nents: -22
[   33.052419] sa_run: 1185: ret=-22
[   33.055852] sa_run: 1180: temp->length: 8192, temp->offset: 0
[   33.061589] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.067061] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.072532] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.078004] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.083475] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.088947] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.094419] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.099890] sa_run: 1182: req->size: 32768, src: 00000000f1859ae0
[   33.105969] sa_run: 1183: sgl: 00000000f1859ae0, orig_nents: -22
[   33.111962] sa_run: 1185: ret=-22
[   33.115268] sa_run: 1180: temp->length: 8192, temp->offset: 0
[   33.121001] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.126472] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.131944] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.137416] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.142888] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.148360] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.153832] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.159304] sa_run: 1182: req->size: 34117, src: 00000000f1859ae0
[   33.165382] sa_run: 1183: sgl: 00000000f1859ae0, orig_nents: -22
[   33.171375] sa_run: 1185: ret=-22
[   33.174725] sa_run: 1180: temp->length: 8192, temp->offset: 0
[   33.180459] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.185936] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.191408] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.196879] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.202351] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.207822] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.213294] sa_run: 1180: temp->length: 0, temp->offset: 0
[   33.218765] sa_run: 1182: req->size: 31875, src: 00000000f1859ae0
[   33.224845] sa_run: 1183: sgl: 00000000f1859ae0, orig_nents: -22
[   33.230838] sa_run: 1185: ret=-22
[   33.234204] alg: ahash: sha1-sa2ul digest() failed on test vector 0; expected_error=0, actual_error=-22, cfg="random: may_sleep use_digest multibuffer(8/14/uneven) src_divs=[100.0%@alignmask+3110] dst_divs=[100.0%@+2132] key_offset=63"
[

Regards,
Manorit

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




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux