Page MenuHomeFreeBSD

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

Authored by kib on Jan 10 2021, 10:27 PM.
Referenced Files
F82227925: D28088.diff
Fri, Apr 26, 6:13 PM
Unknown Object (File)
Jan 9 2024, 9:39 AM
Unknown Object (File)
Dec 20 2023, 2:57 PM
Unknown Object (File)
Dec 20 2023, 2:24 AM
Unknown Object (File)
Dec 3 2023, 12:54 PM
Unknown Object (File)
Nov 11 2023, 1:44 AM
Unknown Object (File)
Nov 9 2023, 5:52 PM
Unknown Object (File)
Nov 7 2023, 12:30 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 Skipped
Unit
Tests Skipped

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.