This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug in libffi with selinux and a fork


Le mardi 27 octobre 2009 13:42:45, Andrew Haley a écrit :
> > (...)
> > mmap2(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xc41000
> > mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0) = 0xb7c7d000
> 
> Hmmm, interesting.  This is going to be quite hard to fix.

Whould it be possible to just replace MAP_SHARED by MAP_PRIVATE? If not, you 
may add a reference counter (which may require a mutex).

> Why is the child process destroying the closure, anyway?

Why not? :-)

Note: I created a ticket in Fedora bug tracker,
      https://bugzilla.redhat.com/show_bug.cgi?id=531233

---

My problem is much bigger than the tiny example (and it took me some hours to 
isolate it!). My program registers a global callback for my library 
("Hasard"), and it replaces frequently the callback (especially, it removes 
the callback when it's done).

Pseudo-code :

 * Create a random number generator (register a callback)
 * Fork
 * Child: generate some numbers
 * Child: destroy the generator (unregister the callback)
 * Parent: reads the child number and wait child exit
 * Parent: generate some numbers
 * Parent: destroy the generator (unregister the callback)

It's a test to ensure that child and parent gets different numbers.

-- 
Victor Stinner
http://www.haypocalc.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]