From patchwork Sat Feb 17 06:25:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13561256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5B3EC48BF6 for ; Sat, 17 Feb 2024 06:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A4CE6B0071; Sat, 17 Feb 2024 01:25:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 45BB66B007D; Sat, 17 Feb 2024 01:25:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3231B6B0081; Sat, 17 Feb 2024 01:25:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 21E5F6B007B for ; Sat, 17 Feb 2024 01:25:52 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id B6D17C0146 for ; Sat, 17 Feb 2024 06:25:51 +0000 (UTC) X-FDA: 81800310102.15.5010A4B Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf17.hostedemail.com (Postfix) with ESMTP id 1627140010 for ; Sat, 17 Feb 2024 06:25:48 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=BLKeN4Zx; spf=pass (imf17.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708151149; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=cWt8teqLAwEcY7rEsFaKXXpAOKx8kXlOD34XjezwzT8=; b=D6viR0siY0sgD7UOQuSha0iMP+xRfud+fIGEKi8fPJOXRpLNaXp/i5iKLcbxuy+fByqxq8 9XbhRK9ER6dNG3RiQ3Wr4E67QtMzv7t+ILts6Oa+fQMTI2iI10md6tMIM13KFBWrds+mKy PyWVhb/oZiYYuoRD1FPyshsvnFhBG7E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708151149; a=rsa-sha256; cv=none; b=mF2nyLJjG6b5oDclzwJBSGupZNHpF3u3R7vhylk6L0OaewRj9QelUGXjEQV2F4RszJA9IN LF/6hgSFgMoqdaN13A3BSVU2quOOMNQ2/L29LnvR+MuATdp2ytKhEyhnrpsCiD/0SpNo4t 9Cr2tR6Iw53lxQqaUfOid71yizp5Vac= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=BLKeN4Zx; spf=pass (imf17.hostedemail.com: domain of keescook@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1db562438e0so25022945ad.3 for ; Fri, 16 Feb 2024 22:25:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708151148; x=1708755948; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cWt8teqLAwEcY7rEsFaKXXpAOKx8kXlOD34XjezwzT8=; b=BLKeN4Zx8Ip7ulX++FqO7QzxOimJqpaHJiqOjZIw/ko7EMqdYL4QPcKn5gDA5BZXgY HkQv7sFfiQZBiNHNuLt0ODm4QUopkBGJCFG6oVm6XQEGmYglAFRVSiq9lAsDxynbx25l YlcIMgjBliZ9uIzzCr/1kuKmGTX9XrNx+nSMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708151148; x=1708755948; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cWt8teqLAwEcY7rEsFaKXXpAOKx8kXlOD34XjezwzT8=; b=l+ee4RF9zWoZt28IFgNJEPOOAMWvLnamRJFnbrQVp/1vE35iZfHJFaR0/9XXr6mkYf 1DMrqvb9fWSzvMTksxGwRbTaYWxgpTpoSAsQT7bkYilV7vjNHjuJBDbXdDZ9cDtEMbzi uWHRqLGwKBkE0z/h5w51MJiqyfY1cSrWojWtODRVuDOr7+jpqJgh4A2DIsctwzMsvgcE Y3llgywlEaKt3maNnJ2PfyglynLhtOLku2TZ1VBJgG6g0QR0c8qV596Y+A1B5vqOciFd RGwHasGA4dLIOWLd/B93V67tzVwFp9C3aEKM2Lmkky4Qz3/kE5CjAujueshlGsC/AZ0s UIdg== X-Forwarded-Encrypted: i=1; AJvYcCXyqFxrud7tcwRIHBn1JaBP0n2GziXJM70n31Rh1FFYRh3An8+lO6dekSX/2Fnmzs0G8YfQyhLBCdYIBXvR53YixH4= X-Gm-Message-State: AOJu0YyzsTNobxFE6hQc5M+9KpQDx/pIHlOywm59KvuF9lNyg3JXHUui nlCsGXJSxrvV3d3ac5FZrBOGO0SB3pEgDFoFEQ20xAx7+0isMCIh2GuP+5eNYg== X-Google-Smtp-Source: AGHT+IGOco9kGEkPlMYnz+xDhiK21QtcC3JoFPrjYqWqfD55D6hFKMHNyr0snN/tw6RCI6JofemA9A== X-Received: by 2002:a17:902:bd84:b0:1d8:cc30:bb18 with SMTP id q4-20020a170902bd8400b001d8cc30bb18mr6427467pls.52.1708151147993; Fri, 16 Feb 2024 22:25:47 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id kv5-20020a17090328c500b001db5fc51d71sm784311plb.160.2024.02.16.22.25.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 22:25:46 -0800 (PST) From: Kees Cook To: Jiri Kosina Cc: Kees Cook , Geert Uytterhoeven , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , 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: [PATCH 0/2] Adjust brk randomness Date: Fri, 16 Feb 2024 22:25:42 -0800 Message-Id: <20240217062035.work.493-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=656; i=keescook@chromium.org; h=from:subject:message-id; bh=0rdN5Ywql8YEUys9LVJTJWHqvzfAzwrX+79MyzxBI4I=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBl0FFo0XJ9PWurSkP5cp5jRezJ7UeZ+6fL+o1Sb VdG6+/Tu2yJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZdBRaAAKCRCJcvTf3G3A Jj2JEACkIrsCN/yzegtBO6Y04l+D7EWAUVXo9GIO/a66vCghjrqM320G2Rf3cSgbANwx9VKnkwK KBj4N8PVQVj3GJ05FrqXoxkez9znAutsnPUfw7kQXGgcL6xYIjeKz7r62SSSaxKDLh5cgVNWcZo +Ep3MbA3WO6RrC92yZD84DC347/oOWWo/xA99yrJX5NCB6XwoclZbdIG2340YJASly+ktJr1W3C NL7NImsV7wc13qqwwVd2Z4zOSLwLipvZriRFOxLicz5e4DSAEI7H2hz8DNq7XdgPVAMpYNwPEHH wpssXTFJaqzq/DpH/mPRMmE3099smsh7qmxWil1VovFC4dOpd2z2S13vXbDCjCIYRDmfDsKX+Q+ 3GPKJNPuyI5Jg7bMh/T7Tr3VqFCXVN9ekjXpq7Csdckcaq2xEto9jVoUFVu0Zlp2l88LQZrWL8e +xIRxU+bYIltyH9cQ8rZbIcrwp3biDynk471VrN+PAo0ct8Lr2f7PbpIy4qFsJsVwAKzitf/owv 8Jux/+A4BtuL7WqTwI15JobtzRnwiKX6CvnGLD7jQ2ohTK8yem2G9HL1Gj8o3bAdsNe/FMJIBWg sIzUHxU2yjSewmhJMcV4PwI/Y+z3nUS02eQ1w/OlDvEpU2XfaqsD+NEPKKhcVbkrhZSHRO571dp 8sfZ11TG 1uahJAA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 X-Rspamd-Queue-Id: 1627140010 X-Rspam-User: X-Stat-Signature: 1ukaec61b78jsb8g9yy7e9to1kpugqa4 X-Rspamd-Server: rspam03 X-HE-Tag: 1708151148-744203 X-HE-Meta: U2FsdGVkX18o234uPHOcloLQQZuuEV3Da3GvYmWL39K+O8FI/xy5akzxCHdhIG8/rDznPowhdZw7aVrLZO70UWHPpoeBUR6mSmN1MElPDZaqmMbiujw5iFdOxjfcfytgW7cxP/8KWfF4pwgx2uBxhOqJM2z4ypmgdmhbRAscd/v7EhAjnao0/MmhEkcSo6mWddpRkQuxqKFmVqmw2qp2CE8N/Xkkr8rLvCtTSryU55BI6tBJFxX7lpFDPjDTc0r24GNN3vyOtFgpbzkMdzaf++S2kgD9gGFTWrfJYBkD/WQy67qT+kvgdCUELoeC4DVXoCb8HR/G/sO6uAAgp+Oos61Km3QmvzOFiLaFCwfKQuvM7mz0/EyKlvUJkzqfo3MrBxDAMeCBFCjRwj8xmdzKE7FIKGMfjJQMNRPAnFC8nW/rDmCQIuXinmUDLDhwfzg4U3DBVF2xiUwghNyVFooSyr+m2ASRvxG0ryqxAENGo2biftO4jFm8BHwJeImtednhBDIbxIgw0AYTf4g4D6xkk/TGXY6ykdKdawYhRyx06YTJs9+mg9fjCpccl0B+hqSgK6LCYEGF3j5/xYdO8GTHW2jcJUmVxz2Y8gXbWGhh/kEO17XhiJRgvhQr7hdsoorFsRsspYe7+2MtzH96fwKm/rgA2yXvAsLScA4+nzXg9nxuyBNKmlaYv941fcLokwsIucjxDWyT8chK2VI+CoHRnXnlNbNRfObHOYXmo/4kxvayW25RZKGu0cJWiOMSY2BuWXajobsN3JFSN/wx4cdZfa1hMBv0KjU88JmLpqdNbaALfnnoAFTrolK1pd14wfOYIGF11jbdOQZYYJG+0yKosqsB6weKl5BN9lFs8mh/h5Ou+OuN1X6dK2P3Fj2UWcXRcqFf1xVcELWPN9WvKZKYa+s6BNYCwxFiIMz1dMiUj5i2Nk7Fg7GGFynhcdOwvHnApCTej6L5/GI4fXZ+K// s2fo6b/O F0F0TWrTCi6DLC2tkuYzbibFmqYfzm5Rsix1R0zmIFQ287TSXxaR56SvAKgSRZTl54CJxNuz/u7pDhfwSbpjR0u7pvWRNxVjc8ttGuMpIomZYgFSeCzl7DNiaBg== 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: List-Subscribe: List-Unsubscribe: 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 .bss, leaving no gap that could stop linear overflows from the .bss. Address both issues. -Kees Link: https://lore.kernel.org/linux-hardening/CA+2EKTVLvc8hDZc+2Yhwmus=dzOUG5E4gV7ayCbu0MPJTZzWkw@mail.gmail.com [1] Kees Cook (2): x86: Increase brk randomness entropy on x86_64 binfmt_elf: Leave a gap between .bss and brk arch/x86/kernel/process.c | 5 ++++- fs/binfmt_elf.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)