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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAeCc_nj1Sk_dAkasYNvwtJtUc1et3cveoTETh25RSojStqNDQ@mail.gmail.com>
Date: Wed, 21 May 2025 11:07:43 +0530
From: Bharat Bhushan <bharatb.linux@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Bharat Bhushan <bbhushan2@...vell.com>, bbrezillon@...nel.org, schalla@...vell.com, 
	davem@...emloft.net, giovanni.cabiddu@...el.com, linux@...blig.org, 
	linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org, 
	stable@...r.kernel.org
Subject: Re: [PATCH 2/4 v2] crypto: octeontx2: Fix address alignment issue on
 ucode loading

On Wed, May 21, 2025 at 4:32 AM Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> On Tue, May 20, 2025 at 06:37:35PM +0530, Bharat Bhushan wrote:
> >
> > @@ -1519,22 +1520,27 @@ int otx2_cpt_discover_eng_capabilities(struct otx2_cptpf_dev *cptpf)
> >       if (ret)
> >               goto delete_grps;
> >
> > -     compl_rlen = ALIGN(sizeof(union otx2_cpt_res_s), OTX2_CPT_DMA_MINALIGN);
> > -     len = compl_rlen + LOADFVC_RLEN;
> > +     len = LOADFVC_RLEN + sizeof(union otx2_cpt_res_s) +
> > +            OTX2_CPT_RES_ADDR_ALIGN;
> >
> > -     result = kzalloc(len, GFP_KERNEL);
> > -     if (!result) {
> > +     rptr = kzalloc(len, GFP_KERNEL);
> > +     if (!rptr) {
> >               ret = -ENOMEM;
> >               goto lf_cleanup;
> >       }
> > -     rptr_baddr = dma_map_single(&pdev->dev, (void *)result, len,
> > +
> > +     rptr_baddr = dma_map_single(&pdev->dev, rptr, len,
> >                                   DMA_BIDIRECTIONAL);
>
> After this change rptr is still unaligned.  However, you appear
> to be doing bidirectional DMA to rptr, so it should be aligned
> to ARCH_DMA_MINALIGN or you risk corrupting the surrounding
> memory.

Yes, rptr was not aligned as ARCH_KMALLOC_MINALIGN and rptr alignment are same.
But as per the second part of the comment, rptr must be aligned to
ARCH_DMA_MINALIGN.
So will change total memory allocation and rptr and result_address
alignment accordingly.

Thanks
-Bharat
>
> Only TO_DEVICE DMA addresses can be unaligned.
>
> Cheers,
> --
> Email: Herbert Xu <herbert@...dor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ