Skip to content

Commit f2544f5

Browse files
rddunlapmimizohar
authored andcommitted
EVM: fix the evm= __setup handler return value
__setup() handlers should return 1 if the parameter is handled. Returning 0 causes the entire string to be added to init's environment strings (limited to 32 strings), unnecessarily polluting it. Using the documented string "evm=fix" causes an Unknown parameter message: Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5 evm=fix", will be passed to user space. and that string is added to init's environment string space: Run /sbin/init as init process with arguments: /sbin/init with environment: HOME=/ TERM=linux BOOT_IMAGE=/boot/bzImage-517rc5 evm=fix With this change, using "evm=fix" acts as expected and an invalid option ("evm=evm") causes a warning to be printed: evm: invalid "evm" mode but init's environment is not polluted with this string, as expected. Fixes: 7102ebc ("evm: permit only valid security.evm xattrs to be updated") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru> Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
1 parent cd3bc04 commit f2544f5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

security/integrity/evm/evm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int __init evm_set_fixmode(char *str)
8686
else
8787
pr_err("invalid \"%s\" mode", str);
8888

89-
return 0;
89+
return 1;
9090
}
9191
__setup("evm=", evm_set_fixmode);
9292

0 commit comments

Comments
 (0)