Bug 502088 - logging files do not get closed on exec
Summary: logging files do not get closed on exec
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-virtinst
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: F11VirtTarget
TreeView+ depends on / blocked
 
Reported: 2009-05-21 19:32 UTC by Eric Paris
Modified: 2011-03-28 18:35 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-03-28 18:35:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Eric Paris 2009-05-21 19:32:52 UTC
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 Berrangé 2009-05-22 09:48:51 UTC
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 16:17:13 UTC
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 14:26:57 UTC
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 12:38:47 UTC
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 16:21:14 UTC
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 19:38:07 UTC
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 19:42:46 UTC
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 19:51:23 UTC
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 11:13:14 UTC
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 18:57:34 UTC
Still present, reassigning to rawhide.

Comment 11 Cole Robinson 2010-11-17 21:05:55 UTC
Fixed upstream:

http://hg.fedorahosted.org/hg/python-virtinst/rev/e07b707b1d94

Comment 12 Cole Robinson 2011-03-28 18:35:10 UTC
This should be in latest rawhide.


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