linux-stable/security/tomoyo
Randy Dunlap 387a8f09c2 TOMOYO: fix __setup handlers return values
[ Upstream commit 39844b7e30 ]

__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 strings "TOMOYO_loader=string1" and
"TOMOYO_trigger=string2" causes an Unknown parameter message:
  Unknown kernel command line parameters
    "BOOT_IMAGE=/boot/bzImage-517rc5 TOMOYO_loader=string1 \
     TOMOYO_trigger=string2", will be passed to user space.

and these strings are 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
     TOMOYO_loader=string1
     TOMOYO_trigger=string2

With this change, these __setup handlers act as expected,
and init's environment is not polluted with these strings.

Fixes: 0e4ae0e0de ("TOMOYO: Make several options configurable.")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Igor Zhbanov <i.zhbanov@omprussia.ru>
Link: https://lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru
Cc: James Morris <jmorris@namei.org>
Cc: Kentaro Takeda <takedakn@nttdata.co.jp>
Cc: tomoyo-dev-en@lists.osdn.me
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:06:35 +02:00
..
policy tomoyo: Do not generate empty policy files 2015-04-07 21:27:45 +02:00
.gitignore tomoyo: Do not generate empty policy files 2015-04-07 21:27:45 +02:00
Kconfig tomoyo: Use bin2c to generate builtin-policy.h 2015-04-07 21:27:45 +02:00
Makefile tomoyo: Do not generate empty policy files 2015-04-07 21:27:45 +02:00
audit.c tomoyo: Use sensible time interface 2014-06-12 16:18:45 +02:00
common.c tomoyo: Use sensible time interface 2014-06-12 16:18:45 +02:00
common.h tomoyo: constify assorted struct path * 2016-03-28 00:47:23 -04:00
condition.c VFS: security/: d_backing_inode() annotations 2015-04-15 15:06:56 -04:00
domain.c mm: replace get_user_pages_remote() write/force parameters with gup_flags 2016-10-19 08:12:02 -07:00
environ.c
file.c tomoyo: constify assorted struct path * 2016-03-28 00:47:23 -04:00
gc.c security: tomoyo: simplify the gc kthread creation 2016-06-06 20:23:55 +10:00
group.c
load_policy.c TOMOYO: fix __setup handlers return values 2022-04-20 09:06:35 +02:00
memory.c vfs: make the string hashes salt the hash 2016-06-10 20:21:46 -07:00
mount.c tomoyo: constify assorted struct path * 2016-03-28 00:47:23 -04:00
network.c
realpath.c fs: rename "rename2" i_op to "rename" 2016-09-27 11:03:58 +02:00
securityfs_if.c convert a bunch of open-coded instances of memdup_user_nul() 2016-01-04 10:26:58 -05:00
tomoyo.c constify security_sb_pivotroot() 2016-03-28 00:47:52 -04:00
util.c vfs: make the string hashes salt the hash 2016-06-10 20:21:46 -07:00