mm/usercopy: Detect vmalloc overruns
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 10 Jan 2022 23:15:28 +0000 (23:15 +0000)
committerKees Cook <keescook@chromium.org>
Wed, 13 Apr 2022 19:15:51 +0000 (12:15 -0700)
commit0aef499f3172a60222ae7460d61b364c134d6e1a
tree5e358ea58cd25805b0b588bdbe198fb9d28e6733
parent4e140f59d285c1ca1e5c81b4c13e27366865bd09
mm/usercopy: Detect vmalloc overruns

If you have a vmalloc() allocation, or an address from calling vmap(),
you cannot overrun the vm_area which describes it, regardless of the
size of the underlying allocation.  This probably doesn't do much for
security because vmalloc comes with guard pages these days, but it
prevents usercopy aborts when copying to a vmap() of smaller pages.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220110231530.665970-3-willy@infradead.org
mm/usercopy.c