Re: [PATCH] proc_sysctl: clamp sizes using table->maxlen

From: Christoph Hellwig
Date: Tue Feb 16 2021 - 03:48:23 EST


On Mon, Feb 15, 2021 at 09:53:05AM -0500, Alex Xu (Hello71) wrote:
> Since maxlen is already exposed, we can allocate approximately the right
> amount directly, fixing up those drivers which set a bogus maxlen. These
> drivers were located based on those which had copy_x_user replaced in
> 32927393dc1c, on the basis that other drivers either use builtin proc_*
> handlers, or do not access the data pointer. The latter is OK because
> maxlen only needs to be an upper limit.

Please split this into one patch each each subsystem that sets maxlen
to 0 and the actual change to proc_sysctl.c.

How do these maxlen = 0 entries even survive the sysctl_check_table
check?