Re: Is fork() hook ever possible?



On Tue, Sep 16, 2008 at 03:38:16PM +0100, Bob Bishop wrote:
Hi,

On 16 Sep 2008, at 15:03, Andrey Chernov wrote:

I need some sort of fork() hook to detect that pid is changed to re-
stir
ar4random() after that (in the child), simple flag variable with
child's pid is needed.

Currently OpenBSD does almost that checking getpid() every time
arc4random() called, but it is very slow way to use getpid() syscall
repeatedly, about 12-15 times slower than just arc4random() without
getpid().

Any ideas?

How about something hacky using mmap()/minherit()?

Could you please provide working low cost example to detect that we are in
the child (pid changed or something else)? Calling getpid() as OpenBSD
does definitely is very high cost. :(

--
http://ache.pp.ru/
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Non-random PIDs
    ... new process ID's, in the way that OpenBSD does. ... I'm the child and my pid is 21116. ... I'm the parent and my pid is 21115. ...
    (RedHat)
  • Re: Is fork() hook ever possible?
    ... >> child's pid is needed. ... but it is very slow way to use getpid() syscall ... Could you please provide working low cost example to detect that we are in ... Calling getpidas OpenBSD ...
    (freebsd-current)
  • Re: Killing a process that takes too long
    ... You may instead use fork and exec; this lets you use the process-ID to ... kill 'INT', $pid; ... and it does not guarantee that the child ... So we need a way to kill several processes of the process group of the parent, ...
    (perl.beginners)
  • Re: SBCL just turned 1.0!
    ... Lisp implementation means either lazyness or technical incompetence ... "Return any available status information on child processed. ... (multiple-value-bind (pid status) ... ;; Terminate the child process. ...
    (comp.lang.lisp)
  • Re: OT: fork(): parent or child should run first?
    ... >>> called waitpid() on it? ... > it is actually prepared for the pid to be reclaimed. ... child did some work or slept before it exited. ... > active to an inactive array in the signal handler. ...
    (Linux-Kernel)