Commit 1806f0f6 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: set the dumpable flag after setuid and setgid (v2)

setuid and setgid drops the dumpable flag, so it should be set back.
Otherwise proccesses will not able to read a few files in proc (e.g.
/proc/pid/pagemap).

This patch affects cow01:
11:50:04.429:     4: ERR: cow01.c:99: Unable to read data (errno = 13 (No such file or directory))

v2: typo fix
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 39e6d7f5
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h> #include <string.h>
#include <sys/prctl.h>
#include "zdtmtst.h" #include "zdtmtst.h"
#include "lock.h" #include "lock.h"
...@@ -130,6 +131,11 @@ void test_init(int argc, char **argv) ...@@ -130,6 +131,11 @@ void test_init(int argc, char **argv)
exit(1); exit(1);
} }
if (prctl(PR_SET_DUMPABLE, 1)) {
fprintf(stderr, "Can't set the dumpable flag");
exit(1);
}
if (sigaction(SIGTERM, &sa, NULL)) { if (sigaction(SIGTERM, &sa, NULL)) {
fprintf(stderr, "Can't set SIGTERM handler: %m\n"); fprintf(stderr, "Can't set SIGTERM handler: %m\n");
exit(1); exit(1);
......
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