lkml.org 
[lkml]   [1998]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: fork,clone,CLONE_VM prob.
On Fri, 4 Sep 1998, Richard Gooch wrote:

>Chris Wedgwood writes:
>> On Fri, Sep 04, 1998 at 01:29:55AM +0200, Konstantin Muenning wrote:
>>
>> > I have figured out that any combination of the clone-flags works
>> > except when using CLONE_VM. Even when using CLONE_VM, the call
>> > completes successful.
>>
>> I think when using CLONE_VM both processes return with the same stack
>> and bad things happen.
>
>Yep.

I'm not quite shure. I've spent some hours in browsing the kernel sources
(kernel/fork.c & arch/i386/kernel/process.c) to find out that when you
give NULL as new sp in the clone call (like my testprog does) the
sys_clone in process.c gives some value to the newsp. It runs always
without an error message or something that could give me a hint why the
child process dies. I have even tried to give some value as the new sp
(yes, there was some memory reserved behind that pointer but nothing
special) but the result was the same.

>> You need some assembly here to fix this up, I think libpthreads does
>> it this way.
>
>Yep.

I'm not afraid of assembler but I don't see where I'll need it.

If it's realy true that also the stack pointer is passed identical to the
child process so they use really the same physical memory it is clear that
one of the processes cannot run right. In that case I have to allocate a
new selector for the PL3 Stack (hmm, maybe for the PL0 stack too?),
probably in the LDT and maybe with some special attributes (what call can
do this and how to handle it, what attributes do I need?). Then to have
the return adress(es) and local variables right I'll have to copy the old
stack to the new location. So far I don't see the need for assembler. Hmm,
maybe for handling the selectors? Do I miss something? What calls are
there to do this? What flags should I use? ...?


Konstantin Münning ,,, uzs446@uni-bonn.de
-------------------------------/'^'\------------------------------------
www.muenning.com ( o o ) koko@muenning.com
--------------------------oOOO--(_)--OOOo-------------------------------
Ever notice that even the busiest people are never too busy to tell you
just how busy they are.
(-O-)
Measure with a micrometer. Mark with chalk. Cut with an axe.
(-O-)
Subtlety is the art of saying what you think and getting out of the way
before it is understood.
(-O-)
Don't take life too seriously -- you'll never get out of it alive.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.038 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site