diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-10 16:28:48 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-10 16:28:48 +0100 |
commit | 450e45d9570450e6a10323902e4198c30cd312a0 (patch) | |
tree | e7ed997e325725b1d0e4f148df88fdd6d96382bb /kernel-tree-scripts | |
parent | 6de3d1ca89828354f7a1e2ca88b268bd3333ccdb (diff) |
curve25519: use kmalloc in order to not overflow stack
On MIPS, the IRQ and SoftIRQ handlers share the stack with whatever
kernel thread was interrupted. This means that Curve25519 can be
interrupted by, say, an ethernet controller, that then gets handled by a
SoftIRQ. If something like l2tp is being used, which uses quite a bit of
stack, then by the time the SoftIRQ handler gets to WireGuard code and
calls into the stack-heavy ChaPoly functions, our 8k stack is shot. In
other words, since Curve25519 is such a big consumer of stack, if it's
interrupted by anything else that uses a healthy amount of stack, then
disaster strikes.
The solution here is just to allocate using kmalloc. This is quite ugly,
and if performance becomes an issue, we might consider moving to a
kmem_cache allocator, or even having each peer keep its own preallocated
space. But for now, we'll try this.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'kernel-tree-scripts')
0 files changed, 0 insertions, 0 deletions