git: e48af5f99566 - stable/15 - rc.subr: svcj - send the stop signal from inside the service jail

From: Alexander Leidinger <netchild_at_FreeBSD.org>
Date: Sun, 06 Sep 2026 10:01:19 UTC
The branch stable/15 has been updated by netchild:

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

commit e48af5f995662d6df7625e30704e46bc77e613d6
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-08-30 09:44:54 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2026-09-06 09:58:26 +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
    
    (cherry picked from commit 6155e17019f6ae08c74913b7ffb9312434f33a9f)
---
 libexec/rc/rc.subr | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 2a5e835d3ca6..8abadb2e99b2 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1832,6 +1832,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"
 }