[uClinux-dev] binfmt_flat.c and multiple processes with the same executable file
mathieu.avila at laposte.net
Tue Oct 4 02:42:37 EDT 2005
Hi Greg, and thank you for taking time to answer,
Greg Ungerer wrote:
> Hi Avila,
>> uClibc for PowerPC is using fork instead of vfork because :
>> /* Sigh. The vfork system call on powerpc
>> * seems to be completely broken. So just
>> * use fork instead */
>> Do you have any idea for this ?
> I don't know what the specific powerpc problem is with vfork.
I didn't found either.
>> I have forced it to use vfork, and it seems ok.
>> But when the 2nd process returns, unmmap crashes (nommu.c); it seems
>> some deallocations has already been done somewhere else. Or maybe it
>> has to be done in the arch-dependant code ? (i don't see things like
>> this for m68knommu)
> No, I wouldn't expect anything like that in architecture specific code.
> You may need to track the address given out at allocation time, and
> trace all de-allocations to see where it might be going wrong.
> For starters, does the munmap addresses match the addresses
> alloation during the mmap in binfmt_flat?
Ok, i have resolved this problem, and it is quite weird. Here's the
facts : I've come back to a 2.6.9 kernel (just before porting to 2.6.13,
because i can type on the serial console on 2.6.9, not on 2.6.13), and
in exit_mmap(struct mm_struct * mm)
and now it works !
All deallocations work fine, and i can check that the memory blocks
allocated are those previously allocated in a precedent execution. I get
no crash either.
This sounds very strange, as i can't see any error in
show_process_blocks. However, i see that the 2.6.9 and 2.6.13 versions
of nommu.c are quite different.
>> When i comment that code (exit_mmap), it runs ok (although it's not a
>> solution). However, i have read that after a vfork, the forking
>> program waits until the 2nd one makes a "exit" or "execve". When it
>> makes exit directly, the 1st program gets back (ok), but it still
>> blocks when the 2nd program makes a execve, even if it returns. Do
>> you have any idea ? Do i have to change it's running state, or read
>> its return code or something like this ? Shouldn't it be done
>> automatically by a signal sent to the parent process ?
> It should be automatic. I mean it is in common kernel code at least,
> so I wouldn't expect you have to do anything special for the powerpc
This problem has also disappeared in 2.6.9...
I can run any program correctly, without crash, nor memory leaks (at
If you have any idea or doubt, please tell me. I you think this is ok,
then i can clean the code so that it can be released.
More information about the uClinux-dev