Re: [RFC] memdup_user() and friends

2018-01-08 Thread Andy Shevchenko
On Sun, Jan 7, 2018 at 4:16 AM, Al Viro wrote: > What I propose is > * switch memdup_user() to GFP_USER > * add vmemdup_user(), using kvmalloc() instead of kmalloc() (also with > GFP_USER) Perhaps kvmemdup_user() for sake of consistency? > * switch open-coded instances o

Re: [RFC] memdup_user() and friends

2018-01-08 Thread Marcelo Ricardo Leitner
On Sun, Jan 07, 2018 at 02:16:56AM +, Al Viro wrote: ... > > Everything else is definitely fine with GFP_USER - it's stuff like "copy of > ioctl > arguments in an ioctl never issued by the kernel code, must have come > straight from > ioctl(2)" and things like that. IMO we should simply swi

[RFC] memdup_user() and friends

2018-01-06 Thread Al Viro
After reviewing memdup_user() callers, I've found several places where it got completely unbounded values passed for size (up to 2Gb), as well as some bounded by ridiculously high values - e.g. if (size > 1024 * 128) /* sane value */ return -EINVAL; contain