The patch titled Subject: mm/usercopy: return 1 from hardened_usercopy __setup() handler has been added to the -mm tree. Its filename is mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Subject: mm/usercopy: return 1 from hardened_usercopy __setup() handler __setup() handlers should return 1 if the command line option is handled and 0 if not (or maybe never return 0; it just pollutes init's environment). This prevents: Unknown kernel command line parameters \ "BOOT_IMAGE=/boot/bzImage-517rc5 hardened_usercopy=off", will be \ passed to user space. Run /sbin/init as init process with arguments: /sbin/init with environment: HOME=/ TERM=linux BOOT_IMAGE=/boot/bzImage-517rc5 hardened_usercopy=off or hardened_usercopy=on but when "hardened_usercopy=foo" is used, there is no Unknown kernel command line parameter. Return 1 to indicate that the boot option has been handled. Print a warning if strtobool() returns an error on the option string, but do not mark this as in unknown command line option and do not cause init's environment to be polluted with this string. Link: https://lkml.kernel.org/r/20220222034249.14795-1-rdunlap@xxxxxxxxxxxxx Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@xxxxxxxxxxxx Fixes: b5cb15d9372ab ("usercopy: Allow boot cmdline disabling of hardening") Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx> Reported-by: Igor Zhbanov <i.zhbanov@xxxxxxxxxxxx> Cc: Chris von Recklinghausen <crecklin@xxxxxxxxxx> Cc: Kees Cook <keescook@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/usercopy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/usercopy.c~mm-usercopy-return-1-from-hardened_usercopy-__setup-handler +++ a/mm/usercopy.c @@ -284,7 +284,10 @@ static bool enable_checks __initdata = t static int __init parse_hardened_usercopy(char *str) { - return strtobool(str, &enable_checks); + if (strtobool(str, &enable_checks)) + pr_warn("Invalid option string for hardened_usercopy: '%s'\n", + str); + return 1; } __setup("hardened_usercopy=", parse_hardened_usercopy); _ Patches currently in -mm which might be from rdunlap@xxxxxxxxxxxxx are mm-memcontrol-return-1-from-cgroupmemory-__setup-handler.patch mm-mmap-return-1-from-stack_guard_gap-__setup-handler.patch mm-usercopy-return-1-from-hardened_usercopy-__setup-handler.patch inith-improve-__setup-and-early_param-documentation.patch init-mainc-return-1-from-handled-__setup-functions.patch docs-sysctl-kernel-add-missing-bit-to-panic_print-fix.patch