From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Helge Deller" <deller@gmx.de>,
"Hugh Dickins" <hughd@google.com>,
"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: [PATCH 3.16 3/7] Allow stack to grow up to address space limit
Date: Tue, 27 Jun 2017 12:10:34 +0100 [thread overview]
Message-ID: <lsq.1498561834.859458792@decadent.org.uk> (raw)
In-Reply-To: <lsq.1498561833.742501160@decadent.org.uk>
3.16.45-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <deller@gmx.de>
commit bd726c90b6b8ce87602208701b208a208e6d5600 upstream.
Fix expand_upwards() on architectures with an upward-growing stack (parisc,
metag and partly IA-64) to allow the stack to reliably grow exactly up to
the address space limit given by TASK_SIZE.
Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
mm/mmap.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2139,16 +2139,19 @@ int expand_upwards(struct vm_area_struct
if (!(vma->vm_flags & VM_GROWSUP))
return -EFAULT;
- /* Guard against wrapping around to address 0. */
+ /* Guard against exceeding limits of the address space. */
address &= PAGE_MASK;
- address += PAGE_SIZE;
- if (!address)
+ if (address >= TASK_SIZE)
return -ENOMEM;
+ address += PAGE_SIZE;
/* Enforce stack_guard_gap */
gap_addr = address + stack_guard_gap;
- if (gap_addr < address)
- return -ENOMEM;
+
+ /* Guard against overflow */
+ if (gap_addr < address || gap_addr > TASK_SIZE)
+ gap_addr = TASK_SIZE;
+
next = vma->vm_next;
if (next && next->vm_start < gap_addr) {
if (!(next->vm_flags & VM_GROWSUP))
next prev parent reply other threads:[~2017-06-27 11:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-27 11:10 [PATCH 3.16 0/7] 3.16.45-rc1 review Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 5/7] drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl() Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 4/7] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 7/7] KVM: x86: fix singlestepping over syscall Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 6/7] rxrpc: Fix several cases where a padded len isn't checked in ticket decode Ben Hutchings
2017-06-27 11:10 ` Ben Hutchings [this message]
2017-06-27 11:10 ` [PATCH 3.16 1/7] mm: larger stack guard gap, between vmas Ben Hutchings
2017-06-27 11:10 ` [PATCH 3.16 2/7] mm: fix new crash in unmapped_area_topdown() Ben Hutchings
2017-06-27 13:37 ` [PATCH 3.16 0/7] 3.16.45-rc1 review Guenter Roeck
2017-06-27 17:15 ` Ben Hutchings
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=lsq.1498561834.859458792@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=akpm@linux-foundation.org \
--cc=deller@gmx.de \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®