bin/161401: have service(8) run scripts with the same resource limits as init(8)

Mathieu sigsys at gmail.com
Sat Oct 8 20:00:05 UTC 2011


>Number:         161401
>Category:       bin
>Synopsis:       have service(8) run scripts with the same resource limits as init(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 08 20:00:04 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Mathieu
>Release:        8.2-STABLE r225884M
>Organization:
>Environment:
>Description:
init(8) runs /etc/rc (and /etc/rc.shutdown) with the resource limits of the "daemon" class. But starting/restarting a service with service(8) will lose those limits and the service will inherit the limits of the user issuing the command.

This feature doesn't seem well documented, but still I think it would make sense for service to do the same thing as init.

>How-To-Repeat:

>Fix:
Index: usr.sbin/service/service.sh
===================================================================
--- usr.sbin/service/service.sh	(revision 225884)
+++ usr.sbin/service/service.sh	(working copy)
@@ -110,7 +110,7 @@
 for dir in /etc/rc.d $local_startup; do
 	if [ -x "$dir/$script" ]; then
 		[ -n "$VERBOSE" ] && echo "$script is located in $dir"
-		exec env -i HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $*
+		exec limits -C daemon -E HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin $dir/$script $*
 	fi
 done
 

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list