Re: [PATCH] proc: use vmalloc for our kernel buffer

From: Al Viro
Date: Thu Aug 13 2020 - 12:21:47 EST


On Thu, Aug 13, 2020 at 04:19:27PM +0000, David Laight wrote:
> From: Josef Bacik
> > Sent: 13 August 2020 15:53
> >
> > sysctl: pass kernel pointers to ->proc_handler
> >
> > we have been pre-allocating a buffer to copy the data from the proc
> > handlers into, and then copying that to userspace. The problem is this
> > just blind kmalloc()'s the buffer size passed in from the read, which in
> > the case of our 'cat' binary was 64kib. Order-4 allocations are not
> > awesome, and since we can potentially allocate up to our maximum order,
> > use vmalloc for these buffers.
>
> What happens if I run 'dd bs=16M ...' ?

Try it.