Skip to contentSkip to conversation

selinux: allow seek operations on the file exposing policy

PATCH New Eric Paris 1 participant 2 messages Feb 15, 2012 SELinux security module

lore
Share & tools
lore

Eric Paris

author
#0 lore raw

PATCH 1/2 selinux: allow seek operations on the file exposing policy

sesearch uses:
lseek(3, 0, SEEK_SET) = -1 ESPIPE (Illegal seek)

Make that work.

---

 security/selinux/selinuxfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
security/selinux/selinuxfs.c +1 -0
index c13a8e3..91e29cf 100644
@@ -496,6 +496,7 @@ static const struct file_operations sel_policy_ops = {
 	.read		= sel_read_policy,
 	.mmap		= sel_mmap_policy,
 	.release	= sel_release_policy,
+	.llseek		= generic_file_llseek,
 };
 
 static ssize_t sel_write_load(struct file *file, const char __user *buf,

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#1 lore raw

PATCH 2/2 selinux: loosen DAC perms on reading policy

There is no reason the DAC perms on reading the policy file need to be root only. There are selinux checks which should control this access.

---

 security/selinux/selinuxfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
security/selinux/selinuxfs.c +1 -1
index 91e29cf..9666f7b 100644
@@ -1829,7 +1829,7 @@ static int sel_fill_super(struct super_block *sb, void *data, int silent)
 		[SEL_REJECT_UNKNOWN] = {"reject_unknown", &sel_handle_unknown_ops, S_IRUGO},
 		[SEL_DENY_UNKNOWN] = {"deny_unknown", &sel_handle_unknown_ops, S_IRUGO},
 		[SEL_STATUS] = {"status", &sel_handle_status_ops, S_IRUGO},
-		[SEL_POLICY] = {"policy", &sel_policy_ops, S_IRUSR},
+		[SEL_POLICY] = {"policy", &sel_policy_ops, S_IRUGO},
 		/* last one */ {""}
 	};
 	ret = simple_fill_super(sb, SELINUX_MAGIC, selinux_files);

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.