Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11265771ybi; Thu, 25 Jul 2019 13:02:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkPq/fAqFWYnZTL8LdLaDQ3BX0V5iDVF5Gs0hUxKGd5iGHJRKUMM9Uu5mPta0R7/tAJW99 X-Received: by 2002:a63:2cd5:: with SMTP id s204mr72165856pgs.95.1564084919765; Thu, 25 Jul 2019 13:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564084919; cv=none; d=google.com; s=arc-20160816; b=0gTSPgXd2sktNjBFLZURxcflte3jo8wN44ORuJb3p984TikcCvzDkii6+i2/t/NfdO i8g5Xiw9vX9tbiC+JHZc1p3IGZfVFgGTzHp8DbPz20H4bRaivSwdClKdsVhga9zsu9nh iQAO0rG52dyaSys7vQyUsluSVU44xy/2FTYFGxgDId7F8KZP2BVPJvoN8H8w8gyKzeGe 7unY7qGZP/wX9VRsLTzeHJ0aHOLxk3wlVP80AUi61ZgGuG3Ikd1Y3covGf07a1yAk7qD y2s9AQAuANxZO+vYR2blFiiqTWaItHTPKGvE9dVbLw7MdMWZuhgMtnQb6eqZ+Hm3hIVK G+OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=czhvpuMA3newxUE1Ok0eyKdEKMeSe/BMrFd/BkJbH88=; b=pIseKXq4HVckaquk7m1CAv3dh5R88QVvAoY1zTAYTGPM2Saj5qOQ+lXSHi1407l4wn Q8rftnD4jvSzaXgbO23a5wMWptxKvTLOaTutnw0XUkHFtJvrcm2EdLCO6IsPpw8gqWYI vCn6FGPEpohRF0/LezBAOrElsMvbs1dstUgkb+IuTbo90dv7ZHZVDv82X8fFRYKB+8PV lW9KtdFivoJiMCYg+xYlMVgjIHU9vdZSj3NDFYcYwyf/WZ5DusRjWhbubjJfT7Ux5g4/ AKAIG6iGZbBpyoZp+4J9d6IBcpLVjBdZmlrWlIZHqqWhQDLD5un3OXnZmqiAyEFtR2It N1fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VFAYa7L0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u16si20847470pjb.15.2019.07.25.13.01.44; Thu, 25 Jul 2019 13:01:59 -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; dkim=pass header.i=@chromium.org header.s=google header.b=VFAYa7L0; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbfGYUAg (ORCPT + 99 others); Thu, 25 Jul 2019 16:00:36 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38990 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726166AbfGYUAf (ORCPT ); Thu, 25 Jul 2019 16:00:35 -0400 Received: by mail-pg1-f193.google.com with SMTP id u17so23553676pgi.6 for ; Thu, 25 Jul 2019 13:00:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=czhvpuMA3newxUE1Ok0eyKdEKMeSe/BMrFd/BkJbH88=; b=VFAYa7L009E7Uphizuk8EUTkPs3Kp07Ow0349Bvlb5HNDgpvBrzunrXj9n7hha+kMS bUM5MSI0W1TI2wdDk/dt+iOAY/2LqMW2igW+v6EdmydphptD2J677zHoPzFb2KTmBouE B/nckqeeuspAcsyRQBtXmWSYaDMekv/0MycuA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=czhvpuMA3newxUE1Ok0eyKdEKMeSe/BMrFd/BkJbH88=; b=sDznEKZvpgdXW2AqmWTWjr2MYuMS7P5cD6c9QQS7fyHS6OFecYwzfXivV9pi5PoZDU CXmR3LKXyW16fcLtAyOlqy5PmRDpDY7+GC8Jp5NKJi905mPDoJq8HZS8i7DT0p1+++RP xE6XkJe7KDV2bCozIKYLVPX1IaebhD7oRSzdVORx3U9cSlxjQ8sCzaG80EhdKDDfzFGK 44GUIac+XsVr2EkdApyXneOUDMz4ku9fIxCp7mL1YlSm6bMVnh5KndnHTsInYJyId9Om M9yqU3bMxpMVdDSjMqynHXNFmmMVUK4WA89tvzMkW0FQrJkx+6J4oUlaFukdaMmpTRz9 eLpg== X-Gm-Message-State: APjAAAWMEWRoxBCDAk+5Gyhciql2RZon96ILHcCbJAXBOnWFykki7m05 XcfmkynflVEdAjISWGB+hZRsQg== X-Received: by 2002:aa7:9713:: with SMTP id a19mr465671pfg.64.1564084835161; Thu, 25 Jul 2019 13:00:35 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j1sm75405528pgl.12.2019.07.25.13.00.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jul 2019 13:00:34 -0700 (PDT) Date: Thu, 25 Jul 2019 13:00:33 -0700 From: Kees Cook To: Alexandre Ghiti Cc: Andrew Morton , Albert Ou , Catalin Marinas , Palmer Dabbelt , Will Deacon , Russell King , Ralf Baechle , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Paul Burton , Alexander Viro , James Hogan , linux-fsdevel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mips@vger.kernel.org, Christoph Hellwig , linux-arm-kernel@lists.infradead.org, Luis Chamberlain Subject: Re: [PATCH REBASE v4 11/14] mips: Adjust brk randomization offset to fit generic version Message-ID: <201907251259.09E0101@keescook> References: <20190724055850.6232-1-alex@ghiti.fr> <20190724055850.6232-12-alex@ghiti.fr> <1ba4061a-c026-3b9e-cd91-3ed3a26fce1b@ghiti.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ba4061a-c026-3b9e-cd91-3ed3a26fce1b@ghiti.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 25, 2019 at 08:22:06AM +0200, Alexandre Ghiti wrote: > On 7/24/19 7:58 AM, Alexandre Ghiti wrote: > > 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; > > } > > Hi Andrew, > > I have just noticed that this patch is wrong, do you want me to send > another version of the entire series or is the following diff enough ? > This mistake gets fixed anyway in patch 13/14 when it gets merged with the > generic version. While I can't speak for Andrew, I'd say, since you've got Paul and Luis's Acks to add now, I'd say go ahead and respin with the fix and the Acks added. I'm really looking forward to this cleanup! Thanks again for working on it. :) -- Kees Cook