Bug 531233

Summary: (SELinux) Crash if a callback is shared between two processes
Product: [Fedora] Fedora Reporter: Victor Stinner <victor.stinner>
Component: libffiAssignee: Anthony Green <green>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: aph, dmalcolm, extras-orphan, fweimer, green, ivazqueznet, james.antill, jonathansteffan, katzj, lkundrak, notting
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-12-04 03:40:01 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:
Attachments:
Description Flags
Short example reproducing the crash none

Description Victor Stinner 2009-10-27 12:44:54 UTC
Created attachment 366258 [details]
Short example reproducing the crash

The attached script crash Python. The callback is shared between the two processes, the child destroy the callback, and then the parent uses the callback (re-destroy the callback).

The crash is specific to SELinux, it doesn't crash on another OS without SELinux.

I have the bug on Fedora 12 Beta and Python 2.6.2.

I posted the bug to the libffi mailing list:
http://sourceware.org/ml/libffi-discuss/2009/msg00320.html

The bug should be fixed in libffi, but I opened a bug for your information, and to track the bug in Fedora.

Comment 1 Dave Malcolm 2009-10-27 16:15:47 UTC
Thanks for filing this bug.

Our python RPMs use the system libffi; reassigning component from "python" to "libffi".

Comment 2 Bug Zapper 2009-11-16 14:24:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle.
Changing version to '12'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Anthony Green 2010-01-28 16:24:01 UTC
Here's the mailing list discussion.

http://old.nabble.com/bug-in-libffi-with-selinux-and-a-fork-td26076869.html


I'm not sure I understand the proposed solution.  Could somebody dumb it down for me?  

Jakub wrote:
> perhaps
> closures.c should record the pid of the current process and if it notices a
> different pid, it should reinitialize all its global variables to make sure
> the file isn't shared nor the mappings. 

Are we talking about the following from closures.c?
 open_temp_exec_file_mutex
 execfd
 execsize
 open_temp_exec_file_opts_idx

Andrew - you suggested checking for the PID change when destroying the closure.  How would you do that?

Thanks!

Comment 4 Andrew Haley 2010-01-28 17:56:27 UTC
It would be nice simply to say that processes can only destroy callbacks they created themselves.  But this won't really work, since there is a common memory pool that's being used by both processes.

What we *really* need is to make the pages that contain the callbacks copy-on-write in the child process.

Without some sort of atfork() I'm not sure anything can be done about this.

Comment 5 Bug Zapper 2010-11-04 09:04:25 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 6 Bug Zapper 2010-12-04 03:40:01 UTC
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 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.