[lxc-devel] [PATCH] define PR_SET_MM_MAP & friends if necessary

Tycho Andersen tycho.andersen at canonical.com
Fri Nov 6 20:50:33 UTC 2015


PR_SET_MM_MAP only went in to the kernel at 3.18 (or 3.19), so we need to
define these for kernels before then. If there was an error, the code
simply logs the failure and continues on.

Also, we can drop the PR_SET_MM_otherstuff contstants since those were
dropped in 93525c00c76b2804c46cf3c275d610ebe71cb4be.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/utils.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index d592243..d9e769d 100644
--- a/src/lxc/utils.c
+++ b/src/lxc/utils.c
@@ -51,20 +51,25 @@
 #define PR_SET_MM 35
 #endif
 
-#ifndef PR_SET_MM_ARG_START
-#define PR_SET_MM_ARG_START 8
-#endif
-
-#ifndef PR_SET_MM_ARG_END
-#define PR_SET_MM_ARG_END 9
-#endif
-
-#ifndef PR_SET_MM_ENV_START
-#define PR_SET_MM_ENV_START 10
-#endif
-
-#ifndef PR_SET_MM_ENV_END
-#define PR_SET_MM_ENV_END 11
+#ifndef PR_SET_MM_MAP
+#define PR_SET_MM_MAP 14
+
+struct prctl_mm_map {
+        uint64_t   start_code;
+        uint64_t   end_code;
+        uint64_t   start_data;
+        uint64_t   end_data;
+        uint64_t   start_brk;
+        uint64_t   brk;
+        uint64_t   start_stack;
+        uint64_t   arg_start;
+        uint64_t   arg_end;
+        uint64_t   env_start;
+        uint64_t   env_end;
+        uint64_t   *auxv;
+        uint32_t   auxv_size;
+        uint32_t   exe_fd;
+};              
 #endif
 
 #ifndef O_PATH
-- 
2.6.2



More information about the lxc-devel mailing list