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=-1.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,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 B88CCC10F0E for ; Thu, 18 Apr 2019 14:19:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86A8820675 for ; Thu, 18 Apr 2019 14:19:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FBq8bKtw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389303AbfDROTg (ORCPT ); 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-Google-Smtp-Source: APXvYqycS943ckmwWFUDXCzxaJsmmF05s60d3YiCrixLrIMZiLRQ9+UVz7C6MDVv7/KE3X4U/zk4Uw== 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 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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, 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 96DFFC10F0E for ; Thu, 18 Apr 2019 14:19:45 +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 67DE220675 for ; Thu, 18 Apr 2019 14:19:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OLOLLLnT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FBq8bKtw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67DE220675 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-riscv-bounces+infradead-linux-riscv=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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CeRhJGH53b1mdMd66GLvMp+66uK/i7iR40Ub82mYtm8=; b=OLOLLLnT7Mjpeh Qhaymbkb5cYlo02aq90ayuzHdVmn5a5BYQFuJrHAuwMWWrqsB0bECmBCztjdyqcNzQqM1PY5oO7MO nuoDLX3ENpsHivgWefrZQ2XzoLnJdMzrpkN/3u36CxFf+4gKmhrRJ3QlS5ANsy9ooDlz+EVB4oxBw oNh4C3bDECRsggHoQ68eyGxvqgSjrJ9JfSfqLSICxc7y/pVtUAWm1j2R7zcdwWFvBt00wuKzKCOKz CmiLIsl8rKbjVDp39fwE1WdlpToB7aAKOiM4UPCDMPEYXjMcEPhhJ7CxcdnWO/nVFH/4SdncD44H+ Nvyj0FtSva8Lt2PBp4bA==; 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 1hH7t7-0001iE-9k; Thu, 18 Apr 2019 14:19:41 +0000 Received: from mail-vk1-xa41.google.com ([2607:f8b0:4864:20::a41]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hH7t1-0001aC-03 for linux-riscv@lists.infradead.org; Thu, 18 Apr 2019 14:19:36 +0000 Received: by mail-vk1-xa41.google.com with SMTP id h127so481291vkd.12 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=BMxyKE/eEhwTDgoFyjnYiA5Tb95Ns718PN/9Yp+Zouu9rlgSGL2ZXOI9UUBxp+/P5e 0DbeX31dETPuRz/wMsXoZ+NzBnXrombJGgbztVppaUGnmJKqubzicC4V1WqiQ+Vs/dsS hWl++YTugAYd3tcBV28rOTrMwISQI2v7yBg8ayAeptuYXbo1k42lzajJqK1u9vJ0jDfz KPVK4eI0ZYlDbozQXzkqDbPhcCtj+2l6mHwRWtrNA0s5i1Swlmo23LHMRhm11b07zTT+ LiAHTn5O+Ah7wdunRFRS35EGpLQYfR4fKftT2IMHNX1qOrN7O5Tyh3Eoi6pywFmErgqI Ms0g== X-Gm-Message-State: APjAAAWhlON3BLKwuPKgkijfYXkxJqV2wMKiA4/Pg3cbV4KO+HV36uc7 zwGD5ObadVZQyUX/VoCkW6m/sylaUVk= X-Google-Smtp-Source: APXvYqyOYaEFiiWqu1a5kFMGBU1bzRk/VyBXVm8az5aZCksdZj5Nfsiq3polmx3Iybp/OAxRXHPR9Q== X-Received: by 2002:a1f:ab8d:: with SMTP id u135mr48870472vke.80.1555597172328; Thu, 18 Apr 2019 07:19:32 -0700 (PDT) Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com. [209.85.221.176]) by smtp.gmail.com with ESMTPSA id l200sm739579vkl.25.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-f176.google.com with SMTP id h71so494148vkf.5 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190418_071935_039247_02617239 X-CRM114-Status: GOOD ( 14.60 ) X-BeenThere: linux-riscv@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 , 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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=-1.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS autolearn=unavailable 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 5DDE3C10F0E for ; Thu, 18 Apr 2019 14:26:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 19E55208E4 for ; Thu, 18 Apr 2019 14:26:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FBq8bKtw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 19E55208E4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9E5676B0005; Thu, 18 Apr 2019 10:26:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96B846B0006; Thu, 18 Apr 2019 10:26:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80CC16B0007; Thu, 18 Apr 2019 10:26:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from mail-vs1-f72.google.com (mail-vs1-f72.google.com [209.85.217.72]) by kanga.kvack.org (Postfix) with ESMTP id 580C36B0005 for ; Thu, 18 Apr 2019 10:26:05 -0400 (EDT) Received: by mail-vs1-f72.google.com with SMTP id t17so555103vsl.8 for ; Thu, 18 Apr 2019 07:26:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:references :in-reply-to:from:date:message-id:subject:to:cc; bh=8eV2vUS51UMgePfSSxCuXJhq0Gtq0aUu2F6TTcKETz0=; b=S41AKENoYTRcITcEpssQUrfWHoJv6FLso8P7s6PTbBgVuz5r8Daz9UfH0nUdtfWtdc xkTe7piUFC3qw+gn7ISi8eo4ryhaoKExTglw5RyMmeZ7q+71NL42L/pM4aIAdP1GyNQK 2FA3pSp9gvwO5swihNGczyAueVtAxJ2eN9TvMxgQTIk7YIt67TyYV57nGu8rUlWPxqCh 6hVMlxutyncsC+PUOVjQQpITIm0MCUsKAplmNE9VQqbJr1lMq27LF409nUXIAIWKChDC XuypJmYA6YpkVPgummEsm8jxgJmwXEwJrF8MAHO4k4e9yoN39XpSPBRiVmSbPQRKc5Qn 9auw== X-Gm-Message-State: APjAAAWEb05D+A63d4Ws7yLp04VDsxvJxiOWoBqb5mWifujIEFpCGKGP pNAZFs8vN1Y8+yvg3h93gKSeB4EMyt1mULKZa4XO72sBlO0l1MpE1p2PQNKnDYxKssucls5bG0y iO41xrQuLvde1TAFu7bE5KHn+STP1LIkMHibH/yQeNiyqxj+8/oWa4fdenS991rorJw== X-Received: by 2002:a67:fa4d:: with SMTP id j13mr51855213vsq.22.1555597564977; Thu, 18 Apr 2019 07:26:04 -0700 (PDT) X-Received: by 2002:a67:fa4d:: with SMTP id j13mr51855168vsq.22.1555597564283; Thu, 18 Apr 2019 07:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555597564; cv=none; d=google.com; s=arc-20160816; b=qoOx7/pWxwdBlTrYBNAtkO0RXT5WPtMtTjOxTuIiRKrVmgrMkjKy6Q15a/IapmovW4 glrySADlntVfW3H+mpY8yX1T+QQls7EIF5lsDks/jbRPZ16pSJdo+WD7SU6177ETjnP8 BXKRqMUwzsBrm39K6M2xPdARk9gEuXuJEFT8tfQghjl4A64yqNjeDXhEkcuLRRTF6iRs 0qGkR8SSRGVbIMgMypousn4UNEDh9c9u4yXPj0lSgp8AsU/J37/j/kJXrYK2eqn5zuOi Xj1L69HfaPre8ptgouyb6d7shRYDvbqHisdvS2aVcUbrfuvgyZ3R27X0v17WYwJW/gDL 3ncw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=8eV2vUS51UMgePfSSxCuXJhq0Gtq0aUu2F6TTcKETz0=; b=YvMRG5bTLvmK5p7yCuEKlbn9HejPOn9e0Nk9Z1jusVRSb/7pRw5X+38/IuYUo8PqLX sudSOtlckMLE8z4nlvKJygC5SFMJDbiJ4aJF2RgqQV4xrHulw8umDIk27ksLt9MWFHUS FOhs1SFQovZabl0FGCnJo4qjn3169pWuJAKe3KbL8eD1+KQxkpDPbWb8Lq9R4feAFYIa VI2lwI/794xZhwpSHQg7ZxcwPqtpBux5sf+PeHR/lFHZJBtTUpRyQDlD78uddSGCCbu0 OrdGhUoo2bkWDUQE+zJTbD0ISS2JxACIcVFeZHQIJZ6pAZMNxGZYpkE8uoE5vKbPifrH fofA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBq8bKtw; spf=pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o25sor1066075vsp.47.2019.04.18.07.26.04 for (Google Transport Security); Thu, 18 Apr 2019 07:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FBq8bKtw; spf=pass (google.com: domain of keescook@chromium.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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-Smtp-Source: APXvYqymIvWLmi/Cq4+kJDANmjOdslCYhur5PiCKHEbURU7N+/ywL2l12KaXr/8W9MCG428i9tli4w== X-Received: by 2002:a67:e451:: with SMTP id n17mr52297917vsm.35.1555597563427; Thu, 18 Apr 2019 07:26:03 -0700 (PDT) Received: from mail-vk1-f179.google.com (mail-vk1-f179.google.com. [209.85.221.179]) by smtp.gmail.com with ESMTPSA id e198sm490669vsc.3.2019.04.18.07.26.03 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Thu, 18 Apr 2019 07:26:03 -0700 (PDT) Received: by mail-vk1-f179.google.com with SMTP id h127so485951vkd.12 for ; Thu, 18 Apr 2019 07:26:03 -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" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, 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 E0629C10F14 for ; Thu, 18 Apr 2019 14:19:40 +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 AD6DB20675 for ; Thu, 18 Apr 2019 14:19:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IX62C38G"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="FBq8bKtw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD6DB20675 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:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=16nHXxF3bDpzw4O6fc3BptbBvYOJZYV3OwFjBjurRr4=; b=IX62C38GM4B5nj hjyRZLN0yOPOypaLN4dRJ+6kjKp3z2nFnQF2vYopi1Wf1LmK0Pp471WTOTvvuzritpa05788wDJZ5 gWFZJSYL5zPnrvkDrDubBborhXu8e3vJeMb9YwQjlBv25tRhj1pSXGqNMF2YRA8FgM+m29VSrJH3t tECAc468vSIB6+wsagN8UVK/8K7ubCPMmVS2sAnM4cBcmprJj94OXiJbRs01gc2RSdTIagTunRuQy 1uM4Cua0WpMlBPN9dx4/1l8ZG/jtR9WtQmIO0lQ/6FgJqYIsmXU3oKUVzAek5FWO01OGQeC005gnz 2ARbECZXqllFQ7lFM7jQ==; 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 1hH7t2-0001ar-2f; Thu, 18 Apr 2019 14:19:36 +0000 Received: from mail-vs1-xe44.google.com ([2607:f8b0:4864:20::e44]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hH7sz-0001Zu-EW for linux-arm-kernel@lists.infradead.org; Thu, 18 Apr 2019 14:19:34 +0000 Received: by mail-vs1-xe44.google.com with SMTP id d8so1181762vsp.2 for ; Thu, 18 Apr 2019 07:19:33 -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=D3YBwySsNZQssONDSbWFXLKIX6u6J/M014O+zCDmA0TqqUnf+/851zDsVYmez6yQ/j CcTcAslprQHDwWbllbQ5CbID4VmD+E9tVmCteC81d3ltEgIeFQLnT4CkjGF2Lm0LadjD bR7+h7m7lri1vSI0t0z8ZD2PeJrl521N+dh1QriF1QawOAkZNd9u4M2PPuJuiEuE2YuC GfgfRKWIVjhJBSRC6lkBIU23sOEVqx2Sm92rCkqrDCiyHaDIqIESub4tL2ZHeVs1SMQu JprK2FYs37EvQ0ozrz/RjoWJ21gVRgKI7q+ZPGlPQa5E1Yw/qP05PSHcdCjPMaJ+UE66 N3lA== X-Gm-Message-State: APjAAAW3dQHH2zetgI25DT8zV3oqz5RPFw+Cs8oPoNtR8QRMoEponb5v Rzz1XWEFJ2pP2wODsv82oyTwXkjiW8o= X-Google-Smtp-Source: APXvYqxg5hVHGjze/OOJl5YzecxlzkixnwjGXbnuEqJKB6nygtnSPOEarqNb7/vq8ixRsz5Fik4bNg== X-Received: by 2002:a67:ec44:: with SMTP id z4mr3789360vso.227.1555597172025; Thu, 18 Apr 2019 07:19:32 -0700 (PDT) Received: from mail-vk1-f178.google.com (mail-vk1-f178.google.com. [209.85.221.178]) by smtp.gmail.com with ESMTPSA id w184sm1414230vkd.0.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-f178.google.com with SMTP id x84so495871vkd.1 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190418_071933_511739_660A2589 X-CRM114-Status: GOOD ( 16.14 ) 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 , 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 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel