[CRIU] [PATCH 3/4] prctl: check -- Use kerndat_prctl_may_use_mm_map helper
Cyrill Gorcunov
gorcunov at openvz.org
Fri Oct 10 04:09:37 PDT 2014
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-check.c | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/cr-check.c b/cr-check.c
index cb3747b33dcf..f36463f74490 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -177,25 +177,27 @@ static int check_prctl(void)
return -1;
}
- ret = sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_brk(0), 0, 0);
- if (ret) {
- if (ret == -EPERM)
- pr_msg("prctl: One needs CAP_SYS_RESOURCE capability to perform testing\n");
- else
- pr_msg("prctl: PR_SET_MM is not supported\n");
- return -1;
- }
+ if (!(kerndat_prctl_may_use_mm_map())) {
+ ret = sys_prctl(PR_SET_MM, PR_SET_MM_BRK, sys_brk(0), 0, 0);
+ if (ret) {
+ if (ret == -EPERM)
+ pr_msg("prctl: One needs CAP_SYS_RESOURCE capability to perform testing\n");
+ else
+ 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 != -EBADF) {
- pr_msg("prctl: PR_SET_MM_EXE_FILE is not supported (%d)\n", ret);
- return -1;
- }
+ ret = sys_prctl(PR_SET_MM, PR_SET_MM_EXE_FILE, -1, 0, 0);
+ if (ret != -EBADF) {
+ pr_msg("prctl: PR_SET_MM_EXE_FILE is not supported (%d)\n", ret);
+ return -1;
+ }
- ret = sys_prctl(PR_SET_MM, PR_SET_MM_AUXV, (long)&user_auxv, sizeof(user_auxv), 0);
- if (ret) {
- pr_msg("prctl: PR_SET_MM_AUXV is not supported\n");
- return -1;
+ ret = sys_prctl(PR_SET_MM, PR_SET_MM_AUXV, (long)&user_auxv, sizeof(user_auxv), 0);
+ if (ret) {
+ pr_msg("prctl: PR_SET_MM_AUXV is not supported\n");
+ return -1;
+ }
}
return 0;
--
1.9.3
More information about the CRIU
mailing list