[CRIU] [PATCH 03/11] parasite-vdso: Add ugly casts for arm32

Dmitry Safonov dima at arista.com
Wed May 22 21:18:17 MSK 2019


criu/pie/parasite-vdso.c: In function 'remap_rt_vdso':
criu/pie/parasite-vdso.c:144:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  if (sys_munmap((void *)vma_vdso->start, vma_entry_len(vma_vdso))) {
                 ^
criu/pie/parasite-vdso.c:154:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
  if (sys_munmap((void *)vma_vvar->start, vma_entry_len(vma_vvar))) {
                 ^
cc1: all warnings being treated as errors

Signed-off-by: Dmitry Safonov <dima at arista.com>
---
 criu/pie/parasite-vdso.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c
index dc73fb53e1ea..90e20f767c33 100644
--- a/criu/pie/parasite-vdso.c
+++ b/criu/pie/parasite-vdso.c
@@ -127,11 +127,17 @@ static int remap_rt_vdso(VmaEntry *vma_vdso, VmaEntry *vma_vvar,
 {
 	unsigned long rt_vvar_addr = vdso_rt_parked_at;
 	unsigned long rt_vdso_addr = vdso_rt_parked_at;
+	void *remap_addr;
 	int ret;
 
 	pr_info("Runtime vdso/vvar matches dumpee, remap inplace\n");
 
-	if (sys_munmap((void *)vma_vdso->start, vma_entry_len(vma_vdso))) {
+	/*
+	 * Ugly casts for 32bit platforms, which don't like uint64_t
+	 * cast to (void *)
+	 */
+	remap_addr = (void *)(uintptr_t)vma_vdso->start;
+	if (sys_munmap(remap_addr, vma_entry_len(vma_vdso))) {
 		pr_err("Failed to unmap dumpee vdso\n");
 		return -1;
 	}
@@ -141,7 +147,8 @@ static int remap_rt_vdso(VmaEntry *vma_vdso, VmaEntry *vma_vvar,
 				vma_vdso->start, sym_rt->vdso_size);
 	}
 
-	if (sys_munmap((void *)vma_vvar->start, vma_entry_len(vma_vvar))) {
+	remap_addr = (void *)(uintptr_t)vma_vvar->start;
+	if (sys_munmap(remap_addr, vma_entry_len(vma_vvar))) {
 		pr_err("Failed to unmap dumpee vvar\n");
 		return -1;
 	}
-- 
2.21.0



More information about the CRIU mailing list