Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3861474yba; Tue, 16 Apr 2019 22:34:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+kK8Iosd4jgB7RB8n8VaqwAggXPG2L2xWxGAVZQG6k3woKYyA0j+g85vFMupnkXqNnc4E X-Received: by 2002:a63:6842:: with SMTP id d63mr78230933pgc.49.1555479269590; Tue, 16 Apr 2019 22:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555479269; cv=none; d=google.com; s=arc-20160816; b=r7LPsKiSVBIPayo9BWaaX0UlzjYMu+YmdG1n3+PmZ87nrwDg5ZN180n4SiLb6Hn24D pL+PdTkfUjSTg1UX2+0MHlwBUIAkHgvwmNM0YEXgL9i8BDc0GaBuTFNXI2gIJpiyIzoN ViUwPcE53s48bCQ6hgZbxkyTxQn9dAXbBcjw+FFaUnG/X6ufS9kMXeAml+sAe5I8Lpm4 Z2aEPbGAWM2xA5gYqJjz4X3CMQ+Rjh9gO6HiZSJ/KH3HT65WD9z0p2gmkZfQeyA0gB6p pLRX0pUWJyMIXyidkPUTCryX1zo8WPe4l+s0fi21Vcc9FmOUqRnzw28Cu679Ld7a7BL7 2Fdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6D+bml0GAKMUKHe87npe+2LGj2+9T7+GwcJmjpz0elM=; b=AwcDPK31Q3uXRokTWAImKldnLeDRH7EyAhx5mjDUQXgrzb6hlae5g/B4D14Pvq2MM0 X0a1yJk+3jjjTS7yYR5FUn2YB0LkhObSd5ZXnhtO9aOY/W/6kAQxW+ntvPRPB+1nUl1T TmDQViMClppNlF4q/4yrBZHy2xntL4DAdi/8mIAwSuOk6TgcZLN8UINycuW7hMPzSroq JFFHdOjUkvqkrK7IiPB+v4KXQLbwJmt/J+4qyGnePpCpPN9vUULZNcYelwKzf8sE0BM5 2I6WHUZtYbPsPc7eSvtt16ts5YG4Ue5TBYO9x1hEvKs+mmU/O7Iu3G/KMpqridDr5wO6 Tijg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si34956297pgg.573.2019.04.16.22.34.14; Tue, 16 Apr 2019 22:34:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730388AbfDQFcn (ORCPT + 99 others); Wed, 17 Apr 2019 01:32:43 -0400 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:58599 "EHLO relay9-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfDQFcn (ORCPT ); Wed, 17 Apr 2019 01:32:43 -0400 X-Originating-IP: 79.86.19.127 Received: from alex.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id C815DFF80B; Wed, 17 Apr 2019 05:32:37 +0000 (UTC) From: Alexandre Ghiti To: Andrew Morton Cc: Christoph Hellwig , Russell King , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , Palmer Dabbelt , Albert Ou , Alexander Viro , Luis Chamberlain , Kees Cook , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Alexandre Ghiti Subject: [PATCH v3 09/11] mips: Use STACK_TOP when computing mmap base address Date: Wed, 17 Apr 2019 01:22:45 -0400 Message-Id: <20190417052247.17809-10-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190417052247.17809-1-alex@ghiti.fr> References: <20190417052247.17809-1-alex@ghiti.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mmap base address must be computed wrt stack top address, using TASK_SIZE is wrong since STACK_TOP and TASK_SIZE are not equivalent. Signed-off-by: Alexandre Ghiti --- arch/mips/mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c index 3ff82c6f7e24..ffbe69f3a7d9 100644 --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -22,7 +22,7 @@ EXPORT_SYMBOL(shm_align_mask); /* gap between mmap and stack */ #define MIN_GAP (128*1024*1024UL) -#define MAX_GAP ((TASK_SIZE)/6*5) +#define MAX_GAP ((STACK_TOP)/6*5) #define STACK_RND_MASK (0x7ff >> (PAGE_SHIFT - 12)) static int mmap_is_legacy(struct rlimit *rlim_stack) @@ -54,7 +54,7 @@ static unsigned long mmap_base(unsigned long rnd, struct rlimit *rlim_stack) else if (gap > MAX_GAP) gap = MAX_GAP; - return PAGE_ALIGN(TASK_SIZE - gap - rnd); + return PAGE_ALIGN(STACK_TOP - gap - rnd); } #define COLOUR_ALIGN(addr, pgoff) \ -- 2.20.1