sched/core: validate sched_proxy_exec bootarg format
PATCH 1/1 sched/core: validate sched_proxy_exec bootarg format
setup_proxy_exec() currently accepts any non-empty suffix and parses str + 1, even when the boot argument does not contain '='.
Because __setup("sched_proxy_exec", ...) matches by prefix, malformed tokens can reach setup_proxy_exec() without an '=' and be interpreted from the wrong offset instead of being rejected.
Require either an empty suffix or an explicit '=bool' suffix before calling kstrtobool().
Fixes 25c411fce735 ("sched: Add CONFIG_SCHED_PROXY_EXEC & boot argument
to enable/disable")
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -132,7 +132,7 @@ static int __init setup_proxy_exec(char *str) {bool proxy_enable = true; -if (*str &&kstrtobool (str +1 , &proxy_enable)) { +if (*str && (*str !='=' ||kstrtobool (str +1 , &proxy_enable))) {pr_warn ("Unable to parse sched_proxy_exec=\n" );return 0 ; }
Signature · 1 line
2.47.3