Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp646253yba; Thu, 18 Apr 2019 07:21:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYMxIJOzpPCRNXYSg40Tziyyzh7ovFpmP41+xs7/TZOAFAGKZf8BAeBJ9SJQdaQjcsp+CH X-Received: by 2002:a17:902:ec0b:: with SMTP id cy11mr95992033plb.21.1555597265762; Thu, 18 Apr 2019 07:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555597265; cv=none; d=google.com; s=arc-20160816; b=RHkkqEWRnUwqvofSC4GVK1j0CwhRDgfIxC/131qz3vyuKkrrAA6ypIKsXgZw3Ao9wE q5zuTPpJJALBbgKCKNAX0LAszcDK1EzKQ0f7STbOS2JdQGJKI/4XzOhcparsJFTxyPY5 JViXbA1g9EIBjaBfn7Z7JBqaE95YjSE5XIxSdteYPmScWBu+IHNOXBjatfR40JjT7eGW iheKQWVjr4OApNFzEXLU8NAJEEoDXbCQ+fT18QHXbvUCy+qggw+EB/i30iQvCkJ2UezM FlIjhTit/WOSwuDTSGCHViThlZo/9FvbtgdmfjCnbBvTOptTf15oUst+ZVPzY9G3zg3T 9RJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8eV2vUS51UMgePfSSxCuXJhq0Gtq0aUu2F6TTcKETz0=; b=w++GYGOcL+TfuiqNAm+8lPuIKUmMdleeFtyltYy2CGHW6lCpCwh14tGcZiFOTaiICU tG0xpL5ajlAQWA8x+Um0H50zThND2N1OKMZFvx7YFp1rWwYHkQL/X3jhUpdoWNlwf6eo t2tVz3NtrOPh9VAP44qE6XcHng0QJbEPn/NdFQDqXBriu3yM3EY75Bs0AiXbHbkhlgBj LUI7LY28hBEIH1T1RHzmXyrhVbMgllh5EqyNYpRDxjb4S01yIIQK2zqEcknPJmHfp9PR 6biqW+WhVUlZSFckRh12qr48q3o3+8cEdVSbx5j2IdW+3nm5yvflihtNXWFgI6TufebA 4sXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBq8bKtw; 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 v2si2068020plp.191.2019.04.18.07.20.49; Thu, 18 Apr 2019 07:21:05 -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=FBq8bKtw; 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 S2389252AbfDROTg (ORCPT + 99 others); Thu, 18 Apr 2019 10:19:36 -0400 Received: from mail-vk1-f193.google.com ([209.85.221.193]:39947 "EHLO mail-vk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389278AbfDROTe (ORCPT ); Thu, 18 Apr 2019 10:19:34 -0400 Received: by mail-vk1-f193.google.com with SMTP id l17so488997vke.7 for ; Thu, 18 Apr 2019 07:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8eV2vUS51UMgePfSSxCuXJhq0Gtq0aUu2F6TTcKETz0=; b=FBq8bKtw8jKgNvkAesGOL5wEhVUfIvOVZLawNU9Os5filzXur33S5KXLGi3G59zEmJ MNxbw1dkanZJyl6+Bh/X7hbbi4DCuJUT+N82rjvvIQb1baWE98HINAsh1KYITkSEbQsv WkyhKK/r8PDat9cP9eHISsDMRa0TxCyHkKPk0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8eV2vUS51UMgePfSSxCuXJhq0Gtq0aUu2F6TTcKETz0=; b=hjrXu5rLBJ4//ry+cVYc2CzwF4eD4+MZE6vdC3cpAaaHD5KoYH6rgonLYYPz0Jod1S ZG/g9JsVoQzs6p7IV39VTMy2cOGdYPly8LrJ6SC7UP7aFhyaFxdZrW05QkczI8RSRpUQ eqWsspKhC1L7zefdLyeY5JnzZkNJ8/hs16+eO8y9L8d5zw9aK6TawpXiryVJYB/sLi6w ameE76WBlXSst9H+F39Zs/fBzYhOU7gJWEMUrveSpGQ2FDMoq3TgoeZzPEI7oM8i2a+A 1Qjy8Jd+cwQkjAY9sLAfaxiABSHgDmrfgVv0HznZ1t34DfZWu6ViVzDDpkumbJodZZlJ 20Qg== X-Gm-Message-State: APjAAAUywTnkSXS1gqXTozgTAiIq+uRHbodaID6O5tYbytYxwM+5d5HZ ApvFqPYmbP2SN3HlbP3AiwgDRkHuFhs= X-Received: by 2002:a1f:c446:: with SMTP id u67mr51760887vkf.52.1555597172387; Thu, 18 Apr 2019 07:19:32 -0700 (PDT) Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com. [209.85.221.172]) by smtp.gmail.com with ESMTPSA id t207sm647716vkb.21.2019.04.18.07.19.30 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 07:19:31 -0700 (PDT) Received: by mail-vk1-f172.google.com with SMTP id x194so498327vke.0 for ; Thu, 18 Apr 2019 07:19:30 -0700 (PDT) X-Received: by 2002:a1f:2e07:: with SMTP id u7mr50481033vku.44.1555597170338; Thu, 18 Apr 2019 07:19:30 -0700 (PDT) MIME-Version: 1.0 References: <20190417052247.17809-1-alex@ghiti.fr> <20190417052247.17809-5-alex@ghiti.fr> In-Reply-To: From: Kees Cook Date: Thu, 18 Apr 2019 09:19:18 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 04/11] arm64, mm: Move generic mmap layout functions to mm To: Alex Ghiti Cc: Andrew Morton , Christoph Hellwig , Russell King , Catalin Marinas , Will Deacon , Ralf Baechle , Paul Burton , James Hogan , Palmer Dabbelt , Albert Ou , Alexander Viro , Luis Chamberlain , LKML , linux-arm-kernel , linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, "linux-fsdevel@vger.kernel.org" , Linux-MM , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. :) -- Kees Cook