* [hugepage] Check for brk() entering a hugepage region
@ 2006-11-14 4:03 'David Gibson'
2006-11-14 15:27 ` Adam Litke
2006-11-14 23:16 ` Bill Irwin
0 siblings, 2 replies; 3+ messages in thread
From: 'David Gibson' @ 2006-11-14 4:03 UTC (permalink / raw)
To: Hugh Dickins
Cc: Adam Litke, Chen, Kenneth W, 'Christoph Lameter',
'Andrew Morton',
bill.irwin, linux-mm
Andrew, please apply. I could have sworn I checked ages ago, and
thought that sys_brk() eventually called do_mmap_pgoff() which would
do the necessary checks. Can't find any evidence of such a change
though, so either I was just blind at the time, or it happened before
the changeover to git.
Unlike mmap(), the codepath for brk() creates a vma without first
checking that it doesn't touch a region exclusively reserved for
hugepages. On powerpc, this can allow it to create a normal page vma
in a hugepage region, causing oopses and other badness.
This patch adds a test to prevent this. With this patch, brk() will
simply fail if it attempts to move the break into a hugepage reserved
region.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: working-2.6/mm/mmap.c
===================================================================
--- working-2.6.orig/mm/mmap.c 2006-11-14 14:03:53.000000000 +1100
+++ working-2.6/mm/mmap.c 2006-11-14 14:05:25.000000000 +1100
@@ -1880,6 +1880,10 @@ unsigned long do_brk(unsigned long addr,
if ((addr + len) > TASK_SIZE || (addr + len) < addr)
return -EINVAL;
+ error = is_hugepage_only_range(current->mm, addr, len);
+ if (error)
+ return error;
+
flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
error = arch_mmap_check(addr, len, flags);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [hugepage] Check for brk() entering a hugepage region
2006-11-14 4:03 [hugepage] Check for brk() entering a hugepage region 'David Gibson'
@ 2006-11-14 15:27 ` Adam Litke
2006-11-14 23:16 ` Bill Irwin
1 sibling, 0 replies; 3+ messages in thread
From: Adam Litke @ 2006-11-14 15:27 UTC (permalink / raw)
To: 'David Gibson'
Cc: Hugh Dickins, Chen, Kenneth W, 'Christoph Lameter',
'Andrew Morton',
bill.irwin, linux-mm
On Tue, 2006-11-14 at 15:03 +1100, 'David Gibson' wrote:
> Andrew, please apply. I could have sworn I checked ages ago, and
> thought that sys_brk() eventually called do_mmap_pgoff() which would
> do the necessary checks. Can't find any evidence of such a change
> though, so either I was just blind at the time, or it happened before
> the changeover to git.
>
> Unlike mmap(), the codepath for brk() creates a vma without first
> checking that it doesn't touch a region exclusively reserved for
> hugepages. On powerpc, this can allow it to create a normal page vma
> in a hugepage region, causing oopses and other badness.
>
> This patch adds a test to prevent this. With this patch, brk() will
> simply fail if it attempts to move the break into a hugepage reserved
> region.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Adam Litke <agl@us.ibm.com>
--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [hugepage] Check for brk() entering a hugepage region
2006-11-14 4:03 [hugepage] Check for brk() entering a hugepage region 'David Gibson'
2006-11-14 15:27 ` Adam Litke
@ 2006-11-14 23:16 ` Bill Irwin
1 sibling, 0 replies; 3+ messages in thread
From: Bill Irwin @ 2006-11-14 23:16 UTC (permalink / raw)
To: 'David Gibson'
Cc: Hugh Dickins, Adam Litke, Chen, Kenneth W,
'Christoph Lameter', 'Andrew Morton',
bill.irwin, linux-mm
On Tue, Nov 14, 2006 at 03:03:39PM +1100, 'David Gibson' wrote:
> Andrew, please apply. I could have sworn I checked ages ago, and
> thought that sys_brk() eventually called do_mmap_pgoff() which would
> do the necessary checks. Can't find any evidence of such a change
> though, so either I was just blind at the time, or it happened before
> the changeover to git.
> Unlike mmap(), the codepath for brk() creates a vma without first
> checking that it doesn't touch a region exclusively reserved for
> hugepages. On powerpc, this can allow it to create a normal page vma
> in a hugepage region, causing oopses and other badness.
> This patch adds a test to prevent this. With this patch, brk() will
> simply fail if it attempts to move the break into a hugepage reserved
> region.
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: William Irwin <wli@holomorphy.com>
-- wli
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-11-14 23:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 4:03 [hugepage] Check for brk() entering a hugepage region 'David Gibson'
2006-11-14 15:27 ` Adam Litke
2006-11-14 23:16 ` Bill Irwin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox