Skip to contentSkip to conversation

Minor issue with reading selinuxfs booleans.

DISCUSSION Eamon Walsh 3 participants 3 messages May 19, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

Recent versions of coreutils have bumped the read buffer size from 4K to 32K in several of the utilities.

This means that "cat /selinux/booleans/xserver_object_manager" no longer works, it returns "Invalid argument" on F11. getsebool works fine.

sel_read_bool has a check for "count > PAGE_SIZE" that doesn't seem to be present in the other read functions. Maybe it could be removed?

Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
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.
#1 lore raw
Quoted 8 lines · Eamon Walsh

Recent versions of coreutils have bumped the read buffer size from 4K to 32K in several of the utilities.

This means that "cat /selinux/booleans/xserver_object_manager" no longer works, it returns "Invalid argument" on F11. getsebool works fine.

sel_read_bool has a check for "count > PAGE_SIZE" that doesn't seem to be present in the other read functions. Maybe it could be removed?

Yes, that check is obsoleted by the conversion of those functions to using simple_read_from_buffer(), which will reduce count if necessary to what is available in the buffer.

---

 security/selinux/selinuxfs.c |    4 ----
 1 file changed, 4 deletions(-)
security/selinux/selinuxfs.c +0 -4
index 2d5136e..35b447b 100644
@@ -803,10 +803,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
 		goto out;
 	}
 
-	if (count > PAGE_SIZE) {
-		ret = -EINVAL;
-		goto out;
-	}
 	page = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!page) {
 		ret = -ENOMEM;
Signature · 8 lines
Stephen Smalley
National Security Agency


--
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.
#2 lore raw
Quoted 1 line · Stephen Smalley

Applied to
git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next

Quoted 26 lines

---

 security/selinux/selinuxfs.c |    4 ----
 1 file changed, 4 deletions(-)
security/selinux/selinuxfs.c +0 -4
index 2d5136e..35b447b 100644
@@ -803,10 +803,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
 		goto out;
 	}
 
-	if (count > PAGE_SIZE) {
-		ret = -EINVAL;
-		goto out;
-	}
 	page = (char *)get_zeroed_page(GFP_KERNEL);
 	if (!page) {
 		ret = -ENOMEM;
Signature · 3 lines
-- 
Stephen Smalley
National Security Agency
Signature · 7 lines
James Morris
<[email protected]>

--
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.