aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/ss/policydb.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2008-02-26 04:42:02 -0500
committerJames Morris <jmorris@namei.org>2008-04-18 06:26:05 -0400
commit454d972c24e6efce3d7b07a97f1ad18b14845de9 (patch)
tree05cd06c8389ca0cdc2f493d7fb680678a0691d27 /security/selinux/ss/policydb.c
parent98e9894650455426f67c2157db4f39bd14fac2f6 (diff)
SELinux: unify printk messages
Replace "security:" prefixes in printk messages with "SELinux" to help users identify the source of the messages. Also fix a couple of minor formatting issues. Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux/ss/policydb.c')
-rw-r--r--security/selinux/ss/policydb.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index bd7d6a00342d..325551cd7fc7 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -401,14 +401,14 @@ static int policydb_index_others(struct policydb *p)
401{ 401{
402 int i, rc = 0; 402 int i, rc = 0;
403 403
404 printk(KERN_DEBUG "security: %d users, %d roles, %d types, %d bools", 404 printk(KERN_DEBUG "SELinux: %d users, %d roles, %d types, %d bools",
405 p->p_users.nprim, p->p_roles.nprim, p->p_types.nprim, p->p_bools.nprim); 405 p->p_users.nprim, p->p_roles.nprim, p->p_types.nprim, p->p_bools.nprim);
406 if (selinux_mls_enabled) 406 if (selinux_mls_enabled)
407 printk(", %d sens, %d cats", p->p_levels.nprim, 407 printk(", %d sens, %d cats", p->p_levels.nprim,
408 p->p_cats.nprim); 408 p->p_cats.nprim);
409 printk("\n"); 409 printk("\n");
410 410
411 printk(KERN_DEBUG "security: %d classes, %d rules\n", 411 printk(KERN_DEBUG "SELinux: %d classes, %d rules\n",
412 p->p_classes.nprim, p->te_avtab.nel); 412 p->p_classes.nprim, p->te_avtab.nel);
413 413
414#ifdef DEBUG_HASHES 414#ifdef DEBUG_HASHES
@@ -702,20 +702,20 @@ int policydb_load_isids(struct policydb *p, struct sidtab *s)
702 702
703 rc = sidtab_init(s); 703 rc = sidtab_init(s);
704 if (rc) { 704 if (rc) {
705 printk(KERN_ERR "security: out of memory on SID table init\n"); 705 printk(KERN_ERR "SELinux: out of memory on SID table init\n");
706 goto out; 706 goto out;
707 } 707 }
708 708
709 head = p->ocontexts[OCON_ISID]; 709 head = p->ocontexts[OCON_ISID];
710 for (c = head; c; c = c->next) { 710 for (c = head; c; c = c->next) {
711 if (!c->context[0].user) { 711 if (!c->context[0].user) {
712 printk(KERN_ERR "security: SID %s was never " 712 printk(KERN_ERR "SELinux: SID %s was never "
713 "defined.\n", c->u.name); 713 "defined.\n", c->u.name);
714 rc = -EINVAL; 714 rc = -EINVAL;
715 goto out; 715 goto out;
716 } 716 }
717 if (sidtab_insert(s, c->sid[0], &c->context[0])) { 717 if (sidtab_insert(s, c->sid[0], &c->context[0])) {
718 printk(KERN_ERR "security: unable to load initial " 718 printk(KERN_ERR "SELinux: unable to load initial "
719 "SID %s.\n", c->u.name); 719 "SID %s.\n", c->u.name);
720 rc = -EINVAL; 720 rc = -EINVAL;
721 goto out; 721 goto out;
@@ -809,13 +809,13 @@ static int mls_read_range_helper(struct mls_range *r, void *fp)
809 809
810 items = le32_to_cpu(buf[0]); 810 items = le32_to_cpu(buf[0]);
811 if (items > ARRAY_SIZE(buf)) { 811 if (items > ARRAY_SIZE(buf)) {
812 printk(KERN_ERR "security: mls: range overflow\n"); 812 printk(KERN_ERR "SELinux: mls: range overflow\n");
813 rc = -EINVAL; 813 rc = -EINVAL;
814 goto out; 814 goto out;
815 } 815 }
816 rc = next_entry(buf, fp, sizeof(u32) * items); 816 rc = next_entry(buf, fp, sizeof(u32) * items);
817 if (rc < 0) { 817 if (rc < 0) {
818 printk(KERN_ERR "security: mls: truncated range\n"); 818 printk(KERN_ERR "SELinux: mls: truncated range\n");
819 goto out; 819 goto out;
820 } 820 }
821 r->level[0].sens = le32_to_cpu(buf[0]); 821 r->level[0].sens = le32_to_cpu(buf[0]);
@@ -826,21 +826,21 @@ static int mls_read_range_helper(struct mls_range *r, void *fp)
826 826
827 rc = ebitmap_read(&r->level[0].cat, fp); 827 rc = ebitmap_read(&r->level[0].cat, fp);
828 if (rc) { 828 if (rc) {
829 printk(KERN_ERR "security: mls: error reading low " 829 printk(KERN_ERR "SELinux: mls: error reading low "
830 "categories\n"); 830 "categories\n");
831 goto out; 831 goto out;
832 } 832 }
833 if (items > 1) { 833 if (items > 1) {
834 rc = ebitmap_read(&r->level[1].cat, fp); 834 rc = ebitmap_read(&r->level[1].cat, fp);
835 if (rc) { 835 if (rc) {
836 printk(KERN_ERR "security: mls: error reading high " 836 printk(KERN_ERR "SELinux: mls: error reading high "
837 "categories\n"); 837 "categories\n");
838 goto bad_high; 838 goto bad_high;
839 } 839 }
840 } else { 840 } else {
841 rc = ebitmap_cpy(&r->level[1].cat, &r->level[0].cat); 841 rc = ebitmap_cpy(&r->level[1].cat, &r->level[0].cat);
842 if (rc) { 842 if (rc) {
843 printk(KERN_ERR "security: mls: out of memory\n"); 843 printk(KERN_ERR "SELinux: mls: out of memory\n");
844 goto bad_high; 844 goto bad_high;
845 } 845 }
846 } 846 }
@@ -866,7 +866,7 @@ static int context_read_and_validate(struct context *c,
866 866
867 rc = next_entry(buf, fp, sizeof buf); 867 rc = next_entry(buf, fp, sizeof buf);
868 if (rc < 0) { 868 if (rc < 0) {
869 printk(KERN_ERR "security: context truncated\n"); 869 printk(KERN_ERR "SELinux: context truncated\n");
870 goto out; 870 goto out;
871 } 871 }
872 c->user = le32_to_cpu(buf[0]); 872 c->user = le32_to_cpu(buf[0]);
@@ -874,7 +874,7 @@ static int context_read_and_validate(struct context *c,
874 c->type = le32_to_cpu(buf[2]); 874 c->type = le32_to_cpu(buf[2]);
875 if (p->policyvers >= POLICYDB_VERSION_MLS) { 875 if (p->policyvers >= POLICYDB_VERSION_MLS) {
876 if (mls_read_range_helper(&c->range, fp)) { 876 if (mls_read_range_helper(&c->range, fp)) {
877 printk(KERN_ERR "security: error reading MLS range of " 877 printk(KERN_ERR "SELinux: error reading MLS range of "
878 "context\n"); 878 "context\n");
879 rc = -EINVAL; 879 rc = -EINVAL;
880 goto out; 880 goto out;
@@ -882,7 +882,7 @@ static int context_read_and_validate(struct context *c,
882 } 882 }
883 883
884 if (!policydb_context_isvalid(p, c)) { 884 if (!policydb_context_isvalid(p, c)) {
885 printk(KERN_ERR "security: invalid security context\n"); 885 printk(KERN_ERR "SELinux: invalid security context\n");
886 context_destroy(c); 886 context_destroy(c);
887 rc = -EINVAL; 887 rc = -EINVAL;
888 } 888 }
@@ -1128,7 +1128,7 @@ static int class_read(struct policydb *p, struct hashtab *h, void *fp)
1128 cladatum->comdatum = hashtab_search(p->p_commons.table, 1128 cladatum->comdatum = hashtab_search(p->p_commons.table,
1129 cladatum->comkey); 1129 cladatum->comkey);
1130 if (!cladatum->comdatum) { 1130 if (!cladatum->comdatum) {
1131 printk(KERN_ERR "security: unknown common %s\n", 1131 printk(KERN_ERR "SELinux: unknown common %s\n",
1132 cladatum->comkey); 1132 cladatum->comkey);
1133 rc = -EINVAL; 1133 rc = -EINVAL;
1134 goto bad; 1134 goto bad;
@@ -1283,13 +1283,13 @@ static int mls_read_level(struct mls_level *lp, void *fp)
1283 1283
1284 rc = next_entry(buf, fp, sizeof buf); 1284 rc = next_entry(buf, fp, sizeof buf);
1285 if (rc < 0) { 1285 if (rc < 0) {
1286 printk(KERN_ERR "security: mls: truncated level\n"); 1286 printk(KERN_ERR "SELinux: mls: truncated level\n");
1287 goto bad; 1287 goto bad;
1288 } 1288 }
1289 lp->sens = le32_to_cpu(buf[0]); 1289 lp->sens = le32_to_cpu(buf[0]);
1290 1290
1291 if (ebitmap_read(&lp->cat, fp)) { 1291 if (ebitmap_read(&lp->cat, fp)) {
1292 printk(KERN_ERR "security: mls: error reading level " 1292 printk(KERN_ERR "SELinux: mls: error reading level "
1293 "categories\n"); 1293 "categories\n");
1294 goto bad; 1294 goto bad;
1295 } 1295 }
@@ -1491,7 +1491,7 @@ int policydb_read(struct policydb *p, void *fp)
1491 goto bad; 1491 goto bad;
1492 1492
1493 if (le32_to_cpu(buf[0]) != POLICYDB_MAGIC) { 1493 if (le32_to_cpu(buf[0]) != POLICYDB_MAGIC) {
1494 printk(KERN_ERR "security: policydb magic number 0x%x does " 1494 printk(KERN_ERR "SELinux: policydb magic number 0x%x does "
1495 "not match expected magic number 0x%x\n", 1495 "not match expected magic number 0x%x\n",
1496 le32_to_cpu(buf[0]), POLICYDB_MAGIC); 1496 le32_to_cpu(buf[0]), POLICYDB_MAGIC);
1497 goto bad; 1497 goto bad;
@@ -1499,27 +1499,27 @@ int policydb_read(struct policydb *p, void *fp)
1499 1499
1500 len = le32_to_cpu(buf[1]); 1500 len = le32_to_cpu(buf[1]);
1501 if (len != strlen(POLICYDB_STRING)) { 1501 if (len != strlen(POLICYDB_STRING)) {
1502 printk(KERN_ERR "security: policydb string length %d does not " 1502 printk(KERN_ERR "SELinux: policydb string length %d does not "
1503 "match expected length %Zu\n", 1503 "match expected length %Zu\n",
1504 len, strlen(POLICYDB_STRING)); 1504 len, strlen(POLICYDB_STRING));
1505 goto bad; 1505 goto bad;
1506 } 1506 }
1507 policydb_str = kmalloc(len + 1,GFP_KERNEL); 1507 policydb_str = kmalloc(len + 1,GFP_KERNEL);
1508 if (!policydb_str) { 1508 if (!policydb_str) {
1509 printk(KERN_ERR "security: unable to allocate memory for policydb " 1509 printk(KERN_ERR "SELinux: unable to allocate memory for policydb "
1510 "string of length %d\n", len); 1510 "string of length %d\n", len);
1511 rc = -ENOMEM; 1511 rc = -ENOMEM;
1512 goto bad; 1512 goto bad;
1513 } 1513 }
1514 rc = next_entry(policydb_str, fp, len); 1514 rc = next_entry(policydb_str, fp, len);
1515 if (rc < 0) { 1515 if (rc < 0) {
1516 printk(KERN_ERR "security: truncated policydb string identifier\n"); 1516 printk(KERN_ERR "SELinux: truncated policydb string identifier\n");
1517 kfree(policydb_str); 1517 kfree(policydb_str);
1518 goto bad; 1518 goto bad;
1519 } 1519 }
1520 policydb_str[len] = 0; 1520 policydb_str[len] = 0;
1521 if (strcmp(policydb_str, POLICYDB_STRING)) { 1521 if (strcmp(policydb_str, POLICYDB_STRING)) {
1522 printk(KERN_ERR "security: policydb string %s does not match " 1522 printk(KERN_ERR "SELinux: policydb string %s does not match "
1523 "my string %s\n", policydb_str, POLICYDB_STRING); 1523 "my string %s\n", policydb_str, POLICYDB_STRING);
1524 kfree(policydb_str); 1524 kfree(policydb_str);
1525 goto bad; 1525 goto bad;
@@ -1536,7 +1536,7 @@ int policydb_read(struct policydb *p, void *fp)
1536 p->policyvers = le32_to_cpu(buf[0]); 1536 p->policyvers = le32_to_cpu(buf[0]);
1537 if (p->policyvers < POLICYDB_VERSION_MIN || 1537 if (p->policyvers < POLICYDB_VERSION_MIN ||
1538 p->policyvers > POLICYDB_VERSION_MAX) { 1538 p->policyvers > POLICYDB_VERSION_MAX) {
1539 printk(KERN_ERR "security: policydb version %d does not match " 1539 printk(KERN_ERR "SELinux: policydb version %d does not match "
1540 "my version range %d-%d\n", 1540 "my version range %d-%d\n",
1541 le32_to_cpu(buf[0]), POLICYDB_VERSION_MIN, POLICYDB_VERSION_MAX); 1541 le32_to_cpu(buf[0]), POLICYDB_VERSION_MIN, POLICYDB_VERSION_MAX);
1542 goto bad; 1542 goto bad;
@@ -1572,14 +1572,14 @@ int policydb_read(struct policydb *p, void *fp)
1572 1572
1573 info = policydb_lookup_compat(p->policyvers); 1573 info = policydb_lookup_compat(p->policyvers);
1574 if (!info) { 1574 if (!info) {
1575 printk(KERN_ERR "security: unable to find policy compat info " 1575 printk(KERN_ERR "SELinux: unable to find policy compat info "
1576 "for version %d\n", p->policyvers); 1576 "for version %d\n", p->policyvers);
1577 goto bad; 1577 goto bad;
1578 } 1578 }
1579 1579
1580 if (le32_to_cpu(buf[2]) != info->sym_num || 1580 if (le32_to_cpu(buf[2]) != info->sym_num ||
1581 le32_to_cpu(buf[3]) != info->ocon_num) { 1581 le32_to_cpu(buf[3]) != info->ocon_num) {
1582 printk(KERN_ERR "security: policydb table sizes (%d,%d) do " 1582 printk(KERN_ERR "SELinux: policydb table sizes (%d,%d) do "
1583 "not match mine (%d,%d)\n", le32_to_cpu(buf[2]), 1583 "not match mine (%d,%d)\n", le32_to_cpu(buf[2]),
1584 le32_to_cpu(buf[3]), 1584 le32_to_cpu(buf[3]),
1585 info->sym_num, info->ocon_num); 1585 info->sym_num, info->ocon_num);
@@ -1823,7 +1823,7 @@ int policydb_read(struct policydb *p, void *fp)
1823 for (genfs_p = NULL, genfs = p->genfs; genfs; 1823 for (genfs_p = NULL, genfs = p->genfs; genfs;
1824 genfs_p = genfs, genfs = genfs->next) { 1824 genfs_p = genfs, genfs = genfs->next) {
1825 if (strcmp(newgenfs->fstype, genfs->fstype) == 0) { 1825 if (strcmp(newgenfs->fstype, genfs->fstype) == 0) {
1826 printk(KERN_ERR "security: dup genfs " 1826 printk(KERN_ERR "SELinux: dup genfs "
1827 "fstype %s\n", newgenfs->fstype); 1827 "fstype %s\n", newgenfs->fstype);
1828 kfree(newgenfs->fstype); 1828 kfree(newgenfs->fstype);
1829 kfree(newgenfs); 1829 kfree(newgenfs);
@@ -1873,7 +1873,7 @@ int policydb_read(struct policydb *p, void *fp)
1873 if (!strcmp(newc->u.name, c->u.name) && 1873 if (!strcmp(newc->u.name, c->u.name) &&
1874 (!c->v.sclass || !newc->v.sclass || 1874 (!c->v.sclass || !newc->v.sclass ||
1875 newc->v.sclass == c->v.sclass)) { 1875 newc->v.sclass == c->v.sclass)) {
1876 printk(KERN_ERR "security: dup genfs " 1876 printk(KERN_ERR "SELinux: dup genfs "
1877 "entry (%s,%s)\n", 1877 "entry (%s,%s)\n",
1878 newgenfs->fstype, c->u.name); 1878 newgenfs->fstype, c->u.name);
1879 goto bad_newc; 1879 goto bad_newc;
@@ -1931,7 +1931,7 @@ int policydb_read(struct policydb *p, void *fp)
1931 if (rc) 1931 if (rc)
1932 goto bad; 1932 goto bad;
1933 if (!mls_range_isvalid(p, &rt->target_range)) { 1933 if (!mls_range_isvalid(p, &rt->target_range)) {
1934 printk(KERN_WARNING "security: rangetrans: invalid range\n"); 1934 printk(KERN_WARNING "SELinux: rangetrans: invalid range\n");
1935 goto bad; 1935 goto bad;
1936 } 1936 }
1937 lrt = rt; 1937 lrt = rt;