LoadPin: Refactor sysctl initialization
authorKees Cook <keescook@chromium.org>
Fri, 9 Dec 2022 19:57:43 +0000 (11:57 -0800)
committerKees Cook <keescook@chromium.org>
Thu, 19 Jan 2023 23:18:20 +0000 (15:18 -0800)
commit60ba1028fc7b73e3cfbcfe7087a2e87e8b1fd208
tree0ad3b50b482651c8531b25d07b450a328f052a21
parentb76ded214633cf5067ff51642a360eb87242c411
LoadPin: Refactor sysctl initialization

In preparation for shifting root mount when not enforcing, split sysctl
logic out into a separate helper, and unconditionally register the
sysctl, but only make it writable when the device is writable.

Cc: Paul Moore <paul@paul-moore.com>
Cc: James Morris <jmorris@namei.org>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: linux-security-module@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Link: https://lore.kernel.org/r/20221209195746.1366607-2-keescook@chromium.org
security/loadpin/loadpin.c