On Tue, 16 Sep 2025, Herbert Xu wrote:
> On Mon, Sep 15, 2025 at 05:06:51PM +0200, Mikulas Patocka wrote:
> >
> > Would it be possible to export the function crypto_ahash_stack_req_ok, so
> > that I could know up-front whether having a request on the stack will
> > succeed or not?
> >
> > Perhaps the function crypto_ahash_stack_req_ok could take "struct
> > crypto_ahash *" argument rather than "struct ahash_request, *" so that I
> > would know in advance whether it makes sense to try to build the request
> > on the stack or not.
>
> I think the pain point is the use of SG lists. If we could convert
> them to something like iov's then you should be able to supply stack
> memory unconditionally.
>
> Cheers,
On architectures without automatic DMA/cache coherency, you must make sure
that you do not write to a cacheline simultaneously using DMA and CPU.
This would be hard to guarantee if the crypto request is on the stack
because it may share a cacheline with many other local variables.
Mikulas