Bug 502088 - logging files do not get closed on exec
logging files do not get closed on exec
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: python-virtinst (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: F11VirtTarget
  Show dependency treegraph
 
Reported: 2009-05-21 15:32 EDT by Eric Paris
Modified: 2011-03-28 14:35 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-03-28 14:35:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Eric Paris 2009-05-21 15:32:52 EDT
as root but in running in the selinux context sysadm_t run virt-clone and you will get a couple denials.  The problem is that virt-clone calls out to other programs (like ifconfig) but has not set the virt-clone.log file to be close on exec.  Since ifconfig doesn't (when confined by selinux) has permissions to append to this log file we get the denials.  Mostly likely you need something like below right after you open the log file:

fcntl.fcntl(fd,  fcntl.F_SETFD, fcntl.FD_CLOEXEC)
(or make sure you pass the O_CLOEXEC flag when you open it...)
Comment 1 Daniel Berrange 2009-05-22 05:48:51 EDT
While I agree that we should be setting FD_CLOEXEC, more important is that we should not be spawning external programs like 'ifconfig' at all. This is a historical hack to workaround lack of suitable APIs in libvirt, but we addressed this problem several releases ago now. The call to ifconfig can be replaced by libvirt API calls to node device APIs to enumerate host network interfaces & their mac addresses.
Comment 2 Bug Zapper 2009-06-09 12:17:13 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 3 Bug Zapper 2010-04-27 10:26:57 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 4 Bug Zapper 2010-06-28 08:38:47 EDT
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 5 Cole Robinson 2010-10-14 12:21:14 EDT
Since we just use the standard python 'logging' module, I think we would need support there to enable close-on-exec. Reassigning to python
Comment 6 Dave Malcolm 2010-10-14 15:38:07 EDT
Can you provide a link to the code that you're using?  In particular, how have you configured "logging" - which handlers are you using.

I notice that "man fopen" has this non-standard mode character:
 "e"(since glibc 2.7)
  Open the file with the O_CLOEXEC flag.  See open(2) for more information.

logging.FileHandler passes on the given mode string to the "open" builtin function when opening the file; _PyFile_SanitizeMode does some checking of this

So could this be solved by adding "e" to the end of the mode string in your logging configuration?
Comment 7 Dave Malcolm 2010-10-14 15:42:46 EDT
Note to self: see also this patch from danpb
  http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00867.html
Comment 8 Cole Robinson 2010-10-14 15:51:23 EDT
Ah, I did not know that mode was passed through to fopen. Thanks for the quick response, I'll assign this back to virtinst and whip up a patch soon.
Comment 9 Bug Zapper 2010-11-04 07:13:14 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 10 Cole Robinson 2010-11-17 13:57:34 EST
Still present, reassigning to rawhide.
Comment 11 Cole Robinson 2010-11-17 16:05:55 EST
Fixed upstream:

http://hg.fedorahosted.org/hg/python-virtinst/rev/e07b707b1d94
Comment 12 Cole Robinson 2011-03-28 14:35:10 EDT
This should be in latest rawhide.

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