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

- From: Luis Chamberlain \<mcgrof@kernel.org\>
- Date: 2020-03-30 22:09:45 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2020/03/5912201
- Thread: https://ratatoskr.run/linux-api/2020/03/5908345/t.md

```text
On Thu, Mar 26, 2020 at 07:45:13AM -0500, Eric W. Biederman wrote:
> > On Wed 25-03-20 17:20:40, Eric W. Biederman wrote:
> plus I want to get very far away from the incorrect idea that you
> can have sysctls without compiling in proc support.  That is not how
> the code works, that is not how the code is tested.

Agreed.

> It is also worth pointing out that:
> 
> 	proc_mnt = kern_mount(proc_fs_type);
>         for_each_sysctl_cmdline() {
>         	...
> 		file = file_open_root(proc_mnt->mnt_root, proc_mnt, sysctl_path, O_WRONLY, 0);
> 		kernel_write(file, value, value_len);
>         }
>         kern_umount(proc_mnt);
> 
> Is not an unreasonable implementation.

This:

> There are problems with a persistent mount of proc in that it forces
> userspace not to use any proc mount options.  But a temporary mount of
> proc to deal with command line options is not at all unreasonable.
> Plus it looks like we can have kern_write do all of the kernel/user
> buffer silliness.

Is a bit of tribal knowledge worth documenting for the approach taken
forward. Vlastimil can you add a little comment mentioning some of this
logic?

  Luis
```
