Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Smack: Restore the smackfsdef mount option and add missing prefixes

The 5.1 mount system rework changed the smackfsdef mount option to
smackfsdefault. This fixes the regression by making smackfsdef treated
the same way as smackfsdefault.

Also fix the smack_param_specs[] to have "smack" prefixes on all the
names. This isn't visible to a user unless they either:

(a) Try to mount a filesystem that's converted to the internal mount API
and that implements the ->parse_monolithic() context operation - and
only then if they call security_fs_context_parse_param() rather than
security_sb_eat_lsm_opts().

There are no examples of this upstream yet, but nfs will probably want
to do this for nfs2 or nfs3.

(b) Use fsconfig() to configure the filesystem - in which case
security_fs_context_parse_param() will be called.

This issue is that smack_sb_eat_lsm_opts() checks for the "smack" prefix
on the options, but smack_fs_context_parse_param() does not.

Fixes: c3300aaf95fb ("smack: get rid of match_token()")
Fixes: 2febd254adc4 ("smack: Implement filesystem context security hooks")
Cc: stable@vger.kernel.org
Reported-by: Jose Bollo <jose.bollo@iot.bzh>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Casey Schaufler and committed by
Linus Torvalds
6e7739fc 72a20cee

+7 -5
+7 -5
security/smack/smack_lsm.c
··· 68 68 int len; 69 69 int opt; 70 70 } smk_mount_opts[] = { 71 + {"smackfsdef", sizeof("smackfsdef") - 1, Opt_fsdefault}, 71 72 A(fsdefault), A(fsfloor), A(fshat), A(fsroot), A(fstransmute) 72 73 }; 73 74 #undef A ··· 683 682 } 684 683 685 684 static const struct fs_parameter_spec smack_param_specs[] = { 686 - fsparam_string("fsdefault", Opt_fsdefault), 687 - fsparam_string("fsfloor", Opt_fsfloor), 688 - fsparam_string("fshat", Opt_fshat), 689 - fsparam_string("fsroot", Opt_fsroot), 690 - fsparam_string("fstransmute", Opt_fstransmute), 685 + fsparam_string("smackfsdef", Opt_fsdefault), 686 + fsparam_string("smackfsdefault", Opt_fsdefault), 687 + fsparam_string("smackfsfloor", Opt_fsfloor), 688 + fsparam_string("smackfshat", Opt_fshat), 689 + fsparam_string("smackfsroot", Opt_fsroot), 690 + fsparam_string("smackfstransmute", Opt_fstransmute), 691 691 {} 692 692 }; 693 693