PERFORCE change 181469 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Wed Jul 28 08:21:39 UTC 2010
http://p4web.freebsd.org/@@181469?ac=10
Change 181469 by trasz at trasz_victim on 2010/07/26 17:24:54
Implement RUSAGE_CORE.
Affected files ...
.. //depot/projects/soc2009/trasz_limits/TODO#18 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#14 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#21 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_sig.c#15 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/TODO#18 (text+ko) ====
@@ -5,6 +5,7 @@
- maximum file size (RUSAGE_FSIZE), in megabytes
- number of processes (RUSAGE_NPROC)
- virtual memory usage (address space limit) (RUSAGE_VMEM), in megabytes
+ - maximum core size (RUSAGE_CORE), in megabytes (core, as in ELF program state dump)
Limits to do:
@@ -16,7 +17,6 @@
- swap usage (RUSAGE_SWAP), in megabytes
- number of file descriptors (RUSAGE_NOFILE)
- amount of memory consumed by socket buffers (RUSAGE_SBSIZE), in megabytes
- - maximum core size (RUSAGE_CORE), in megabytes (core, as in ELF program state dump)
Milestone 2:
==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#14 (text+ko) ====
@@ -35,6 +35,7 @@
#include "opt_core.h"
#include <sys/param.h>
+#include <sys/container.h>
#include <sys/exec.h>
#include <sys/hrl.h>
#include <sys/fcntl.h>
@@ -1103,6 +1104,12 @@
hdrsize = 0;
__elfN(puthdr)(td, (void *)NULL, &hdrsize, seginfo.count);
+#ifdef CONTAINERS
+ if (rusage_add(td->td_proc, RUSAGE_CORE, hdrsize + seginfo.size)) {
+ error = EFAULT;
+ goto done;
+ }
+#endif
if (hdrsize + seginfo.size >= limit) {
error = EFAULT;
goto done;
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#21 (text+ko) ====
@@ -62,6 +62,7 @@
switch (resource) {
case RUSAGE_CPU:
+ case RUSAGE_CORE:
return (0);
default:
return (1);
@@ -74,6 +75,7 @@
switch (resource) {
case RUSAGE_CPU:
+ case RUSAGE_CORE:
case RUSAGE_NPROC:
return (0);
default:
@@ -391,10 +393,8 @@
#ifdef HRL
if (diff > 0) {
error = hrl_enforce_proc(p, resource, diff);
- if (error) {
- mtx_unlock(&container_lock);
+ if (error)
return (error);
- }
}
#endif
container_alloc_resource(&p->p_container, resource, diff);
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_sig.c#15 (text+ko) ====
@@ -48,6 +48,7 @@
#include <sys/vnode.h>
#include <sys/acct.h>
#include <sys/condvar.h>
+#include <sys/container.h>
#include <sys/event.h>
#include <sys/fcntl.h>
#include <sys/imgact.h>
@@ -3209,7 +3210,12 @@
*/
limit = (off_t)lim_cur(p, RLIMIT_CORE);
PROC_UNLOCK(p);
+#ifdef CONTAINERS
+ if (limit == 0 && rusage_add(td->td_proc, RUSAGE_CORE, 1) == 0) {
+ rusage_sub(td->td_proc, RUSAGE_CORE, 1);
+#else
if (limit == 0) {
+#endif
#ifdef AUDIT
audit_proc_coredump(td, name, EFBIG);
#endif
More information about the p4-projects
mailing list