diff options
author | Passion,Zhao <passion.zhao@intel.com> | 2013-06-02 23:42:24 -0400 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2013-06-03 13:56:02 -0400 |
commit | 0fcfee61d63b82c1eefb5b1a914240480f17d63f (patch) | |
tree | a61ecc9d44a9ff5501e833253011d443d2a2d011 /security/smack | |
parent | 8cd77a0bd4b4a7d02c2a6926a69585d8088ee721 (diff) |
Smack: Fix the bug smackcipso can't set CIPSO correctly
Bug report: https://tizendev.org/bugs/browse/TDIS-3891
The reason is userspace libsmack only use "smackfs/cipso2" long-label interface,
but the code's logical is still for orginal fixed length label. Now update
smack_cipso_apply() to support flexible label (<=256 including tailing '\0')
There is also a bug in kernel/security/smack/smackfs.c:
When smk_set_cipso() parsing the CIPSO setting from userspace, the offset of
CIPSO level should be "strlen(label)+1" instead of "strlen(label)"
Signed-off-by: Passion,Zhao <passion.zhao@intel.com>
Diffstat (limited to 'security/smack')
-rw-r--r-- | security/smack/smackfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3c79cba5fa4a..ab167037b2dd 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c | |||
@@ -881,7 +881,7 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf, | |||
881 | if (format == SMK_FIXED24_FMT) | 881 | if (format == SMK_FIXED24_FMT) |
882 | rule += SMK_LABELLEN; | 882 | rule += SMK_LABELLEN; |
883 | else | 883 | else |
884 | rule += strlen(skp->smk_known); | 884 | rule += strlen(skp->smk_known) + 1; |
885 | 885 | ||
886 | ret = sscanf(rule, "%d", &maplevel); | 886 | ret = sscanf(rule, "%d", &maplevel); |
887 | if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) | 887 | if (ret != 1 || maplevel > SMACK_CIPSO_MAXLEVEL) |