NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/45421: kernel should log and inform user when it uses SIGKILL because of RLIMIT_CPU
>Number: 45421
>Category: kern
>Synopsis: kernel should log and inform user when it uses SIGKILL because
>of RLIMIT_CPU
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 04 18:40:00 +0000 2011
>Originator: Greg A. Woods
>Release: NetBSD-current 2011/10/04
>Organization:
Planix, Inc.; Kelowna, BC; Canada
>Environment:
System: NetBSD
Architecture: all
Machine: all
>Description:
the kernel should log, and inform the user, when it uses SIGKILL
to terminate a process because it has exceeded RLIMIT_CPU.
also, fix a nearby errant use of printf() instead of log().
>How-To-Repeat:
try to make actual use of CPU limits without confusing and
angering users
>Fix:
Index: sys/kern/kern_synch.c
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/sys/kern/kern_synch.c,v
retrieving revision 1.291
diff -u -r1.291 kern_synch.c
--- sys/kern/kern_synch.c 27 Sep 2011 01:02:38 -0000 1.291
+++ sys/kern/kern_synch.c 4 Oct 2011 17:59:40 -0000
@@ -1250,9 +1250,11 @@
rlim = &p->p_rlimit[RLIMIT_CPU];
sig = 0;
if (__predict_false(runtm >= rlim->rlim_cur)) {
- if (runtm >= rlim->rlim_max)
+ if (runtm >= rlim->rlim_max) {
sig = SIGKILL;
- else {
+ log(LOG_ERR, "pid %d is killed: %s\n",
p->p_pid, "exceeded RLIMIT_CPU");
+ uprintf("sorry, pid %d, command %s, is killed:
%s\n", p->p_pid, p->p_comm, "exceeded RLIMIT_CPU");
+ } else {
sig = SIGXCPU;
if (rlim->rlim_cur < rlim->rlim_max)
rlim->rlim_cur += 5;
@@ -1262,7 +1264,7 @@
if (__predict_false(runtm < 0)) {
if (!backwards) {
backwards = true;
- printf("WARNING: negative runtime; "
+ log(LOG_WARNING, "WARNING: negative runtime; "
"monotonic clock has gone backwards\n");
}
} else if (__predict_false(sig)) {
Home |
Main Index |
Thread Index |
Old Index