RE: do_fork debugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > 
> > > Nir Livni (nirl@cyber-ark.com) wrote:
> > > > Hi all,
> > > > I would like to know where can I read about the do_fork 
> algorithm
> > > > (detailed explaination).
> > > > 
> > > > In addition , maybe you could tell me How do I debug 
> using UML the
> > > > initialization of a forked process. I would like to debug the 
> > > > initialization of a forked (CHILD) process from the 
> moment it is 
> > > > created, until the return of fork() which returns 0.
> > > 
> > > http://lxr.linux.no/source/kernel/fork.c#L577
> > > 
> > > hope this help.
> > > --
> > > Christophe Lucas -- Iomeda SA (clucas@iomeda.fr) 
> > 
> > I would still appreciate a bit more info.
> > Where is the code that initializes the child process ?
> > I have a problem that causes the child to exit immediately after I 
> > fork() it, So it exits before the fork() returns with 0.
> > (The parent receives a normal pid number return code, but 
> the child simply
> > isn't there anymore)
> 
> do_fork() make the initialisation by calling lot of 
> functions, the child return in ret_from_fork in arch/i386/entry.S
> 
> see 
> http://lxr.linux.no/source/arch/i386/kernel/process.c#L581 
> http://lxr.linux.no/source/arch/i386/kernel/entry.S#L186
> 

OK... This is getting a bit more complicated than I thought.
As I mentioned before, my problem is that a child process exists immediately
after its creation (I suppose it is created, because fork() returns well on
parent). 
If I run strace -f -ff on the parent process, the child DOES NOT exit, and
continues as planned.
I can also tell you that the parent creates few files before fork()ing the
child.

If I use O_CREAT | O_SYNC - the child DOES NOT exit.
If I use O_CREATE without sync - the child exists unexpectedly.

According to /proc/self/fd these files are already closed when fork()ing.

And I have no Idea where to begin...
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux