|
96 | 96 | #include "audit.h"
|
97 | 97 | #include "avc_ss.h"
|
98 | 98 |
|
99 |
| -#define SB_TYPE_FMT "%s%s%s" |
100 |
| -#define SB_SUBTYPE(sb) (sb->s_subtype && sb->s_subtype[0]) |
101 |
| -#define SB_TYPE_ARGS(sb) sb->s_type->name, SB_SUBTYPE(sb) ? "." : "", SB_SUBTYPE(sb) ? sb->s_subtype : "" |
102 |
| - |
103 | 99 | extern struct security_operations *security_ops;
|
104 | 100 |
|
105 | 101 | /* SECMARK reference count */
|
@@ -414,31 +410,31 @@ static int sb_finish_set_opts(struct super_block *sb)
|
414 | 410 | the first boot of the SELinux kernel before we have
|
415 | 411 | assigned xattr values to the filesystem. */
|
416 | 412 | if (!root_inode->i_op->getxattr) {
|
417 |
| - printk(KERN_WARNING "SELinux: (dev %s, type "SB_TYPE_FMT") has no " |
418 |
| - "xattr support\n", sb->s_id, SB_TYPE_ARGS(sb)); |
| 413 | + printk(KERN_WARNING "SELinux: (dev %s, type %s) has no " |
| 414 | + "xattr support\n", sb->s_id, sb->s_type->name); |
419 | 415 | rc = -EOPNOTSUPP;
|
420 | 416 | goto out;
|
421 | 417 | }
|
422 | 418 | rc = root_inode->i_op->getxattr(root, XATTR_NAME_SELINUX, NULL, 0);
|
423 | 419 | if (rc < 0 && rc != -ENODATA) {
|
424 | 420 | if (rc == -EOPNOTSUPP)
|
425 | 421 | printk(KERN_WARNING "SELinux: (dev %s, type "
|
426 |
| - SB_TYPE_FMT") has no security xattr handler\n", |
427 |
| - sb->s_id, SB_TYPE_ARGS(sb)); |
| 422 | + "%s) has no security xattr handler\n", |
| 423 | + sb->s_id, sb->s_type->name); |
428 | 424 | else
|
429 | 425 | printk(KERN_WARNING "SELinux: (dev %s, type "
|
430 |
| - SB_TYPE_FMT") getxattr errno %d\n", sb->s_id, |
431 |
| - SB_TYPE_ARGS(sb), -rc); |
| 426 | + "%s) getxattr errno %d\n", sb->s_id, |
| 427 | + sb->s_type->name, -rc); |
432 | 428 | goto out;
|
433 | 429 | }
|
434 | 430 | }
|
435 | 431 |
|
436 | 432 | if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors))
|
437 |
| - printk(KERN_ERR "SELinux: initialized (dev %s, type "SB_TYPE_FMT"), unknown behavior\n", |
438 |
| - sb->s_id, SB_TYPE_ARGS(sb)); |
| 433 | + printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", |
| 434 | + sb->s_id, sb->s_type->name); |
439 | 435 | else
|
440 |
| - printk(KERN_DEBUG "SELinux: initialized (dev %s, type "SB_TYPE_FMT"), %s\n", |
441 |
| - sb->s_id, SB_TYPE_ARGS(sb), |
| 436 | + printk(KERN_DEBUG "SELinux: initialized (dev %s, type %s), %s\n", |
| 437 | + sb->s_id, sb->s_type->name, |
442 | 438 | labeling_behaviors[sbsec->behavior-1]);
|
443 | 439 |
|
444 | 440 | sbsec->flags |= SE_SBINITIALIZED;
|
@@ -601,6 +597,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
|
601 | 597 | const struct cred *cred = current_cred();
|
602 | 598 | int rc = 0, i;
|
603 | 599 | struct superblock_security_struct *sbsec = sb->s_security;
|
| 600 | + const char *name = sb->s_type->name; |
604 | 601 | struct inode *inode = sbsec->sb->s_root->d_inode;
|
605 | 602 | struct inode_security_struct *root_isec = inode->i_security;
|
606 | 603 | u32 fscontext_sid = 0, context_sid = 0, rootcontext_sid = 0;
|
@@ -659,8 +656,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
|
659 | 656 | strlen(mount_options[i]), &sid);
|
660 | 657 | if (rc) {
|
661 | 658 | printk(KERN_WARNING "SELinux: security_context_to_sid"
|
662 |
| - "(%s) failed for (dev %s, type "SB_TYPE_FMT") errno=%d\n", |
663 |
| - mount_options[i], sb->s_id, SB_TYPE_ARGS(sb), rc); |
| 659 | + "(%s) failed for (dev %s, type %s) errno=%d\n", |
| 660 | + mount_options[i], sb->s_id, name, rc); |
664 | 661 | goto out;
|
665 | 662 | }
|
666 | 663 | switch (flags[i]) {
|
@@ -807,8 +804,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
|
807 | 804 | out_double_mount:
|
808 | 805 | rc = -EINVAL;
|
809 | 806 | printk(KERN_WARNING "SELinux: mount invalid. Same superblock, different "
|
810 |
| - "security settings for (dev %s, type "SB_TYPE_FMT")\n", sb->s_id, |
811 |
| - SB_TYPE_ARGS(sb)); |
| 807 | + "security settings for (dev %s, type %s)\n", sb->s_id, name); |
812 | 808 | goto out;
|
813 | 809 | }
|
814 | 810 |
|
@@ -2481,8 +2477,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data)
|
2481 | 2477 | rc = security_context_to_sid(mount_options[i], len, &sid);
|
2482 | 2478 | if (rc) {
|
2483 | 2479 | printk(KERN_WARNING "SELinux: security_context_to_sid"
|
2484 |
| - "(%s) failed for (dev %s, type "SB_TYPE_FMT") errno=%d\n", |
2485 |
| - mount_options[i], sb->s_id, SB_TYPE_ARGS(sb), rc); |
| 2480 | + "(%s) failed for (dev %s, type %s) errno=%d\n", |
| 2481 | + mount_options[i], sb->s_id, sb->s_type->name, rc); |
2486 | 2482 | goto out_free_opts;
|
2487 | 2483 | }
|
2488 | 2484 | rc = -EINVAL;
|
@@ -2520,8 +2516,8 @@ static int selinux_sb_remount(struct super_block *sb, void *data)
|
2520 | 2516 | return rc;
|
2521 | 2517 | out_bad_option:
|
2522 | 2518 | printk(KERN_WARNING "SELinux: unable to change security options "
|
2523 |
| - "during remount (dev %s, type "SB_TYPE_FMT")\n", sb->s_id, |
2524 |
| - SB_TYPE_ARGS(sb)); |
| 2519 | + "during remount (dev %s, type=%s)\n", sb->s_id, |
| 2520 | + sb->s_type->name); |
2525 | 2521 | goto out_free_opts;
|
2526 | 2522 | }
|
2527 | 2523 |
|
|
0 commit comments