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)
Sat, Dec 7, 2:32 AM
Unknown Object (File)
Fri, Dec 6, 3:54 PM
Unknown Object (File)
Thu, Dec 5, 7:36 AM
Unknown Object (File)
Nov 19 2024, 2:43 AM
Unknown Object (File)
Nov 19 2024, 1:36 AM
Unknown Object (File)
Nov 19 2024, 1:35 AM
Unknown Object (File)
Nov 18 2024, 11:46 PM
Unknown Object (File)
Oct 5 2024, 5:04 AM
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.