[CRIU] [PATCHv2] files-reg: fix /proc/<pid>/* ownership for linkat restore
Dmitry Safonov
dsafonov at odin.com
Thu Dec 17 05:21:46 PST 2015
After linkat_hard with setfsuid permissions of files in
/proc/<pid>/* changes to root because of pid_getattr @ fs/proc/base.c
will fail to check has_pid_permissions() in ptrace_may_access()
Fix it with PR_SET_DUMPABLE.
Cc: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at odin.com>
---
files-reg.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/files-reg.c b/files-reg.c
index 425dc04..bce9cae 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -6,6 +6,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/prctl.h>
#include <sys/vfs.h>
#include <ctype.h>
@@ -1100,6 +1101,8 @@ static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t owner
*/
}
errno = errno_save;
+ if (prctl(PR_SET_DUMPABLE, 1, 0))
+ pr_perror("Cant set the dumpable flag");
return ret;
}
--
2.6.3
More information about the CRIU
mailing list