git: 6155e17019f6 - main - rc.subr: svcj - send the stop signal from inside the service jail

From: Alexander Leidinger <netchild_at_FreeBSD.org>
Date: Sun, 30 Aug 2026 17:43:48 UTC
The branch main has been updated by netchild:

URL: https://cgit.FreeBSD.org/src/commit/?id=6155e17019f6ae08c74913b7ffb9312434f33a9f

commit 6155e17019f6ae08c74913b7ffb9312434f33a9f
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-08-30 09:44:54 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2026-08-30 17:42:41 +0000

    rc.subr: svcj - send the stop signal from inside the service jail
    
    A service running under ${name}_user was signalled from the host as that
    user, which the parent of a jail may no longer do: since 8a5ceebece03 an
    unprivileged process would need allow.unprivileged_parent_tampering.
    Stop and reload therefore failed and left both the service and its jail
    running.
    
    MFC after:      1 week
    MFC to:         stable/15
---
 libexec/rc/rc.subr | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 9b08232e554a..061611709628 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1842,6 +1842,9 @@ _run_rc_killcmd()
 	if [ -n "$_user" ]; then
 		_cmd="su -m ${_user} -c 'sh -c \"${_cmd}\"'"
 	fi
+	if checkyesno ${name}_svcj && [ "${_rc_svcj}" != jailing ]; then
+	    _cmd="/usr/sbin/jexec svcj-${name} ${_cmd}"
+	fi
 	echo "$_cmd"
 }