[PATCH] arm: align the allocated memory unconditionally

Aleksandr Kartashov aleksandr.kartashov.aptu.se at gmail.com
Tue Jan 29 13:30:11 EST 2013


Currently IPC SHM works in a strange way on ARM:
the syscall sys_shmat() requires the argument shmaddr
be SHMLBA-aligned (ARM has the macro __ARCH_FORCE_SHMLBA
unconditionally defined) but allocates memory that
isn't SHMLBA-aligned because the value of memory alignment
depends on presense of certain cache aliases. Such a behavior
makes IPC SHM C/R impossible since an SHM segment
may be not SHMLBA-aligned so it can't be guaranteed
to be restorable.

This patch makes file-mmapped memory be unsconditionaly
SHMLBA-aligned.
---
 arch/arm/mm/mmap.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 10062ce..eca577e3 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -65,8 +65,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
 	 * We only need to do colour alignment if either the I or D
 	 * caches alias.
 	 */
-	if (aliasing)
-		do_align = filp || (flags & MAP_SHARED);
+	do_align = filp || (flags & MAP_SHARED);
 
 	/*
 	 * We enforce the MAP_FIXED case.
-- 
1.7.2.5


--------------010804040404020700020908--


More information about the CRIU mailing list