Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 648943

Summary: cgroups: devices.allow does not accept multiple-line value
Product: Red Hat Enterprise Linux 6 Reporter: Jan Safranek <jsafrane>
Component: kernelAssignee: Tejun Heo <theo>
Status: CLOSED WONTFIX QA Contact: Cui Chun <ccui>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: arozansk, ccui, coughlan, czhang, dhaval.bugzilla, jmoyer, peterm, qcai, varekova
Target Milestone: rc   
Target Release: 6.5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-21 17:50:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782183, 840683, 960070    

Description Jan Safranek 2010-11-02 15:05:19 UTC
Description of problem:
When setting devices.allow or devices.deny parameter of 'devices' controller, it does not accept values with multiple lines.

Version-Release number of selected component (if applicable):
2.6.32-71.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. mount -t cgroup -o devices foo /cgroup/devices
2. mkdir /cgroup/devices/test
3. /bin/echo "a *:* w
c 8:* r" > /cgroup/devices/test/devices.allow
  
Actual results:
$ cat /cgroup/devices/test/devices.list
a *:* rwm

Expected results:
$ cat /cgroup/devices/test/devices.list
a *:* rwm
c 8:* r

Additional info:
/bin/echo is quite important, bash built-in echo writes one line per write() system call, which is correctly interpreted by the kernel.

In other words, this strace sequence works as expected:
open("/cgroup/devices/test/devices.allow", ...) = 3
write(3, "a *:* w\n", 8)                = 8
write(3, "c 8:* r\n", 8)                = 8

And this one does not work, kernel parses only the first line, i.e. until first '\n', and ignores the second line:
open("/cgroup/devices/test/devices.allow", ...) = 3
write(3, "a *:* w\nc 8:* r\n", 16)      = 16

The kernel should either process the whole input or the write() should return '8' as number of written characters, so application knows what is going on and can send next line (= next 8 characters).

Comment 2 RHEL Program Management 2011-01-07 04:22:41 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Suzanne Logcher 2011-01-07 16:16:15 UTC
This request was erroneously denied for the current release of Red Hat
Enterprise Linux.  The error has been fixed and this request has been
re-proposed for the current release.

Comment 4 RHEL Program Management 2011-02-01 05:53:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 5 RHEL Program Management 2011-02-01 18:50:40 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 6 RHEL Program Management 2011-04-04 02:26:57 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 7 RHEL Program Management 2011-10-07 15:16:51 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 12 RHEL Program Management 2013-04-12 02:23:35 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 13 Tejun Heo 2013-05-06 19:55:16 UTC
(Cc'ing Aristeu.)

I don't think this is a good idea. The interface only deals with single command at a time. It's not supposed to have convenience features for the admins writing directly to it. It's fundamentally limited - the max input size is PAGE_SIZE and it can't handle split writes. The kernel interface files really aren't meant to be flexible and intelligent. In fact, I have no idea why it just isn't using sscanf(). Aristeu, why the manual parsing?

If something convenient is necessary, please implement a wrapper script which sanitizes input and feed the correctly formatted strings to the kernel. It can be done multiple times better and easier from userland.

Thanks.

Comment 14 Aristeu Rozanski 2013-05-06 20:13:36 UTC
Good question, I have no idea. Will ask Serge Hallyn.

Comment 15 Aristeu Rozanski 2013-05-06 20:21:56 UTC
About the multiline thing: it's not even a good interface because
- It could fail out of a wrong line and the user would have no idea which line
- Either the kernel keep the correct lines before it applied or it'll have to
  implement rollback of the ones already applied.
It'd be a huge amount of code to replace a simple bash readline loop.

Comment 16 Jeff Moyer 2013-05-21 17:50:30 UTC
Closing this bug--see comments 13 and 15 for justification.