From: Jones Syue
> Sent: 12 December 2023 01:49
> 
> > You aren't allowed to do very much between vfork() and exec().
> > Basically just sort out the child's fd table.
> > And I suspect that needs to only look at on-stack data.
> >
> > Having the child execute first is only an optimisation.
> > The child can fault on paged-out memory (even its stack) which
> > would allow the parent to run.
> 
> Yes. Definitely!  :)
> And per man page 'On some implementations, vfork() is equivalent to fork().'
> race conditions between parent and children is possible too,
> depends on implementation.
> https://linux.die.net/man/3/vfork
> https://man7.org/linux/man-pages/man2/vfork.2.html
> 
> A possible approach is: let crond parent prepare the DGRAM socket fd
> connecting to /dev/log, avoid been delayed connecting until the first
> message is logged by vfork() children.

I'd actually suggest using fork() - much safer.
While slightly slower no one is going to notice the difference
when cron is running programs.

        David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to