HomeFreeBSD

kern_kthread: fork1() does not handle locked Giant

Description

kern_kthread: fork1() does not handle locked Giant

fork1() does not behave if called under Giant. For instance, it might
need to call thread_suspend_check() which explicitly verifies that Giant
is not locked. On the other hand, the kthread KPI is often called from
SYSINIT() which is still Giant-locked.

Correct this by dropping Giant in kthread_add() and kproc_create().

Reported by: pho
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D41694

Details

Provenance
kibAuthored on Sep 2 2023, 7:16 AM
Reviewer
jhb
Differential Revision
D41694: kern_kthread: fork1() does not handle locked Giant
Parents
rGea70866bb15d: kern_kthread.c: some style
Branches
Unknown
Tags
Unknown