[master] 200f3060d jail: Move linux specific code from unix to linux jail
Nils Goroll
nils.goroll at uplex.de
Mon Aug 12 13:54:08 UTC 2024
commit 200f3060daa5bf93e0ca821fec140dce30aa3a02
Author: Thibaut Artis <thibaut.artis at varnish-software.com>
Date: Tue Jul 2 16:03:38 2024 +0200
jail: Move linux specific code from unix to linux jail
diff --git a/bin/varnishd/mgt/mgt_jail_linux.c b/bin/varnishd/mgt/mgt_jail_linux.c
index f6c2a515b..1b18cf15b 100644
--- a/bin/varnishd/mgt/mgt_jail_linux.c
+++ b/bin/varnishd/mgt/mgt_jail_linux.c
@@ -40,6 +40,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <sys/prctl.h>
#include <sys/stat.h>
#include "mgt/mgt.h"
@@ -55,6 +56,14 @@ static void vjl_master(enum jail_master_e jme) {
static void vjl_subproc(enum jail_subproc_e jse) {
jail_tech_unix.subproc(jse);
+ /*
+ * On linux mucking about with uid/gid disables core-dumps,
+ * reenable them again.
+ */
+ if (prctl(PR_SET_DUMPABLE, 1) != 0) {
+ MGT_Complain(C_INFO,
+ "Could not set dumpable bit. Core dumps turned off");
+ }
}
static int vjl_make_subdir(const char *dname, const char *what, struct vsb *vsb) {
diff --git a/bin/varnishd/mgt/mgt_jail_unix.c b/bin/varnishd/mgt/mgt_jail_unix.c
index ecb51ffac..c6cab790a 100644
--- a/bin/varnishd/mgt/mgt_jail_unix.c
+++ b/bin/varnishd/mgt/mgt_jail_unix.c
@@ -44,10 +44,6 @@
#include "mgt/mgt.h"
#include "common/heritage.h"
-#ifdef __linux__
-#include <sys/prctl.h>
-#endif
-
static gid_t vju_mgt_gid;
static uid_t vju_uid;
static gid_t vju_gid;
@@ -229,17 +225,6 @@ vju_subproc(enum jail_subproc_e jse)
} else {
AZ(setuid(vju_uid));
}
-
-#ifdef __linux__
- /*
- * On linux mucking about with uid/gid disables core-dumps,
- * reenable them again.
- */
- if (prctl(PR_SET_DUMPABLE, 1) != 0) {
- MGT_Complain(C_INFO,
- "Could not set dumpable bit. Core dumps turned off");
- }
-#endif
}
static int v_matchproto_(jail_make_dir_f)
More information about the varnish-commit
mailing list