projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
294a80a
)
VM/Security: add security hook to do_brk
author
Eric Paris
<
[email protected]
>
Wed, 5 Dec 2007 07:45:31 +0000
(23:45 -0800)
committer
Linus Torvalds
<
[email protected]
>
Wed, 5 Dec 2007 17:21:21 +0000
(09:21 -0800)
Given a specifically crafted binary do_brk() can be used to get low pages
available in userspace virtual memory and can thus be used to circumvent
the mmap_min_addr low memory protection. Add security checks in do_brk().
Signed-off-by: Eric Paris <
[email protected]
>
Acked-by: Alan Cox <
[email protected]
>
Cc: Stephen Smalley <
[email protected]
>
Cc: James Morris <
[email protected]
>
Cc: Chris Wright <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
mm/mmap.c
patch
|
blob
|
history
diff --git
a/mm/mmap.c
b/mm/mmap.c
index facc1a75bd4fdbc9f274dbc26a7e536f0eb8f561..acfc13f23ca04be0b6d4ae405d1b36b488b155ff 100644
(file)
--- a/
mm/mmap.c
+++ b/
mm/mmap.c
@@
-1934,6
+1934,10
@@
unsigned long do_brk(unsigned long addr, unsigned long len)
if (is_hugepage_only_range(mm, addr, len))
return -EINVAL;
+ error = security_file_mmap(0, 0, 0, 0, addr, 1);
+ if (error)
+ return error;
+
flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
error = arch_mmap_check(addr, len, flags);