freebsd-dev/tools
Konstantin Belousov 4690e20eed tools/uma/smrstress: fix kthread exit
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 in the other thread, which was the caller of kthread_add().

Fix it by adding kthread_exit() to the thread function.

Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35999
2022-07-31 00:40:12 +03:00
..
boot tools/boot: Fix universe.sh's ZFS exclusion test 2022-07-24 16:53:34 -06:00
bsdbox ncurses: only keep the version with widechar support 2021-01-05 14:01:32 +01:00
build check/delete-old: Fix /bin/rmail removal condition 2022-07-22 01:20:25 +03:00
bus_space
coccinelle
debugscripts since kld_deb.py was removed a while back, this script isn't useful 2020-08-11 22:33:56 +00:00
diag ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
ifnet
kerneldoc twa: Remove 2021-11-25 00:45:13 -07:00
LibraryReport
lua Move ifconfig SFP status functionality into libifconfig 2020-08-09 16:27:28 +00:00
pkgbase pkgbase: Fix a typo in a source code comment 2022-03-28 19:33:25 +02:00
regression Apply some style(9) to pthread tests 2022-03-31 21:37:57 -04:00
sched schedgraph.py: port to Python 3 2022-01-11 15:32:39 +02:00
test stress2: Update the exclude list 2022-07-17 09:16:03 +02:00
tools git-arc: Fix the -y option 2022-07-13 09:30:17 -04:00
uma/smrstress tools/uma/smrstress: fix kthread exit 2022-07-31 00:40:12 +03:00
install.sh
make_libdeps.sh
README
tinder.sh

$FreeBSD$

This directory tree contains tools used for the maintenance and
testing of FreeBSD.  There is no toplevel Makefile structure since
these tools are not meant to be built as part of the standard system,
though there may be individual Makefiles in some of the subdirs.

Please read the README files in the subdirs for further information.