Re: [RFC v2 1/2] kernel/sysctl: support setting sysctl parameters from kernel command line

From: Kees Cook
Date: Wed Mar 25 2020 - 18:54:14 EST


On Wed, Mar 25, 2020 at 05:20:40PM -0500, Eric W. Biederman wrote:
> Hmm. There is a big gotcha in here and I think it should be mentioned.
> This code only works because no one has done set_fs(KERNEL_DS). Which
> means this only works with strings that are kernel addresses essentially
> by mistake. A big fat comment documenting why it is safe to pass in
> kernel addresses to a function that takes a "char __user*" pointer
> would be very good.

Yeah, I was going to mention this too just now as I went looking through
one of the handlers and was reminded that the args are marked __user. :P

I suspect we might need to add some __force __user markings or something
(with a comment as you say above), to keep sparse from going crazy. :)

--
Kees Cook