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 596419 - capability check in pci_read_config() bypasses lsm/selinux
Summary: capability check in pci_read_config() bypasses lsm/selinux
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.0
Hardware: All
OS: Linux
high
medium
Target Milestone: beta
: 6.2
Assignee: Eric Paris
QA Contact: Boris Ranto
URL:
Whiteboard:
Depends On: 559709
Blocks: 562808 Rhel6KvmTier1 756082 758829
TreeView+ depends on / blocked
 
Reported: 2010-05-26 18:02 UTC by Chris Wright
Modified: 2013-01-09 22:37 UTC (History)
9 users (show)

Fixed In Version: kernel-2.6.32-241.el6
Doc Type: Bug Fix
Doc Text:
The cred argument has been included in the security_capable() function so that it can be used in a wider range of call sites.
Clone Of:
Environment:
Last Closed: 2012-06-20 07:33:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
security: add task, cred and audit flag arguments to security_capable() (2.94 KB, patch)
2011-02-09 23:11 UTC, Chris Wright
no flags Details | Diff
pci: use security_capable() when checking capablities during config space read (1.58 KB, patch)
2011-02-09 23:12 UTC, Chris Wright
no flags Details | Diff
security: add cred argument to security_capable() (2.69 KB, patch)
2011-02-10 01:40 UTC, Chris Wright
no flags Details | Diff
pci: use security_capable() when checking capablities during config space read (1.60 KB, patch)
2011-02-10 01:42 UTC, Chris Wright
no flags Details | Diff
pci: use security_capable() when checking capablities during config space read (2.19 KB, patch)
2011-02-15 01:29 UTC, Chris Wright
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0862 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise Linux 6 kernel security, bug fix and enhancement update 2012-06-20 12:55:00 UTC

Description Chris Wright 2010-05-26 18:02:51 UTC
The fix in bug 559709 changes how capabilities are checked in pci_read_config().
The new check does a raw capability comparison against the open file's credentials, and that bypasses lsm/selinux checking.  Restore the lsm/selinux checking (while maintaining the new check against filp->f_cred).

Comment 1 Don Dutile (Red Hat) 2010-07-13 17:49:08 UTC
Moved to rhel6.1 .

Awaiting upstream direction before changing rhel6 (again).

Comment 6 RHEL Program Management 2010-11-10 20:39:45 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux maintenance release. Product Management has 
requested further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed 
products. This request is not yet committed for inclusion in an Update release.

Comment 12 Chris Wright 2011-02-09 23:11:27 UTC
Created attachment 477924 [details]
security: add task, cred and audit flag arguments to security_capable()

Expand arguments of security_capable() to include all arguments that
will be passed through to the underlying ->capable() callback.  This
makes security_capable() usable in a wider range of call sites.

Comment 13 Chris Wright 2011-02-09 23:12:32 UTC
Created attachment 477925 [details]
pci: use security_capable() when checking capablities during config space read

Eric Paris noted that commit de139a3 ("pci: check caps from sysfs file
open to read device dependent config space") caused the capability check
to bypass security modules and potentially auditing.  Rectify this by
calling security_capable() when checking the open file's capabilities
for config space reads.

Comment 14 Chris Wright 2011-02-10 00:00:30 UTC
Those two patches don't compile together, but give the basic idea.

Comment 15 Chris Wright 2011-02-10 01:40:58 UTC
Created attachment 477941 [details]
security: add cred argument to security_capable()

Expand security_capable() to include cred, so that it can be usable in a
wider range of call sites.

Comment 16 Chris Wright 2011-02-10 01:42:08 UTC
Created attachment 477942 [details]
pci: use security_capable() when checking capablities during config space read

Eric Paris noted that commit de139a3 ("pci: check caps from sysfs file
open to read device dependent config space") caused the capability check
to bypass security modules and potentially auditing.  Rectify this by
calling security_capable() when checking the open file's capabilities
for config space reads.

Comment 17 Chris Wright 2011-02-10 06:13:55 UTC
Posted patches in Comment #15 and Comment #16 upstream

Comment 18 Chris Wright 2011-02-15 01:26:18 UTC
And patch in Comment #16 is buggy.

Comment 19 Chris Wright 2011-02-15 01:29:08 UTC
Created attachment 478746 [details]
pci: use security_capable() when checking capablities during config space read

This reintroduces commit 47970b1b which was subsequently reverted
as f00eaeea.  The original change was broken and caused X startup
failures and generally made privileged processes incapable of reading
device dependent config space.  The normal capable() interface returns
true on success, but the LSM interface returns 0 on success.  This thinko
is now fixed in this patch, and has been confirmed to work properly.
 
So, once again...Eric Paris noted that commit de139a3 ("pci: check caps
from sysfs file open to read device dependent config space") caused the
capability check to bypass security modules and potentially auditing.
Rectify this by calling security_capable() when checking the open file's
capabilities for config space reads.

Comment 22 Suzanne Logcher 2011-03-28 21:08:40 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains 
unresolved, it has been rejected as it is not proposed as an 
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 25 Suqin Huang 2011-12-14 02:52:01 UTC
Hi Chris, Eric,
Can you give some suggestion how to this bug.
Thanks
Suqin

Comment 26 Suqin Huang 2011-12-19 02:35:04 UTC
Eric will provide the bug description, ack this bug first.
suqin

Comment 27 Suqin Huang 2011-12-23 03:14:45 UTC
steps to test:
$ sudo sandbox cat /sys/bus/pci/devices/$DEVICE/config

should generate an avc denying sys_admin.

Comment 29 Eric Paris 2012-02-14 21:59:06 UTC
Patch posted for internal review

Comment 30 Aristeu Rozanski 2012-02-28 16:53:44 UTC
Patch(es) available on kernel-2.6.32-241.el6

Comment 35 Martin Prpič 2012-05-18 09:43:30 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The cred argument has been included in the security_capable() function so that it can be used in a wider range of call sites.

Comment 38 errata-xmlrpc 2012-06-20 07:33:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0862.html


Note You need to log in before you can comment on or make changes to this bug.