Skip to contentSkip to conversation

sparc64: Fix mapping of 64k pages with MAP_FIXED

PATCH Applied Nitin Gupta 2 participants 2 messages May 15, 2017 – May 17, 2017 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64: Fix mapping of 64k pages with MAP_FIXED

An incorrect huge page alignment check caused
mmap failure for 64K pages when MAP_FIXED is used
with address not aligned to HPAGE_SIZE.

Orabug: 25885991

---
 arch/sparc/include/asm/hugetlb.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/sparc/include/asm/hugetlb.h +4 -2
index dcbf985..d1f837d 100644
@@ -24,9 +24,11 @@ static inline int is_hugepage_only_range(struct mm_struct *mm,
 static inline int prepare_hugepage_range(struct file *file,
 			unsigned long addr, unsigned long len)
 {
-	if (len & ~HPAGE_MASK)
+	struct hstate *h = hstate_file(file);
+
+	if (len & ~huge_page_mask(h))
 		return -EINVAL;
-	if (addr & ~HPAGE_MASK)
+	if (addr & ~huge_page_mask(h))
 		return -EINVAL;
 	return 0;
 }
Signature · 1 line
2.9.2
maintainer Applied
#1 lore raw

From: Nitin Gupta <[email protected]>
Date: Mon, 15 May 2017 16:28:17 -0700

Quoted 7 lines

An incorrect huge page alignment check caused
mmap failure for 64K pages when MAP_FIXED is used
with address not aligned to HPAGE_SIZE.

Orabug: 25885991

Applied, but I had to add an appropriate "Fixes: " line, please do this in the future, like so on the line right before the first signoff or ack:

Fixes dcd1912d21a0 ("sparc64: Add 64K page size support")

Thanks.