Re: [bug] crypto/vmx/p8_ghash memory corruption in 4.8-rc7
From: Jan Stancek <jstancek@redhat.com>
Date: 2016-09-28 07:41:09
Also in:
linuxppc-dev, lkml
----- Original Message -----
From: "Herbert Xu" <herbert@gondor.apana.org.au> To: "Marcelo Cerri" <redacted> Cc: "Jan Stancek" <jstancek@redhat.com>, "rui y wang" <redacted>, mhcerri@linux.vnet.ibm.com, leosilva@linux.vnet.ibm.com, pfsmorigo@linux.vnet.ibm.com, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@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:quoted
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 [off-list ref] Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt