[bug] crypto/vmx/p8_ghash memory corruption in 4.8-rc7

Jan Stancek jstancek at redhat.com
Wed Sep 28 17:40:51 AEST 2016





----- Original Message -----
> From: "Herbert Xu" <herbert at gondor.apana.org.au>
> To: "Marcelo Cerri" <marcelo.cerri at canonical.com>
> Cc: "Jan Stancek" <jstancek at redhat.com>, "rui y wang" <rui.y.wang at intel.com>, mhcerri at linux.vnet.ibm.com,
> leosilva at linux.vnet.ibm.com, pfsmorigo at linux.vnet.ibm.com, linux-crypto at vger.kernel.org,
> linuxppc-dev at lists.ozlabs.org, linux-kernel at vger.kernel.org
> Sent: Wednesday, 28 September, 2016 4:45:49 AM
> Subject: Re: [bug] crypto/vmx/p8_ghash memory corruption in 4.8-rc7
> 
> On Tue, Sep 27, 2016 at 04:46:44PM -0300, Marcelo Cerri wrote:
> > 
> > Can you check if the problem occurs with this patch?
> 
> In light of the fact that padlock-sha is the correct example
> to follow, you only need to add one line to the init_tfm fucntion
> to update the descsize based on that of the fallback.

Thanks for clearing up how this works in padlock-sha, but
we are not exactly in same situation with p8_ghash.

p8_ghash_init_tfm() already updates descsize. Problem in original report
is that without custom export/import/statesize p8_ghash_alg.statesize
gets initialized by shash_prepare_alg() to alg->descsize:

crash> p p8_ghash_alg.statesize
$1 = 56

testmgr allocates space for export based on crypto_shash_statesize(),
but shash_default_export() writes based on crypto_shash_descsize():
[    8.297902] state: c0000004b873aa80, statesize: 56
[    8.297932] shash_default_export memcpy c0000004b873aa80 c0000004b8607da0, len: 76

so I think we need either:
1) make sure p8_ghash_alg.descsize is correct before we register shash,
   this is what Marcelo's last patch is doing
2) provide custom export/import/statesize for p8_ghash_alg

Regards,
Jan

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


More information about the Linuxppc-dev mailing list