Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8869477a49c3e99def1fcdadd6bbc407fea14b45
Commit:     8869477a49c3e99def1fcdadd6bbc407fea14b45
Parent:     ab5a91a8364c3d6fc617abc47cc81d162c01d90a
Author:     Eric Paris <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 18:47:26 2007 -0500
Committer:  James Morris <[EMAIL PROTECTED]>
CommitDate: Thu Dec 6 00:24:48 2007 +1100

    security: protect from stack expantion into low vm addresses
    
    Add security checks to make sure we are not attempting to expand the
    stack into memory protected by mmap_min_addr
    
    Signed-off-by: Eric Paris <[EMAIL PROTECTED]>
    Signed-off-by: James Morris <[EMAIL PROTECTED]>
---
 mm/mmap.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index facc1a7..938313c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1615,6 +1615,12 @@ static inline int expand_downwards(struct vm_area_struct 
*vma,
         */
        if (unlikely(anon_vma_prepare(vma)))
                return -ENOMEM;
+
+       address &= PAGE_MASK;
+       error = security_file_mmap(0, 0, 0, 0, address, 1);
+       if (error)
+               return error;
+
        anon_vma_lock(vma);
 
        /*
@@ -1622,8 +1628,6 @@ static inline int expand_downwards(struct vm_area_struct 
*vma,
         * is required to hold the mmap_sem in read mode.  We need the
         * anon_vma lock to serialize against concurrent expand_stacks.
         */
-       address &= PAGE_MASK;
-       error = 0;
 
        /* Somebody else might have raced and expanded it already */
        if (address < vma->vm_start) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to