By convention, kernel threads must call kthread_exit() instead of blindly returning from the thread function. We have some safety measure in fork_exit(), which checks for the P_KPROC p_flag and does kthread_exit() for kernel thread that forgot to do it itself. But this workaround only works for kernel threads belonging to the kernel process. If a kernel thread is attached to the normal process with live userspace, and does not call kthread_exit(), then the workaround is not activated, and for amd64 at least, the return from the thread function/fork_exit() results in the return to userspace with the copy of frame from the thread that did kthread_add(). Practically for smrstress, this destroys the user stack of the still active frame. Fix it by adding kthread_exit() to the thread function. Reported by: pho
Details
Details
- Reviewers
markj - Commits
- rG4690e20eed17: tools/uma/smrstress: fix kthread exit
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable