Page MenuHomeFreeBSD

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

Authored by kib on Jan 10 2021, 10:27 PM.
Referenced Files
Unknown Object (File)
Oct 5 2024, 5:04 AM
Unknown Object (File)
Oct 4 2024, 8:09 PM
Unknown Object (File)
Oct 3 2024, 11:15 PM
Unknown Object (File)
Oct 3 2024, 9:55 PM
Unknown Object (File)
Oct 2 2024, 10:10 AM
Unknown Object (File)
Oct 1 2024, 3:02 AM
Unknown Object (File)
Sep 30 2024, 9:28 PM
Unknown Object (File)
Sep 22 2024, 10:08 PM
Subscribers
None

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

Why not add a _pdfork symbol?

pdfork sorts before pipe.

lib/libc/sys/pdfork.c
41

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

lib/libthr/thread/thr_fork.c
217

We should just return -1 here I think.

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

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

Re-sorted.

lib/libc/sys/pdfork.c
41

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
217

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.Jan 10 2021, 11:15 PM
This revision is now accepted and ready to land.Jan 11 2021, 2:53 PM
This revision was automatically updated to reflect the committed changes.