summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKrister Johansen <kjlx@templeofstupid.com>2023-10-28 00:46:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-03 09:31:24 +0300
commitf95e9f7afe86cf589a076d38c0d59a490ba5a70e (patch)
treec93aca7e125ece9c5fb32bb7df552542dfd3d0c2 /fs
parent3f3880fc011cd71650e5ca707b4fb9c85a18e0cd (diff)
downloadlinux-f95e9f7afe86cf589a076d38c0d59a490ba5a70e.tar.xz
proc: sysctl: prevent aliased sysctls from getting passed to init
commit 8001f49394e353f035306a45bcf504f06fca6355 upstream. The code that checks for unknown boot options is unaware of the sysctl alias facility, which maps bootparams to sysctl values. If a user sets an old value that has a valid alias, a message about an invalid parameter will be printed during boot, and the parameter will get passed to init. Fix by checking for the existence of aliased parameters in the unknown boot parameter code. If an alias exists, don't return an error or pass the value to init. Signed-off-by: Krister Johansen <kjlx@templeofstupid.com> Cc: stable@vger.kernel.org Fixes: 0a477e1ae21b ("kernel/sysctl: support handling command line aliases") Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Krister Johansen <kjlx@templeofstupid.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/proc_sysctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index caa421ba078f..4192fe6ec3da 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1780,6 +1780,13 @@ static const char *sysctl_find_alias(char *param)
return NULL;
}
+bool sysctl_is_alias(char *param)
+{
+ const char *alias = sysctl_find_alias(param);
+
+ return alias != NULL;
+}
+
/* Set sysctl value passed on kernel command line. */
static int process_sysctl_arg(char *param, char *val,
const char *unused, void *arg)