Re: [PATCH] sysctl: Fix proc_do_large_bitmap for large input buffers

From: Luis Chamberlain
Date: Tue Mar 19 2019 - 11:30:12 EST

On Mon, Mar 04, 2019 at 10:43:09PM -0600, Eric Sandeen wrote:
> On 2/20/19 5:32 PM, Eric Sandeen wrote:
> > Today, proc_do_large_bitmap() truncates a large write input buffer
> > to PAGE_SIZE - 1, which may result in misparsed numbers at the
> > (truncated) end of the buffer. Further, it fails to notify the caller
> > that the buffer was truncated, so it doesn't get called iteratively
> > to finish the entire input buffer.
> >
> > Tell the caller if there's more work to do by adding the skipped
> > amount back to left/*lenp before returning.
> >
> > To fix the misparsing, reset the position if we have completely
> > consumed a truncated buffer (or if just one char is left, which
> > may be a "-" in a range), and ask the caller to come back for
> > more.
> >
> > Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>
> Would be nice to fix this bug. I submitted the test node patch as well
> as an attempt to integrate it into the test harness, though there's
> wonkiness there still, and I could use more experienced eyes.

Sorry for the delay.

I'm rolling these changes in with some minor adjustments, can you send
me your respective lib/test_sysctl.c changes? I don't see that they had
been sent.