[GIT] SELinux bugfix for current

From: James Morris
Date: Sun Feb 23 2014 - 22:33:56 EST


Please pull this fix for the SELinux code.

The following changes since commit cfbf8d4857c26a8a307fb7cd258074c9dcd8c691:

Linux 3.14-rc4 (2014-02-23 17:40:03 -0800)

are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git for-linus

Eric Paris (1):
SELinux: bigendian problems with filename trans rules

James Morris (1):
Merge branch 'stable-3.14' of git://git.infradead.org/users/pcmoore/selinux into for-linus


---

security/selinux/ss/policydb.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
commit e4e027ea2d7a59819a0384c2d1031aafc5833903
Merge: cfbf8d4 9085a64
Author: James Morris <james.l.morris@xxxxxxxxxx>
Date: Mon Feb 24 14:40:16 2014 +1100

Merge branch 'stable-3.14' of git://git.infradead.org/users/pcmoore/selinux into for-linus


commit 9085a6422900092886da8c404e1c5340c4ff1cbf
Author: Eric Paris <eparis@xxxxxxxxxx>
Date: Thu Feb 20 10:56:45 2014 -0500

SELinux: bigendian problems with filename trans rules

When writing policy via /sys/fs/selinux/policy I wrote the type and class
of filename trans rules in CPU endian instead of little endian. On
x86_64 this works just fine, but it means that on big endian arch's like
ppc64 and s390 userspace reads the policy and converts it from
le32_to_cpu. So the values are all screwed up. Write the values in le
format like it should have been to start.

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
Acked-by: Stephen Smalley <sds@xxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Paul Moore <pmoore@xxxxxxxxxx>

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index c0f4988..9c5cdc2 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -3338,10 +3338,10 @@ static int filename_write_helper(void *key, void *data, void *ptr)
if (rc)
return rc;

- buf[0] = ft->stype;
- buf[1] = ft->ttype;
- buf[2] = ft->tclass;
- buf[3] = otype->otype;
+ buf[0] = cpu_to_le32(ft->stype);
+ buf[1] = cpu_to_le32(ft->ttype);
+ buf[2] = cpu_to_le32(ft->tclass);
+ buf[3] = cpu_to_le32(otype->otype);

rc = put_entry(buf, sizeof(u32), 4, fp);
if (rc)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/