[CRIU] [PATCH] check: Add prctl codes test
Cyrill Gorcunov
gorcunov at openvz.org
Thu Apr 5 07:12:45 EDT 2012
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-check.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/cr-check.c b/cr-check.c
index 91177ec..de9ea5c 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -1,5 +1,9 @@
#include <unistd.h>
#include <sys/socket.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include "sockets.h"
#include "crtools.h"
#include "log.h"
@@ -75,6 +79,32 @@ static int check_kcmp(void)
return -1;
}
+static int check_prctl(void)
+{
+ unsigned int *tid_addr;
+ int ret;
+
+ ret = sys_prctl(PR_GET_TID_ADDR, (unsigned long)&tid_addr, 0, 0, 0);
+ if (ret) {
+ pr_msg("prctl: PR_GET_TID_ADDR is not supported\n");
+ return -1;
+ }
+
+ ret = sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_brk(0), 0, 0);
+ if (ret) {
+ pr_msg("prctl: PR_SET_MM is not supported\n");
+ return -1;
+ }
+
+ ret = sys_prctl(PR_SET_MM, PR_SET_MM_EXE_FILE, -1, 0, 0);
+ if (ret != -EBUSY) {
+ pr_msg("prctl: PR_SET_MM_EXE_FILE is not supported\n");
+ return -1;
+ }
+
+ return 0;
+}
+
int cr_check(void)
{
int ret = 0;
@@ -84,6 +114,7 @@ int cr_check(void)
ret |= check_ns_last_pid();
ret |= check_sock_peek_off();
ret |= check_kcmp();
+ ret |= check_prctl();
if (!ret)
pr_msg("Looks good.\n");
--
1.7.7.6
More information about the CRIU
mailing list