aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-01-06 13:00:05 -0800
committerBen Hutchings <ben@decadent.org.uk>2015-02-20 00:49:34 +0000
commit78eaa11abd10111f9e58860cfbd4ce23c81acde2 (patch)
tree3770746f9d5ad1e6b238c5578d3f74fba6882ec2 /include
parenteba80b2fb2a31678efe568ad3aa9f6cc77025b7e (diff)
downloadkernel_samsung_smdk4412-78eaa11abd10111f9e58860cfbd4ce23c81acde2.zip
kernel_samsung_smdk4412-78eaa11abd10111f9e58860cfbd4ce23c81acde2.tar.gz
kernel_samsung_smdk4412-78eaa11abd10111f9e58860cfbd4ce23c81acde2.tar.bz2
mm: propagate error from stack expansion even for guard page
commit fee7e49d45149fba60156f5b59014f764d3e3728 upstream. Jay Foad reports that the address sanitizer test (asan) sometimes gets confused by a stack pointer that ends up being outside the stack vma that is reported by /proc/maps. This happens due to an interaction between RLIMIT_STACK and the guard page: when we do the guard page check, we ignore the potential error from the stack expansion, which effectively results in a missing guard page, since the expected stack expansion won't have been done. And since /proc/maps explicitly ignores the guard page (commit d7824370e263: "mm: fix up some user-visible effects of the stack guard page"), the stack pointer ends up being outside the reported stack area. This is the minimal patch: it just propagates the error. It also effectively makes the guard page part of the stack limit, which in turn measn that the actual real stack is one page less than the stack limit. Let's see if anybody notices. We could teach acct_stack_growth() to allow an extra page for a grow-up/grow-down stack in the rlimit test, but I don't want to add more complexity if it isn't needed. Reported-and-tested-by: Jay Foad <jay.foad@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7f40120..5a9c599 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1470,7 +1470,7 @@ extern int expand_downwards(struct vm_area_struct *vma,
#if VM_GROWSUP
extern int expand_upwards(struct vm_area_struct *vma, unsigned long address);
#else
- #define expand_upwards(vma, address) do { } while (0)
+ #define expand_upwards(vma, address) (0)
#endif
/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */