Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]

2018-02-16 Thread David Howells
Eric Biggers wrote: > memset() after vunmap(), and also when buf->virt can be NULL? I had > suggested: > > if (buf->virt) { > memset(buf->virt, 0, buf->nr_pages * PAGE_SIZE); > vunmap(buf->virt); > } Sorry, yes. I don't

Re: [RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]

2018-02-15 Thread Eric Biggers
Hi David, On Thu, Feb 15, 2018 at 10:53:49PM +, David Howells wrote: > /* > + * Free up the buffer. > + */ > +static void big_key_free_buffer(struct big_key_buf *buf) > +{ > + unsigned int i; > + > + vunmap(buf->virt); > + for (i = 0; i < buf->nr_pages; i++) > + if

[RFC PATCH] KEYS: Use individual pages in big_key for crypto buffers [ver #2]

2018-02-15 Thread David Howells
kmalloc() can't always allocate large enough buffers for big_key to use for crypto (1MB + some metadata) so we cannot use that to allocate the buffer. Further, vmalloc'd pages can't be passed to sg_init_one() and the aead crypto accessors cannot be called progressively and must be passed all the