Page MenuHomeFreeBSD

libthr: wrap pdfork(2), same as fork(2).
ClosedPublic

Authored by kib on Sun, Jan 10, 10:27 PM.

Details

Summary

Without wrapping, rtld services and malloc(3) are not guaranteed to operate correctly in the child.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib requested review of this revision.Sun, Jan 10, 10:27 PM
kib created this revision.
markj added inline comments.
lib/libc/sys/Symbol.map
809

Why not add a _pdfork symbol?

pdfork sorts before pipe.

lib/libc/sys/pdfork.c
40

What's the purpose of this symbol? I note that __fork is not exported by libc.

lib/libthr/thread/thr_fork.c
216

We should just return -1 here I think.

This revision is now accepted and ready to land.Sun, Jan 10, 11:04 PM
kib marked 3 inline comments as done.Sun, Jan 10, 11:14 PM
kib added inline comments.
lib/libc/sys/Symbol.map
809

There is no need in _pdfork, libc does not use it.

Re-sorted.

lib/libc/sys/pdfork.c
40

This is forgotten line. I planned to use it in libthr but then realized that I do not need it.

lib/libthr/thread/thr_fork.c
216

We need to undo everything we did to prepare for fork. This is mostly theoretical, of course.

kib marked 3 inline comments as done.

Remove unused alias, sort symbols in map file.

This revision now requires review to proceed.Sun, Jan 10, 11:15 PM
This revision is now accepted and ready to land.Mon, Jan 11, 2:53 PM
This revision was automatically updated to reflect the committed changes.