Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9169388ybi; Tue, 23 Jul 2019 23:13:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeUR8mbku4D79D5LRipG+fsIZsD/SOMS6nHPfWg9ZUbJKqJrRSm31Xt5i9KAfkoaQjJEDe X-Received: by 2002:a17:90a:cb8e:: with SMTP id a14mr37130157pju.124.1563948792059; Tue, 23 Jul 2019 23:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563948792; cv=none; d=google.com; s=arc-20160816; b=ImcJWH73HsY8b/BYN0Tm2ww/pAubwHUaRqLq/kwGpts8xXeawfzu9f/PdTEmf4wTvd /giSvqxcrEun1wx/Di83rDmuAGwd6l6pDb24Dhnmp/BEXDtLjvcbyLqr6W8AzZb7HcFJ vmyQRfMkQeoMTnTrQBHSIFw9e525/TBcv6I+M8fjAzELAU2aoNCR2UySZ8E8rfUNLo+h nFEAkaUfg+jESJ3+J4YeebsbpNzaBhaj/tY/HwdGDZ3WIphs5PqJ9R+RhJ3h6CfIbVme 76vsDQ7PuNZCjAgQMrGFtuA8miFtPSyNcdy760yvFDicFBj2RmJT3jMWoTI+iKLC+pQi 4n4g== 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=0C35ePTka3aILniTSobALrcos9kafZPeyeIsA3FK51o=; b=O2w0pJRlYejKwoWmd0nZlK8v6ATGLtIIR8r5OnO20QTE/bcw2pVMfBfxFDSht5jE2l aQFyxVwbRfod3n5jcc/bHHSXbWd5al5RCkpBicV9EUl1Z9l2AtgeC9pwcMKzOE2At6Pv y+AWNIwpWmRjof7qNsHN+QhlVOAYMh7AGEU4Q4pag6DGeb4yiPRR8i5rc6EKXjlfhC4z m1SVsqqET2+efC9DnR1GXjAozCa2vThGIYqXBHnaJpl2co50Zn+chF1qD+9dH4GN7HkF KeK490jFcYjrw/V6JduhEXSYFmNG3beKl45rS1Ru37w6cH3MVloSU2hkcEx1AAUS81Ec IBOA== 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 v11si14354711plo.223.2019.07.23.23.12.56; Tue, 23 Jul 2019 23:13:12 -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 S1726230AbfGXGLD (ORCPT + 99 others); Wed, 24 Jul 2019 02:11:03 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:60283 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfGXGLC (ORCPT ); Wed, 24 Jul 2019 02:11:02 -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 1BAEE60002; Wed, 24 Jul 2019 06:10:56 +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 REBASE v4 11/14] mips: Adjust brk randomization offset to fit generic version Date: Wed, 24 Jul 2019 01:58:47 -0400 Message-Id: <20190724055850.6232-12-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190724055850.6232-1-alex@ghiti.fr> References: <20190724055850.6232-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 Reviewed-by: Kees Cook --- 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 a7e84b2e71d7..faa5aa615389 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