Is fork() hook ever possible?

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Sep 17 09:24:09 UTC 2008


In message <20080917090101.GC57480 at nagual.pp.ru>, Andrey Chernov writes:
>On Wed, Sep 17, 2008 at 08:04:57AM +0000, Poul-Henning Kamp wrote:

>> >The situation is not so simple since the library functions can call 
>> >ar4random() internally (like mktemp() family already and always does)
>> 
>> I have a really hard time seeing how this could become a performance
>> issue, ever.
>
>The performance issue happens when application tries to call arc4random() 
>in the loop.

That is not what we are talking about, we are talking about the calls
in mktemp and similar.

>> The solution however, is simple: Just have these hidden library calls 
>> to arc4random call a wrapper function that does the pid check.
>
>We can control our own arc4random() internal calls inside our own libs in 
>such way but can't control 3rd party libs or programs arc4random() calls 
>(consider ports).

We are not obliged to control these calls.  If their authors do something
stupid, it's not our problem.

You are, as usual, trying to vastly overengineer a minor problem that
has a simple solution.

Just have the FreeBSD library calls, call the wrapper function that
does a pid check and be done with it.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-current mailing list