Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1514843

Re: vmalloced stacks and scatterwalk_map_and_copy()

From Eric Biggers <ebiggers@google.com>
Newsgroups linux.kernel
Subject Re: vmalloced stacks and scatterwalk_map_and_copy()
Date 2016-11-03 22:20 +0100
Message-ID <szxAt-NU-5@gated-at.bofh.it> (permalink)
References <szuMh-7u4-1@gated-at.bofh.it> <szwXM-lr-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Nov 03, 2016 at 01:30:49PM -0700, Andy Lutomirski wrote:
> 
> Also, Herbert, it seems like the considerable majority of the crypto
> code is acting on kernel virtual memory addresses and does software
> processing.  Would it perhaps make sense to add a kvec-based or
> iov_iter-based interface to the crypto code?  I bet it would be quite
> a bit faster and it would make crypto on stack buffers work directly.

I'd like to hear Herbert's opinion on this too, but as I understand it, if a
symmetric cipher API operating on virtual addresses was added, similar to the
existing "shash" API it would only allow software processing.  Whereas with the
current API you can request a transform and use it the same way regardless of
whether the crypto framework has chosen a software or hardware implementation,
or a combination thereof.  If this wasn't a concern then I expect using virtual
addresses would indeed simplify things a lot, at least for users not already
working with physical memory (struct page).

Either way, in the near term it looks like 4.9 will be released with the new
behavior that encryption/decryption is not supported on stack buffers.
Separately from the scatterwalk_map_and_copy() issue, today I've found two
places in the filesystem-level encryption code that do encryption on stack
buffers and therefore hit the 'BUG_ON(!virt_addr_valid(buf));' in sg_set_buf().
I will be sending patches to fix these, but I suspect there may be more crypto
API users elsewhere that have this same problem.

Eric

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

vmalloced stacks and scatterwalk_map_and_copy() Eric Biggers <ebiggers@google.com> - 2016-11-03 19:20 +0100
  Re: vmalloced stacks and scatterwalk_map_and_copy() Andy Lutomirski <luto@amacapital.net> - 2016-11-03 21:40 +0100
    Re: vmalloced stacks and scatterwalk_map_and_copy() Eric Biggers <ebiggers@google.com> - 2016-11-03 22:20 +0100
      Re: vmalloced stacks and scatterwalk_map_and_copy() Eric Biggers <ebiggers@google.com> - 2016-11-04 00:20 +0100
        Re: vmalloced stacks and scatterwalk_map_and_copy() Andy Lutomirski <luto@amacapital.net> - 2016-11-04 05:00 +0100
          Re: vmalloced stacks and scatterwalk_map_and_copy() Eric Biggers <ebiggers@google.com> - 2016-11-04 18:10 +0100

csiph-web