Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3859522yba; Tue, 16 Apr 2019 22:31:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqyt9UmMeplTaA6VxcVA0vW2I7RRq7F1S2iylLeayT+O1zo343G/aNxeI+b05nlWS4aO/4EI X-Received: by 2002:a17:902:7d81:: with SMTP id a1mr86465836plm.202.1555479060686; Tue, 16 Apr 2019 22:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555479060; cv=none; d=google.com; s=arc-20160816; b=Lslb378lcakHeK53wmNd+C99g3yjucpI/MT/nWV+uYIKUT/jOLKE9rJOd4ghkPqf+J VPfKGZLneQdnLzmiDJLYz3MsTcBvPL0jjWTrrBF7gYlYR+fgdyOVixiukJd6h5dHE0W9 e2dwlKTgdkO6f3FCKwV2KMgkO9B+I6ToFDrNo5CPwH7kFYzQW1uXbfiDOeYqDmVwpPto wkX9Nve9Ohr+22pTm0SrUc51wUEIBbmL1R2q/exxjVyJxBgmUIFY8Gvwg7D8Q0NdJGIl U9ARpTz9vrXiJVqz7jC9wXOBpJmq5E1F6fsiKzMHE9Nxy3obuGTZh89ZHVrXqkaNzbZi AAng== 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=qLIfa0rcn3uuBSuGdyQd2indykfbUvCgupWpuxIE69U=; b=HongWEqpfUThh1DnqpCSxZOilmmeQQcNRRb3Qst8nwImu7FFY5y7r/dlB+Oo83cZWw C2LaojnIxeoKp7Lxl6QxMwYrOfG1x4lwhEqLC2IQkL+XucKAMq2b8E6usAu3ee/E7geE bYT2XqVJrrsFBDvPqlNoHMW9LbzBucWuuEwVX4i/50i/Q6yWCoa99jslfz2FaTrNC1/B kGutq1Ku8GkJG9CILXCK/03Q5ftbvSQ5G6jZ6grB+LZiU4nE2ERpnO8lNz+SRx7sOQsT mrtXbRiy0MBvcqsKXzLVfycoImQR06HblYkO8YNP7tJFbiWpWau0ewonzKiZGXvHmofY emaA== 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 z127si51993324pfb.254.2019.04.16.22.30.45; Tue, 16 Apr 2019 22:31:00 -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 S1729315AbfDQF3a (ORCPT + 99 others); Wed, 17 Apr 2019 01:29:30 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:50049 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbfDQF3a (ORCPT ); Wed, 17 Apr 2019 01:29:30 -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 relay1-d.mail.gandi.net (Postfix) with ESMTPSA id AAD82240004; Wed, 17 Apr 2019 05:29:24 +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 06/11] arm: Use STACK_TOP when computing mmap base address Date: Wed, 17 Apr 2019 01:22:42 -0400 Message-Id: <20190417052247.17809-7-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/arm/mm/mmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index bff3d00bda5b..0b94b674aa91 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -19,7 +19,7 @@ /* 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) @@ -51,7 +51,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); } /* -- 2.20.1