[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d28a706-3232-2660-f2f2-2faca999a3ff@arm.com>
Date: Mon, 17 Feb 2020 14:58:01 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: Guo Ren <guoren@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Ralf Baechle <ralf@...ux-mips.org>,
Paul Burton <paulburton@...nel.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Yoshinori Sato <ysato@...rs.sourceforge.jp>,
Rich Felker <dalias@...c.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mel Gorman <mgorman@...e.de>, linux-m68k@...ts.linux-m68k.org,
linux-mips@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-sh@...r.kernel.org
Subject: Re: [PATCH 2/5] mm/vma: Make vma_is_accessible() available for
general use
On 02/17/2020 10:33 AM, Anshuman Khandual wrote:
> Lets move vma_is_accessible() helper to include/linux/mm.h which makes it
> available for general use. While here, this replaces all remaining open
> encodings for VMA access check with vma_is_accessible().
>
> Cc: Guo Ren <guoren@...nel.org>
> Cc: Geert Uytterhoeven <geert@...ux-m68k.org
> Cc: Ralf Baechle <ralf@...ux-mips.org>
> Cc: Paul Burton <paulburton@...nel.org>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>
> Cc: Rich Felker <dalias@...c.org>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Mel Gorman <mgorman@...e.de>
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-m68k@...ts.linux-m68k.org
> Cc: linux-mips@...r.kernel.org
> Cc: linuxppc-dev@...ts.ozlabs.org
> Cc: linux-sh@...r.kernel.org
> Cc: linux-mm@...ck.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@....com>
> ---
> arch/csky/mm/fault.c | 2 +-
> arch/m68k/mm/fault.c | 2 +-
> arch/mips/mm/fault.c | 2 +-
> arch/powerpc/mm/fault.c | 2 +-
> arch/sh/mm/fault.c | 2 +-
> arch/x86/mm/fault.c | 2 +-
> include/linux/mm.h | 5 +++++
> kernel/sched/fair.c | 2 +-
> mm/gup.c | 2 +-
> mm/memory.c | 5 -----
> mm/mempolicy.c | 3 +--
> 11 files changed, 14 insertions(+), 15 deletions(-)
There are couple of places in mm/mmap.c which could use vma_is_accessible()
as well. Probably missed them, as the order of the VMA flags were different.
Will fold the following changes next time around.
diff --git a/mm/mmap.c b/mm/mmap.c
index 6756b8bb0033..9b9bb4031fd4 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2338,8 +2338,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
gap_addr = TASK_SIZE;
next = vma->vm_next;
- if (next && next->vm_start < gap_addr &&
- (next->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {
+ if (next && next->vm_start < gap_addr && vma_is_accessible(next)) {
if (!(next->vm_flags & VM_GROWSUP))
return -ENOMEM;
/* Check that both stack segments have the same anon_vma? */
@@ -2420,7 +2419,7 @@ int expand_downwards(struct vm_area_struct *vma,
prev = vma->vm_prev;
/* Check that both stack segments have the same anon_vma? */
if (prev && !(prev->vm_flags & VM_GROWSDOWN) &&
- (prev->vm_flags & (VM_WRITE|VM_READ|VM_EXEC))) {
+ vma_is_accessible(prev)) {
if (address - prev->vm_end < stack_guard_gap)
return -ENOMEM;
}
Powered by blists - more mailing lists