[CRIU] Re: [PATCH 1/4] check: prctl -- Add PR_SET_MM_AUXV test
Cyrill Gorcunov
gorcunov at openvz.org
Thu Apr 5 07:46:48 EDT 2012
On Thu, Apr 05, 2012 at 03:43:45PM +0400, Cyrill Gorcunov wrote:
> The ability to set PR_SET_MM_AUXV is implemented
> in kernel as a separate PR_SET_MM extension, so
> we need to test if the kernel patch is applied
> on a running system.
Pavel, I'm really sorry, could you please apply the patch below
_before_ this patch, and the this patch on top.
It's just escaped my sending queue.
Cyrill
---
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Thu, 5 Apr 2012 15:25:08 +0400
Subject: [PATCH] check: Add prctl codes test
Add basic test for prctl PR_SET_MM opcodes support.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-check.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/cr-check.c b/cr-check.c
index 91177ec..de79e40 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -75,6 +75,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 +110,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