From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: memory: define TASK_UNMAPPED_BASE in terms of TASK_SIZE
Date: Wed, 30 Jan 2013 14:08:32 +0000 [thread overview]
Message-ID: <1359554912-26872-2-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1359554912-26872-1-git-send-email-will.deacon@arm.com>
TASK_UNMAPPED_BASE is defined directly in terms of PAGE_OFFSET, which is
confusing given that the modules area sits between here and TASK_SIZE
and is not available for user allocations.
This patch defines TASK_UNMAPPED_BASE in terms of TASK_SIZE instead and
fixes a bug introduced by 394ef6403abc ("mm: use vm_unmapped_area() on
arm architecture") whereby TASK_UNMAPPED_BASE is no longer page-aligned
for bottom-up mmap, causing get_unmapped_area to choke on misaligned
addresses.
Reported-by: Christoffer Dall <cdall@cs.columbia.edu>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
arch/arm/include/asm/memory.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index a0fd518..255a01b 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -37,7 +37,7 @@
*/
#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
#define TASK_SIZE (UL(CONFIG_PAGE_OFFSET) - UL(SZ_16M))
-#define TASK_UNMAPPED_BASE (UL(CONFIG_PAGE_OFFSET) / 3)
+#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~UL(SZ_16M - 1))
/*
* The maximum size of a 26-bit user space task.
--
1.8.0
next prev parent reply other threads:[~2013-01-30 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 14:08 [PATCH 1/2] ARM: memory: use SZ_ constants for defining the virtual memory layout Will Deacon
2013-01-30 14:08 ` Will Deacon [this message]
2013-01-30 18:57 ` [PATCH 2/2] ARM: memory: define TASK_UNMAPPED_BASE in terms of TASK_SIZE Nicolas Pitre
2013-01-30 19:13 ` Will Deacon
2013-01-30 18:49 ` [PATCH 1/2] ARM: memory: use SZ_ constants for defining the virtual memory layout Nicolas Pitre
2013-01-30 20:41 ` Matt Sealey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1359554912-26872-2-git-send-email-will.deacon@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).