Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752917AbdFUFtU (ORCPT ); Wed, 21 Jun 2017 01:49:20 -0400 Received: from mail-pg0-f46.google.com ([74.125.83.46]:35192 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751922AbdFUFtS (ORCPT ); Wed, 21 Jun 2017 01:49:18 -0400 Date: Tue, 20 Jun 2017 22:49:16 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Greg Kroah-Hartman cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Hugh Dickins , Michal Hocko , Linus Torvalds , Willy Tarreau Subject: Re: [PATCH 3.18 32/32] mm: larger stack guard gap, between vmas In-Reply-To: <20170619152037.416644984@linuxfoundation.org> Message-ID: References: <20170619152035.750974520@linuxfoundation.org> <20170619152037.416644984@linuxfoundation.org> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 67 On Mon, 19 Jun 2017, Greg Kroah-Hartman wrote: > 3.18-stable review patch. If anyone has any objections, please let me know. > > ------------------ > > From: Hugh Dickins > > commit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream. Here's a few adjustments to the 3.18 patch: no doubt you'll have already sorted out any build errors (and I have to confess that I haven't even tried to build this); and the VM_WARN_ON line (as in 4.4) only fixes a highly unlikely error; but those FOLL_MLOCK lines in mm/gup.c were mistaken, and do need to be deleted. Hugh diff -purN 318n/include/linux/mm.h 318h/include/linux/mm.h --- 318n/include/linux/mm.h 2017-06-20 16:48:54.050429965 -0700 +++ 318h/include/linux/mm.h 2017-06-20 19:13:05.842191061 -0700 @@ -1242,6 +1242,9 @@ int set_page_dirty_lock(struct page *pag int clear_page_dirty_for_io(struct page *page); int get_cmdline(struct task_struct *task, char *buffer, int buflen); +extern struct task_struct *task_of_stack(struct task_struct *task, + struct vm_area_struct *vma, bool in_group); + extern unsigned long move_page_tables(struct vm_area_struct *vma, unsigned long old_addr, struct vm_area_struct *new_vma, unsigned long new_addr, unsigned long len, @@ -1897,8 +1900,9 @@ void page_cache_async_readahead(struct a pgoff_t offset, unsigned long size); -extern unsigned long stack_guard_gap; +unsigned long max_sane_readahead(unsigned long nr); +extern unsigned long stack_guard_gap; /* Generic expand stack which grows the stack according to GROWS{UP,DOWN} */ extern int expand_stack(struct vm_area_struct *vma, unsigned long address); diff -purN 318n/mm/gup.c 318h/mm/gup.c --- 318n/mm/gup.c 2017-06-20 16:48:54.054429927 -0700 +++ 318h/mm/gup.c 2017-06-20 19:18:19.579275331 -0700 @@ -275,9 +275,6 @@ static int faultin_page(struct task_stru unsigned int fault_flags = 0; int ret; - /* mlock all present pages, but do not fault in new pages */ - if (*flags & FOLL_MLOCK) - return -ENOENT; if (*flags & FOLL_WRITE) fault_flags |= FAULT_FLAG_WRITE; if (nonblocking) diff -purN 318n/mm/mmap.c 318h/mm/mmap.c --- 318n/mm/mmap.c 2017-06-20 16:48:54.054429927 -0700 +++ 318h/mm/mmap.c 2017-06-20 19:43:16.945345744 -0700 @@ -931,7 +931,7 @@ again: remove_next = 1 + (end > next-> else if (next) vma_gap_update(next); else - mm->highest_vm_end = end; + VM_WARN_ON(mm->highest_vm_end != vm_end_gap(vma)); } if (insert && file) uprobe_mmap(insert);