Re: [PATCH v3 00/16] Provide saturating helpers for allocation

2018-06-01 Thread Peter Rosin
Kees Cook wrote: > This is a stab at providing three new helpers for allocation size > calculation: > > struct_size(), array_size(), and array3_size(). > > These are implemented on top of Rasmus's overflow checking functions. The > existing allocators are adjusted to use the more efficient overfl

Re: [PATCH v3 00/16] Provide saturating helpers for allocation

2018-05-31 Thread Kees Cook
On Thu, May 31, 2018 at 5:54 PM, Linus Torvalds wrote: > On Thu, May 31, 2018 at 7:43 PM Kees Cook wrote: >> >> So, while nothing does: >> kmalloc_array(a, b, ...) -> kmalloc(array_size(a, b), ...) >> the treewide changes DO perform changes like this: >> kmalloc(a * b, ...) -> kmalloc(arr

Re: [PATCH v3 00/16] Provide saturating helpers for allocation

2018-05-31 Thread Linus Torvalds
On Thu, May 31, 2018 at 7:43 PM Kees Cook wrote: > > So, while nothing does: > kmalloc_array(a, b, ...) -> kmalloc(array_size(a, b), ...) > the treewide changes DO perform changes like this: > kmalloc(a * b, ...) -> kmalloc(array_size(a, b), ...) Ugh. I really really still absolutely desp

[PATCH v3 00/16] Provide saturating helpers for allocation

2018-05-31 Thread Kees Cook
This is a stab at providing three new helpers for allocation size calculation: struct_size(), array_size(), and array3_size(). These are implemented on top of Rasmus's overflow checking functions. The existing allocators are adjusted to use the more efficient overflow checks as well. While the t