From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CFBAC28CC0 for ; Wed, 29 May 2019 20:12:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3258823B07 for ; Wed, 29 May 2019 20:12:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MmRoB8xp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mD+XA/C1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3258823B07 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/x6Lyodc5V4jpy1BY4nnGy3XF6fecC2JgHfKDGMj9wA=; b=MmRoB8xpKudinL /fAwRyEkllK8eYxPZgp/WGkq2ksezRoazT4kc1Gyd6mnGvbGsQfjmlXuqpDwTJeVCYIdhSEb1EpXF yO/6iG7tsmS3U4AIW0wnEI2+8fBVax72n6oqrwuAcWuW0MsLjVNtn7JHVbKsAifrJag3uQcUR4RJA sAsxXaZqsZa2bSIkH4flG9QzgXcmJ9uBuD7aDxfUNMbZB31hePF3ZSN4T4PKGwODw9hP/0VJhGs/r YAgJpRFb2oIqzwW227BNHACGX46vfMZyQVcPY9Mswpzg/XVZY6RVGlkLJUZiwT43ACu4/kKXhdbtw IeJ4oAMYgog0ydWttTlg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW4vo-0007t9-DE; Wed, 29 May 2019 20:12:16 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hW4vk-0007rr-Vf for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2019 20:12:14 +0000 Received: by mail-pf1-x441.google.com with SMTP id u17so2339121pfn.7 for ; Wed, 29 May 2019 13:12:12 -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=PGcw43rEtHfebZ1ykAg+O3oB9Ib7l867UUY+4n/dk/Q=; b=mD+XA/C1RPTuYpF3bAQXZIvQOGFykfuFTGv2T4SJe7rylVcI8w0NDLRy0IsBLJ66C4 yVcYvfhvVtwxJaG6tBzpFRpEcG+JM4ZK+8yr+Vmhnc0lkQZ9h7mnNWkXgsjQ03iN9T3Y xn9BTzPrq4mJgfWOD9cwdHXpGjo9qYZ06UsdU= 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=PGcw43rEtHfebZ1ykAg+O3oB9Ib7l867UUY+4n/dk/Q=; b=uX39cGaVQGAa0biKmw4OZ1ushUIZYq6JiPj2lvzARY3zQujFtUZMyGU0z/QqOnF7la DvOlxzlrY5OSvhXiGl5hT6sW0hH0rg37Hpr7NUaTtHC/3kJwJFE6ziq2GmHSBGi+sAys oAS8nEkvqpetTc+cIoJ/y+mRt3ABCGlxtRJZ6i7GAVyqymyoe/rDSg+ch8KtsyqFUJRJ 4SIHyd2OPmp9SIYVgLS3Ng+IjZIMbdinmSKZrUbHoMwFWKdJ+PwqTMMIivgwV4NrBPjI Mnzual6ixQH0elj/hxEN6lWyNli+MFHf0UmivS7w8n11n95o/bESzXVvH/yJGfz4a50n BkYg== X-Gm-Message-State: APjAAAW7CbZf7L5PNRyj19O4HDZ4fLoyRxMS81j1GGGD9NBfC6ARsHax 8XSKI8zyQMriYRcdBLEyAHs7Bg== X-Google-Smtp-Source: APXvYqwDEJpc5XVklT3bHvSVgN9OxPIFPApr20V/GjXll3oEfIoQdqDbKTvTIc6ODp034anrn4Q3IQ== X-Received: by 2002:a63:f551:: with SMTP id e17mr11828943pgk.329.1559160732491; Wed, 29 May 2019 13:12:12 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j2sm494584pfb.157.2019.05.29.13.12.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 May 2019 13:12:11 -0700 (PDT) Date: Wed, 29 May 2019 13:12:10 -0700 From: Kees Cook To: Alexandre Ghiti Subject: Re: [PATCH v4 11/14] mips: Adjust brk randomization offset to fit generic version Message-ID: <201905291311.7E88A71@keescook> References: <20190526134746.9315-1-alex@ghiti.fr> <20190526134746.9315-12-alex@ghiti.fr> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190526134746.9315-12-alex@ghiti.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190529_131213_017545_883BD3E9 X-CRM114-Status: GOOD ( 18.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Albert Ou , Catalin Marinas , Palmer Dabbelt , Will Deacon , Russell King , Ralf Baechle , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Paul Burton , linux-riscv@lists.infradead.org, Alexander Viro , James Hogan , linux-fsdevel@vger.kernel.org, Andrew Morton , linux-mips@vger.kernel.org, Christoph Hellwig , linux-arm-kernel@lists.infradead.org, Luis Chamberlain Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, May 26, 2019 at 09:47:43AM -0400, 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 -Kees > --- > 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 > -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel