On Monday 02 March 2009 08:37:05 Michael Schnell wrote:
> Jamie Lokier wrote:
> >    - The child code must not return from the function which calls
> >      vfork; must not call longjmp and similar functions; must not
> >      call malloc and similar functions; must not call printf and
> >      other stdio functions;
>
> after *exec, of course calling those functions are allowed....

everything we're talking about is that magical gray area after vfork().  all 
other times are well defined and not terribly interesting.

> >    - Ironically, some implementations of exec functions which search a
> >      path call malloc, so may be unsafe.  So in portable code, only
> >      use execve or execv, and do path searching yourself if
> >      required, without calling malloc.
>
> I do hope this is not the case with uCLinux ! I suppose the shell just
> does exec().

the kernel/shell is irrelevant.  uClibc (when built w/out MMU support) uses a 
dedicated mmap() area for building up of arguments.  this avoids memory 
leakage and calling into the memory allocator (which has locks to process), 
but this is not thread safe.  not that anyone has complained yet, but if you 
were creating threads and they were doing simultaneous vfork/exec (pretty much 
every variant except execve() will need dynamic memory), things will crash.
-mike
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to