Bug 675758

Summary: Leak of /proc/mtrr file descriptor by pci_system_cleanup
Product: Red Hat Enterprise Linux 6 Reporter: Daniel Berrangé <berrange>
Component: libpciaccessAssignee: Dave Airlie <airlied>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 14:30:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Demo program for /proc/mtrr leak
none
Proposed patch to close /proc/mtrr none

Description Daniel Berrangé 2011-02-07 16:43:56 UTC
Created attachment 477455 [details]
Demo program for /proc/mtrr leak

Description of problem:

The pci_system_init() function opens the /proc/mtrr file and saves its file descriptor.  pci_system_cleanup() fails to close this file descriptor resulting in a leak of the FD.

Version-Release number of selected component (if applicable):
libpciaccess-0.10.9-2.el6

How reproducible:
Always

Steps to Reproduce:
1. Save attached demo to pcidemo.c
2. gcc -o pcidemo pcidemo.c -lpciaccess
3. valgrind --track-fds=yes ./pcidemo
  
Actual results:
==7197== FILE DESCRIPTORS: 4 open at exit.
==7197== Open file descriptor 3: /proc/mtrr
==7197==    at 0x5105FC0: __open_nocancel (syscall-template.S:82)
==7197==    by 0x4E302C3: pci_system_linux_sysfs_create (fcntl2.h:54)
==7197==    by 0x40062C: main (in /root/pcidemo)


Expected results:
No leaked FD for /proc/mtrr

Additional info:

Comment 1 Daniel Berrangé 2011-02-07 16:44:21 UTC
Created attachment 477456 [details]
Proposed patch to close /proc/mtrr

Comment 3 RHEL Program Management 2011-02-07 17:08:30 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 9 errata-xmlrpc 2011-05-19 14:30:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0806.html