Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp438149rdb; Sat, 17 Feb 2024 16:27:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo8FeYkY8UswqiKAFr2/wN9Y7g8mOELfBv8+pNoNk0iFU4m7fyWqJURwUWMaLxYIqjW4L0MCMQ3cKGS63luexHS6PggTV8kSusG7xUkQ== X-Google-Smtp-Source: AGHT+IG9YmgimAO2flr9gkivUAJzyzoGktRAFEfqM/DNBsq80XYKl+yxN8A15rUNHchcKnr7ps9m X-Received: by 2002:a62:cd49:0:b0:6e0:7f22:81bd with SMTP id o70-20020a62cd49000000b006e07f2281bdmr9649751pfg.20.1708216053126; Sat, 17 Feb 2024 16:27:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708216053; cv=pass; d=google.com; s=arc-20160816; b=c949YPwW51zzggu4+gOyrL1Rzth+LGVeSenlxEvfR5CbPol+QWthnJMDpemWaxeOyk qNicw+9MZaiGtB2ZYHo+NG8cM/cGsm0B/WEtwjL0zuhisOHUQyXenQfXaYt9Ua5TaA/t yNt3HE5h+YokDiETty7QbTpLy3yAIXTcfFE/Qkgs1ligO/JCpJTqBPAlr0tFI0G6i+cq qougUzl4OzB3eRZL++fqOFYWMjpAabXK7NiYQdjmTeDsEvafrwRv+P794Ihu81mhde5Z N8s7T6hjoVynwOp2GebebWy/PrIA2Wc3OgZcQ/jbcxjXVPwEukcsGA4Dpom9RkzfcPan RlVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=Wz3l09giQfTSL1YwWsrN6DHEZxbftRXxZ+FPELlf150=; fh=ZPdPvnv+WdLfThPDPE3YVh1RInxUZNkQL2smcJ28ajk=; b=ckZiYW8olRht9MwIwn12Y7povUaewrxz/1Vtnrr2VKjy0dn2tD+LO/SVdvo3ht5ZR2 1hA45gXLPx8ttSOnwyZFlmckyAHtI3Zqw+KPqvaO/8+0ASvv6yjwfQkVhgyp7IeidA5q 8G2az4H+jT/lDlO//9pxzDr5Km1kOghDXoa1CCwjURve0W5IUNMruwlHKbBbR2ywP7hX CL7YUdSJHVpCjoeAWJdfmAw02c4ABYcrb2Kx2L3kGNyXgsSfRglxJ36amCdApeyPP+Fw r3aa4ddHzmCPWvtmBraOogVsyZ0Z9nDvoFbqjSu3N3Rba0Itjl9AbSpWVyIxkx0bHGId D1Uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024021201 header.b="Kbh/cWTs"; arc=pass (i=1 spf=pass spfdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-70123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id bx25-20020a056a00429900b006e0e693c86esi2185117pfb.188.2024.02.17.16.27.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 16:27:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024021201 header.b="Kbh/cWTs"; arc=pass (i=1 spf=pass spfdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-70123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AD2E92832E2 for ; Sun, 18 Feb 2024 00:27:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65B7DA23; Sun, 18 Feb 2024 00:27:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b="Kbh/cWTs" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1807360; Sun, 18 Feb 2024 00:27:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708216043; cv=none; b=nXysO1GsTc3Nl5sh52nrT3XNO3FfIaLyi7CpoUfG6dmxgTpj1KLC7JPG6ItzYkexvxwMJyPtw4fJRON2kyxW5Kv6P67nv0oN5I2wKT7j4cDEa14zJXh1vhDERK+APRrKC5U+c5c1vW70atieMfgcQjLQwnpOIFRyKJxfyIeW6C4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708216043; c=relaxed/simple; bh=h79Z3lIxbgbvpeJtKMFZwIkXBVN34m+I9WFzuU0RpPg=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=fdj9bMUrHLlNPHiz/lEhRmI/5TwpMbmJgUuYG9aJpsM3JVbcXO63E3cuOL84dInNl2PCV2wHI2saCnvt3ocd/8CwA/OR4/j7wJBurw+Og3GnL6KhoLFWiqYQtkyqMrr+nVvhNzEe+a4YjJM1c8EpkqyetjAMaUQWKiq4Z9ktAYI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=fail (0-bit key) header.d=zytor.com header.i=@zytor.com header.b=Kbh/cWTs reason="key not found in DNS"; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [127.0.0.1] ([76.133.66.138]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 41I0PcJe2642444 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Sat, 17 Feb 2024 16:25:39 -0800 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 41I0PcJe2642444 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024021201; t=1708215944; bh=Wz3l09giQfTSL1YwWsrN6DHEZxbftRXxZ+FPELlf150=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=Kbh/cWTs4TZxrYFDQ9PGa9IsSYuA1vHWzgIsTR0kvi4sW/bys585nuFqikL0TP5gm HKIVOVqbT7JBgMSPQTIwCyqhkiwtXimEAmjOXHjR+2553XQJaMLSzYstWWUWnS4bKN dQOpwm5HzNuMPAIWbCXZ1VCkmdcz6uzIgYOMlj5+Cn11b+VeVfNQY6lnCMeyDdLuuS Ye2WBh6HLbJT67nCtUY3geuu7PCBMFHE/c0FI1Bv7dC7naHq0HkUbcVGJabT880svv Wr8a2dA16Nlv2/Q86qDi2U+JKHTIgZbdXPgEurZBZy98nZMptUmWwHxqFcf1ctQEKg 2lKStlO9LtM6A== Date: Sat, 17 Feb 2024 16:25:33 -0800 From: "H. Peter Anvin" To: Kees Cook , Jiri Kosina CC: Geert Uytterhoeven , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Peter Zijlstra , Qi Zheng , Alexandre Ghiti , Al Viro , Christian Brauner , Jan Kara , Eric Biederman , Christophe Leroy , Josh Poimboeuf , "Kirill A. Shutemov" , Rick Edgecombe , Brian Gerst , Bjorn Helgaas , Tony Battersby , linux-kernel@vger.kernel.org, y0un9n132@gmail.com, x86@kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/2] Adjust brk randomness User-Agent: K-9 Mail for Android In-Reply-To: <20240217062035.work.493-kees@kernel.org> References: <20240217062035.work.493-kees@kernel.org> Message-ID: <05E12A71-D8A4-4E6D-9C9D-024251C1BDC7@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On February 16, 2024 10:25:42 PM PST, Kees Cook w= rote: >Hi, > >It was recently pointed out[1] that x86_64 brk entropy was not great, >and that on all architectures the brk can (when the random offset is 0) >be immediately adjacent to =2Ebss, leaving no gap that could stop linear >overflows from the =2Ebss=2E Address both issues=2E > >-Kees > >Link: https://lore=2Ekernel=2Eorg/linux-hardening/CA+2EKTVLvc8hDZc+2Yhwmu= s=3DdzOUG5E4gV7ayCbu0MPJTZzWkw@mail=2Egmail=2Ecom [1] > >Kees Cook (2): > x86: Increase brk randomness entropy on x86_64 > binfmt_elf: Leave a gap between =2Ebss and brk > > arch/x86/kernel/process=2Ec | 5 ++++- > fs/binfmt_elf=2Ec | 3 +++ > 2 files changed, 7 insertions(+), 1 deletion(-) > Why do we even have the brk, or perhaps more importantly, why do we use it= ? Is there any reason whatsoever why glibc uses brk instead of mmap to her = heap memory? I thought the base of the brk wasn't even known to userspace other than in= the form of the image end=2E=2E=2E