[PATCH] auxv: Restore backward compatibility

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 10 04:17:37 PST 2014


In commit 459828b6 I suddenly broke backward
compatibility of auxv vector on 32bit machines.
Bring it back.

Reported-by: Andrey Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-dump.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/cr-dump.c b/cr-dump.c
index 4ac77b6ff2a6..7b238088578e 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -377,7 +377,8 @@ static int check_sysvipc_map_dump(pid_t pid, VmaEntry *vma)
 
 static int get_task_auxv(pid_t pid, MmEntry *mm)
 {
-	int fd, ret;
+	auxv_t mm_saved_auxv[AT_VECTOR_SIZE];
+	int fd, i, ret;
 
 	pr_info("Obtaining task auvx ...\n");
 
@@ -385,13 +386,16 @@ static int get_task_auxv(pid_t pid, MmEntry *mm)
 	if (fd < 0)
 		return -1;
 
-	ret = read(fd, mm->mm_saved_auxv, pb_repeated_size(mm, mm_saved_auxv));
+	ret = read(fd, mm_saved_auxv, sizeof(mm_saved_auxv));
 	if (ret < 0) {
 		ret = -1;
 		pr_perror("Error reading %d's auxv", pid);
 		goto err;
-	} else
-		mm->n_mm_saved_auxv = ret / sizeof(mm->mm_saved_auxv[0]);
+	} else {
+		mm->n_mm_saved_auxv = ret / sizeof(auxv_t);
+		for (i = 0; i < mm->n_mm_saved_auxv; i++)
+			mm->mm_saved_auxv[i] = (u64)mm_saved_auxv[i];
+	}
 
 	ret = 0;
 err:
-- 
1.8.3.1


--jKBxcB1XkHIR0Eqt--


More information about the CRIU mailing list