Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2717651yba; Sun, 28 Apr 2019 07:29:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGUcpV5b7zbpIU3hczzBbveXf0OMHnzSxY1JcKexsVVJ1dL73iI7JVTKrUgm8zfa0LvFGV X-Received: by 2002:a63:d252:: with SMTP id t18mr5196932pgi.131.1556461744705; Sun, 28 Apr 2019 07:29:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556461744; cv=none; d=google.com; s=arc-20160816; b=mfi4KuEK+91nhtlPIDNU5OnfoXFRsMXh3TkJ99SNx6VcFOzavH1bijhVbJIXMcpp7U l12h4Ow2f/1sSzfV2E9CgyR8yU9Nw+PnrR8ESoRoA0qqZUz2KRo7NYmx6Sw8xxwB0C6Y GtaSbJnmgHt11bfwWShiiqNUgcr6rIfA5sje3CIsG2DEI0Ypy6qEC3HKeKvPb7iYnoYI b+KuKDZuX/V7Y96wC75w2RkCiEPsONhDrYHBjNvbo+IYUSpXtpxRllBeydlg+B/FIiJz u9J0+w7yHfmkqoir39Yu+M0h1fizeYO3lP/UZrOO43PCkSS98pXeHVPj1rChJ0JrhGGN +K/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=U4gvHYtR3cZMhjl2n48U193qZV7aNj8fYuONBGQ/OiY=; b=oMR0/gyZaUlGkMcfyLYoDi49gO5PzXJyZINAUnWIN+029N46MaLyumopKFS720stO9 8x0eVdyPetJIAIjZeds+RsEAoG9Tz77txx0w/eTpjpGvcwluKmppF14jucGn2rbe5h0c gujbS1KA0tZrWrjT4yXNWPRGcx6uEnmFy1ES1dNH/wlBQ/JWOB0KaN0hp99B40+yhmju X6srSMpaGh+qE15cAG7w6jHNN+Jkyym9LhvjIodNE0UahbAmLxQ1xiHLeL418Zsl4RAF J+fd3+htp6mY2kxODHN/zkrd1wIak8KS+9xUS46MBWdCNwGxzYF7zqEa5+o3HfMrGKS2 MG8A== 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 bb8si14540113plb.388.2019.04.28.07.28.49; Sun, 28 Apr 2019 07:29:04 -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 S1726781AbfD1O2C (ORCPT + 99 others); Sun, 28 Apr 2019 10:28:02 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:48145 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726659AbfD1O2B (ORCPT ); Sun, 28 Apr 2019 10:28:01 -0400 X-Originating-IP: 79.86.19.127 Received: from [192.168.0.12] (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 381E61C0005; Sun, 28 Apr 2019 14:27:53 +0000 (UTC) Subject: Re: [PATCH v3 04/11] arm64, mm: Move generic mmap layout functions to mm To: Kees Cook Cc: Albert Ou , Catalin Marinas , Palmer Dabbelt , Will Deacon , Russell King , Ralf Baechle , LKML , Christoph Hellwig , Linux-MM , 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 , Luis Chamberlain References: <20190417052247.17809-1-alex@ghiti.fr> <20190417052247.17809-5-alex@ghiti.fr> From: Alex Ghiti Message-ID: Date: Sun, 28 Apr 2019 10:27:52 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: sv-FI Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/18/19 10:19 AM, Kees Cook wrote: > On Thu, Apr 18, 2019 at 12:55 AM Alex Ghiti wrote: >> Regarding the help text, I agree that it does not seem to be frequent to >> place >> comment above config like that, I'll let Christoph and you decide what's >> best. And I'll >> add the possibility for the arch to define its own STACK_RND_MASK. > Yeah, I think it's very helpful to spell out the requirements for new > architectures with these kinds of features in the help text (see > SECCOMP_FILTER for example). > >>> I think CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT should select >>> CONFIG_ARCH_HAS_ELF_RANDOMIZE. It would mean moving >> >> I don't think we should link those 2 features together: an architecture >> may want >> topdown mmap and don't care about randomization right ? > Given that the mmap randomization and stack randomization are already > coming along for the ride, it seems weird to make brk randomization an > optional feature (especially since all the of the architectures you're > converting include it). I'd also like these kinds of security features > to be available by default. So, I think one patch to adjust the MIPS > brk randomization entropy and then you can just include it in this > move. > >> Actually, I had to add those ifdefs for mmap_rnd_compat_bits, not >> is_compat_task. > Oh! In that case, use CONFIG_HAVE_ARCH_MMAP_RND_BITS. :) Actually, > what would be maybe cleaner would be to add mmap_rnd_bits_min/max > consts set to 0 for the non-CONFIG_HAVE_ARCH_MMAP_RND_BITS case at the > top of mm/mmap.c. > > I really like this clean-up! I think we can move x86 to it too without > too much pain. :) > Hi, Just a short note to indicate that while working on v4, I realized this series had a some issues: - I broke the case ARCH_HAS_ELF_RANDOMIZE selected but not ? ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT (which can happen on arm without MMU for example) - I use mmap_rnd_bits unconditionnally whereas it might not be defined (it works for all arches I moved though) The only clean solution I found for the first problem is to propose a common implementation for arch_randomize_brk and arch_mmap_rnd, which is another series on its own and another good cleanup since every architecture uses the same functions (except ppc, but that can be workarounded easily). Just like moving x86 deserves its own series since it adds up 8/9 commits. I am on vacations for 2 weeks, so I won't have time to submit another patchset before, sorry about that. Thanks, Alex