Re: [PATCH] crypto: testmgr: don't allocate IV on stack
On Tue, Oct 31, 2017 at 09:05:57AM +, Horia Geantă wrote: > > > > The driver that is mapping the IV directly should be fixed instead. > > Only input that is given in the form of SG lists can be mapped. > > Everything else should be copied if they need to go over DMA. > > > Herbert, wouldn't it make more sense to follow your previous suggestion: > "Perhaps we should change the API so that it gets passed in as an > SG list." > https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg23082.html Unless someone is willing to work on that then we have to fix the drivers to fit the current API. Cheers, -- Email: Herbert XuHome Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Re: [PATCH] crypto: testmgr: don't allocate IV on stack
On 10/31/2017 10:00 AM, Herbert Xu wrote: > On Tue, Oct 31, 2017 at 07:56:26AM +, Gilad Ben-Yossef wrote: >> The IV was allocated on the stack in testmgr skcipher tests. >> Since HW based tfm providers need to DMA the IV to the HW, >> this leads to problems and is detected by the DMA-API debug >> code. >> >> Fix it by allocating the IV using kmalloc instead. >> >> Signed-off-by: Gilad Ben-YossefGilad, you're not the only one who bumped into this issue: https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg23074.html not to mention previous patches that have been accepted: 96692a7305c4 crypto: tcrypt - do not allocate iv on stack for aead speed tests 9bac019dad80 crypto: testmgr - Fix DMA-API warning and so on. > > The driver that is mapping the IV directly should be fixed instead. > Only input that is given in the form of SG lists can be mapped. > Everything else should be copied if they need to go over DMA. > Herbert, wouldn't it make more sense to follow your previous suggestion: "Perhaps we should change the API so that it gets passed in as an SG list." https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg23082.html Thanks, Horia
Re: [PATCH] crypto: testmgr: don't allocate IV on stack
On Tue, Oct 31, 2017 at 9:59 AM, Herbert Xuwrote: > On Tue, Oct 31, 2017 at 07:56:26AM +, Gilad Ben-Yossef wrote: >> The IV was allocated on the stack in testmgr skcipher tests. >> Since HW based tfm providers need to DMA the IV to the HW, >> this leads to problems and is detected by the DMA-API debug >> code. >> >> Fix it by allocating the IV using kmalloc instead. >> >> Signed-off-by: Gilad Ben-Yossef > > The driver that is mapping the IV directly should be fixed instead. > Only input that is given in the form of SG lists can be mapped. > Everything else should be copied if they need to go over DMA. Got it. Will do. Thanks, Gilad > > Cheers, > -- > Email: Herbert Xu > Home Page: http://gondor.apana.org.au/~herbert/ > PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru
Re: [PATCH] crypto: testmgr: don't allocate IV on stack
On Tue, Oct 31, 2017 at 07:56:26AM +, Gilad Ben-Yossef wrote: > The IV was allocated on the stack in testmgr skcipher tests. > Since HW based tfm providers need to DMA the IV to the HW, > this leads to problems and is detected by the DMA-API debug > code. > > Fix it by allocating the IV using kmalloc instead. > > Signed-off-by: Gilad Ben-YossefThe driver that is mapping the IV directly should be fixed instead. Only input that is given in the form of SG lists can be mapped. Everything else should be copied if they need to go over DMA. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt