[CRIU] [PATCH 4/6] parasite: Bind parasite data to own data section

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 14 08:41:59 EST 2012


To eliminate binding to .bss section (we don't have own
section loader, so that data variables must not be shrinked).

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/parasite.h |    1 +
 parasite.c         |   23 +++++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/parasite.h b/include/parasite.h
index 96b78c1..befcafd 100644
--- a/include/parasite.h
+++ b/include/parasite.h
@@ -10,6 +10,7 @@
 #include "image.h"
 
 #define __parasite_head		__used __section(.parasite.head.text)
+#define __parasite_data		__section(.parasite.data)
 
 #define PARASITE_STACK_SIZE	2048
 #define PARASITE_ARG_SIZE	8196
diff --git a/parasite.c b/parasite.c
index a77a94f..edda844 100644
--- a/parasite.c
+++ b/parasite.c
@@ -21,12 +21,17 @@
 
 #ifdef CONFIG_X86_64
 
-static void *brk_start, *brk_end, *brk_tail;
+static void __parasite_data *brk_start;
+static void __parasite_data *brk_end;
+static void __parasite_data *brk_tail;
 
-static struct page_entry page;
-static struct vma_entry vma;
-static int logfd = -1;
-static int tsock = -1;
+static struct page_entry __parasite_data page;
+static struct vma_entry __parasite_data vma;
+static int __parasite_data logfd = -1;
+static int __parasite_data tsock = -1;
+
+static unsigned char __parasite_data hex[] = "0123456789abcdef";
+static unsigned char __parasite_data hexbuf[32];
 
 static void brk_init(void *brk)
 {
@@ -58,11 +63,9 @@ static unsigned long builtin_strlen(char *str)
 	return len;
 }
 
-static const unsigned char hex[] = "0123456789abcdef";
-static char *long2hex(unsigned long v)
+static unsigned char *long2hex(unsigned long v)
 {
-	static char buf[32];
-	char *p = buf;
+	unsigned char *p = hexbuf;
 	int i;
 
 	for (i = sizeof(long) - 1; i >= 0; i--) {
@@ -71,7 +74,7 @@ static char *long2hex(unsigned long v)
 	}
 	*p = 0;
 
-	return buf;
+	return hexbuf;
 }
 
 static void sys_write_msg(const char *msg)
-- 
1.7.7.6



More information about the CRIU mailing list