Commit 64b3e63b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Use setrlimit(2) to disable core dumps.

VTC's change because the exit-instead-of-abort-hack goes away.
parent d5c62621
......@@ -811,10 +811,7 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
VSB_cat(pan_vsb, "\n");
VSB_putc(pan_vsb, '\0'); /* NUL termination */
if (FEATURE(FEATURE_NO_COREDUMP))
exit(4);
else
abort();
abort();
}
/*--------------------------------------------------------------------*/
......
......@@ -43,6 +43,9 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "mgt.h"
......@@ -295,6 +298,7 @@ mgt_launch_child(struct cli *cli)
char *p;
struct vev *e;
int i, cp[2];
struct rlimit rl[1];
if (child_state != CH_STOPPED && child_state != CH_DIED)
return;
......@@ -335,6 +339,12 @@ mgt_launch_child(struct cli *cli)
}
if (pid == 0) {
if (MGT_FEATURE(FEATURE_NO_COREDUMP)) {
memset(rl, 0, sizeof *rl);
rl->rlim_cur = 0;
AZ(setrlimit(RLIMIT_CORE, rl));
}
/* Redirect stdin/out/err */
VFIL_null_fd(STDIN_FILENO);
assert(dup2(heritage.std_fd, STDOUT_FILENO) == STDOUT_FILENO);
......@@ -463,10 +473,7 @@ kill_child(void)
int i, error;
VJ_master(JAIL_MASTER_KILL);
if (MGT_FEATURE(FEATURE_NO_COREDUMP))
i = kill(child_pid, SIGKILL);
else
i = kill(child_pid, SIGQUIT);
i = kill(child_pid, SIGQUIT);
error = errno;
VJ_master(JAIL_MASTER_LOW);
errno = error;
......
......@@ -60,7 +60,7 @@ client c1 {
rxresp
} -run
varnish v1 -expectexit 0x20
varnish v1 -expectexit 0x40
####################
......@@ -91,4 +91,4 @@ varnish v2 -clijson "panic.show -j"
varnish v2 -cliok "panic.clear"
varnish v2 -expectexit 0x20
varnish v2 -expectexit 0x40
......@@ -80,4 +80,4 @@ client c1 {
expect resp.bodylen == 48
} -run
varnish v1 -expectexit 0x20
varnish v1 -expectexit 0x40
......@@ -5,6 +5,10 @@ server s1 {
txresp
} -start
varnish v1 -cliok "param.set feature +http2"
varnish v1 -cliok "param.set feature +no_coredump"
varnish v1 -cliok "param.set debug +syncvsl"
varnish v1 -vcl+backend {
import vtc;
......@@ -13,10 +17,6 @@ varnish v1 -vcl+backend {
}
} -start
varnish v1 -cliok "param.set feature +http2"
varnish v1 -cliok "param.set feature +no_coredump"
varnish v1 -cliok "param.set debug +syncvsl"
client c1 {
stream 1 {
txreq -hdr :authority foo.bar -pad cotton
......@@ -28,4 +28,4 @@ delay 2
varnish v1 -cliok "panic.clear"
varnish v1 -expectexit 0x20
varnish v1 -expectexit 0x40
......@@ -24,7 +24,10 @@ server s1 {
txresp -hdr "Foo: foo" -body "abcdef\n"
} -start
varnish v1 -arg "-sdefault,1m" -vcl+backend {
varnish v1 -arg "-sdefault,1m"
varnish v1 -cliok "param.set feature +no_coredump"
varnish v1 -vcl+backend {
import vtc;
import debug;
......@@ -49,7 +52,6 @@ varnish v1 -cliok "stop"
varnish v1 -cliok "start"
varnish v1 -wait-running
varnish v1 -expect MGT.child_panic == 0
varnish v1 -cliok "param.set feature +no_coredump"
client c1 {
txreq -url "/"
......@@ -92,4 +94,4 @@ client c1 {
} -run
varnish v1 -cliok "panic.clear -z"
varnish v1 -expectexit 0x20
varnish v1 -expectexit 0x40
......@@ -3,7 +3,7 @@ varnishtest "Create a backend after a COLD event"
server s1 -start
varnish v1 -cliok "param.set feature +no_coredump"
varnish v1 -expectexit 0x20
varnish v1 -expectexit 0x40
varnish v1 -vcl+backend {
import debug;
sub vcl_init {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment