Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2740490ybi; Sun, 26 May 2019 07:01:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHLN+cAgmW6v9vFa5wmnAlzA7xzx6rZzJCT+Wae9udDNuWqPHkZXGcAUgq59NWDDRAISZJ X-Received: by 2002:a65:578b:: with SMTP id b11mr119036009pgr.446.1558879309117; Sun, 26 May 2019 07:01:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558879309; cv=none; d=google.com; s=arc-20160816; b=KLGbTgPM8vdu9qycmKpl2oNMYqHIfcdbTRDfQA/aCXgqYbKibYs5rYxwVaDoObUbM0 f+euftJcsDrFTlBEmKoOmIfuWKgZLlrl+hoIDM9cLnDPHgfCICap3d79+3wjbUIUumIt isRSLR+aCLQBOq+QiYMFZxj7YUArbGyCNjqY/X0NhXzmQVon6OVZ45555OieIhgw3FBC Z1cCxIvySVupGO8S2PPXUlbYwS3sIsT4V0vbjF4pK3sWaZ3IvfEpq+STKkrOSVIO9wqO 3uBDYLRftq0gKL/uC8UeFAbBWBQFwpJvfvmIb/daO6KTTA3jGLHeoUU9PxmErLuWE1BQ nIuQ== 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=B1xCAfwoo2VsupRz9LufscYM0z2KLMPO+UsoTLhSc0Y=; b=C7yay5pyKH4JhF+ed5utDGTLKrSOwEe9jqdPinQsrUuDHrIm/1ZIAHqblFuXREH3ca Ccjg3eqC2j2t/r6hxYi0JithqlokvfsHXT974bDtkK6aaa4GNNj6UnEYHWc+lQwmrFeZ wg45uVBY7FyDrJ0iRtVAeH04WlyoWcGvYJU+kHCJBN2wsSLqhttEhXFLAh3Lpt7qnRAD FSjeLI9DitmOvy9pm9sfHOMOjVdouzsDNmiwHRZJmAD3D8+weEoncaB1sZ9Vg1dMzzg3 iPvCXkcqr0CYmwBlZzYZayG1LaCy38s7SNNa/t0J/qgc6XBcXGbKf/iIY4ccks1IhXqw UZ7g== 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 v13si13357808plo.429.2019.05.26.07.01.32; Sun, 26 May 2019 07:01:49 -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 S1727913AbfEZOAW (ORCPT + 99 others); Sun, 26 May 2019 10:00:22 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44915 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726995AbfEZOAW (ORCPT ); Sun, 26 May 2019 10:00:22 -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 relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 1A2206000A; Sun, 26 May 2019 14:00:15 +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 v4 11/14] mips: Adjust brk randomization offset to fit generic version Date: Sun, 26 May 2019 09:47:43 -0400 Message-Id: <20190526134746.9315-12-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190526134746.9315-1-alex@ghiti.fr> References: <20190526134746.9315-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 This commit simply bumps up to 32MB and 1GB the random offset of brk, compared to 8MB and 256MB, for 32bit and 64bit respectively. Suggested-by: Kees Cook Signed-off-by: Alexandre Ghiti --- arch/mips/mm/mmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c index ffbe69f3a7d9..c052565b76fb 100644 --- a/arch/mips/mm/mmap.c +++ b/arch/mips/mm/mmap.c @@ -16,6 +16,7 @@ #include #include #include +#include unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ EXPORT_SYMBOL(shm_align_mask); @@ -189,11 +190,11 @@ static inline unsigned long brk_rnd(void) unsigned long rnd = get_random_long(); rnd = rnd << PAGE_SHIFT; - /* 8MB for 32bit, 256MB for 64bit */ + /* 32MB for 32bit, 1GB for 64bit */ if (TASK_IS_32BIT_ADDR) - rnd = rnd & 0x7ffffful; + rnd = rnd & SZ_32M; else - rnd = rnd & 0xffffffful; + rnd = rnd & SZ_1G; return rnd; } -- 2.20.1