Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp643095lqd; Wed, 24 Apr 2024 12:21:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV+LlPIl5Gujg0iTcWTqR7/T/gJ8EGkzz20qPnSCCIxSy5cMIzGJlbehUz9BVMEsFSdqvyw2/PhudYXxST/ggNpXr7EiWPEsvc5K0ah5w== X-Google-Smtp-Source: AGHT+IGycKKS8siwjj17YYPf8VBv8T4Y/k2J8segfThwh/JIjXCFMxbzcuE+FNLCI3blLNCMj0Ra X-Received: by 2002:a50:d61d:0:b0:56e:23e3:bdc3 with SMTP id x29-20020a50d61d000000b0056e23e3bdc3mr2269740edi.16.1713986509827; Wed, 24 Apr 2024 12:21:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713986509; cv=pass; d=google.com; s=arc-20160816; b=pv4QZTvjXMg8b26XKnpHki4b0Srm7NP2yVI16zQleVLoTccX9ycjHft0YeB5beyipg fv2Y2sE28SaaSnnz1LHaMpgyW9BF8krQm6kteEJhgmFu9gSrWEdOFPPcqwud9aYTnnAD DtoAZvZ6WDcSaEHo/JQx2JKiRZuGlW9A+8djcRVWplkFMQnE6YKjbrJm8WNAaWSj64Yv X4d31kWCPl7Yk+gbO/S+0ZKRRLqL2rMCIQvtjeC3CIFJTykEygfYvvuY4wLvfHTgPgUB FknzuSxhuH/OHmj0RYHjArmPWSZzyetbzIgFuAyS2n2qNszbsUXEMU+3TGilG9F7LknA JKkQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rNHLJopld4jqnJrZ1oiAAgxTAlpul98lFx9bY2o4kLg=; fh=IX8+sHOTC39CzTUxZSpn+YFf5QJIac66uLFmsXFxb18=; b=n+y2OFTpCfOlDi4wCXKOI+IRy6svuoPdRaoi+1JMvQhCelsIG5azP07n45VPIXeZ55 hMmIMV/KPHYTtErdyvxD9HRDLoif/yNZ4fv7+7f7NGsrwXOrIybaT67XECy7mflQI+pl Z0LipojAkymM8VDzHGJricM756rl3CcHMKQe8m0e7/gXuxP0RaDobScMSBKrZqVuaeol iHl+WsxExJk0NhFU2It3q0KaMr/LB0medu64QR/rDXyyBBcBLvaGzuu/Yo9T/jkwUSTl J3YnyEpL7kX5NP/5WoTGMlNaCrARLg8UFoaeuEqq1QOc/kL5MRIwqWdiekrypORT6oaD cnoA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Roi+baR/"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-157606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h19-20020a05640250d300b00572117f9612si3921002edb.373.2024.04.24.12.21.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 12:21:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Roi+baR/"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-157606-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8F8DE1F21750 for ; Wed, 24 Apr 2024 19:21:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F5D977A03; Wed, 24 Apr 2024 19:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Roi+baR/" Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79519757F5 for ; Wed, 24 Apr 2024 19:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713986499; cv=none; b=I8dNi+DmexoG3gyQbuxzQNm7E2rzVfAPROscXguKOXrLbtU5mDBTJ9241EuvIhVG1tKxHPn/croDsKhZ77183l5uf0n4yzMbnXMvsNmPX7ey47acz6AlGJBtu75CbVKh1dM0eO5sJgo+lqldVQm0Fsjg4qkYLx+9Dxm4I1qYSxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713986499; c=relaxed/simple; bh=tTJKTCZK+7MUJMSSp7o23DoKoVGNAUDPQk8v0lL9B64=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XDCXOZ3G3FWWQIL/vx44uVUQdqBEliFFibM1uXFsNgpi16JSIDZlEWXXEkUdafIw2qmjThM9d/VjfrST8ODScC/Jn2UEDX7pqrIiHFtHUl5dfPh2aOhPnpR7zTZf7jLLaRJC1DT6g4tx+y9icO3YjDpLmp2xDzKCtYd4RgSXXJw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=Roi+baR/; arc=none smtp.client-ip=209.85.210.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6eb658ca1ceso170840a34.2 for ; Wed, 24 Apr 2024 12:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713986497; x=1714591297; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rNHLJopld4jqnJrZ1oiAAgxTAlpul98lFx9bY2o4kLg=; b=Roi+baR/9NehB/DEa7wTeBDHVdkwYBUdQYGWKE5QRbrth+AMF2nWrsHrwAOPUtMjN6 dEV4o6+6Z08gitDVs6x8SErCBK0EEn7JB7nS296WtxFqv7bnukDlnUAbMCzG0P2YHNTt tj92DpS9LgbMAGdRbsioaSu2w9rlMenjpHbjE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713986497; x=1714591297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rNHLJopld4jqnJrZ1oiAAgxTAlpul98lFx9bY2o4kLg=; b=os4M+KiAx/NPgDJEPKjl+h2J0dFUVipINugYHwawZUKfRreRS6eyTZBGVRHRGr9fDZ ydW7lmZ1NDzie7uJBbqMwvJkWjeLnLJwVSD5M8r6hlmNTZCaYj4xbXU6TvTa59gAbAGR g+mzrh6gbpBDjPAbm3b/pFUjIv1Q6hXeBZD4FG28K7NXtJBSAr9lDLXqZ9DEQxFsKecB Sc2QroPG9Qyw01Ur+RIefLJcubtguG98ubGVtshlHoVhkQEWOCsNCtK9yJIxpExalr1F dM13N9n+N1II7qFqYc8n48nPUURhW+fh7hqiGQ3MoFaJoTAe6DC9Fqj2IDYHx2E/eJO5 GyZQ== X-Forwarded-Encrypted: i=1; AJvYcCU952bcni2G8UxMgTExisa43uO/iiNvmbLZXddLoD0v6576ty1g3EGNvlnpP/6Qy3a12qY5yn72S6Dp5x+L5EvEEsLyCHFUqM7U54MA X-Gm-Message-State: AOJu0Yzxi906nQsnYK1uhU+P8UmndtnHWlNmxa7fIL2zY6E63SXw/RBq Qi02oYHIv0J3LnVPi7KcIMWePu+ZQUIz6yuP+EJIS9/KeaLYiDR3aNUN2dT+bw== X-Received: by 2002:a05:6830:1d6f:b0:6eb:7685:b00 with SMTP id l15-20020a0568301d6f00b006eb76850b00mr4093982oti.28.1713986497681; Wed, 24 Apr 2024 12:21:37 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id l26-20020a65681a000000b00606506a95bbsm1425110pgt.13.2024.04.24.12.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 12:21:37 -0700 (PDT) From: Kees Cook To: Jiri Kosina , Kees Cook Cc: y0un9n132@gmail.com, Geert Uytterhoeven , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Christophe Leroy , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Peter Zijlstra , Qi Zheng , Alexandre Ghiti , Josh Poimboeuf , "Kirill A. Shutemov" , Rick Edgecombe , Brian Gerst , Bjorn Helgaas , Tony Battersby , linux-kernel@vger.kernel.org, x86@kernel.org, linux-hardening@vger.kernel.org Subject: Re: (subset) [PATCH 2/2] binfmt_elf: Leave a gap between .bss and brk Date: Wed, 24 Apr 2024 12:20:58 -0700 Message-Id: <171398645483.3089364.2691527690120638755.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240217062545.1631668-2-keescook@chromium.org> References: <20240217062035.work.493-kees@kernel.org> <20240217062545.1631668-2-keescook@chromium.org> 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: 8bit On Fri, 16 Feb 2024 22:25:44 -0800, Kees Cook wrote: > Currently the brk starts its randomization immediately after .bss, > which means there is a chance that when the random offset is 0, linear > overflows from .bss can reach into the brk area. Leave at least a single > page gap between .bss and brk (when it has not already been explicitly > relocated into the mmap range). > > > [...] Patch 1/2 was already applied via x86 tip, so I'll grab this one for the execve/binfmt tree. Applied to for-next/execve. [2/2] binfmt_elf: Leave a gap between .bss and brk https://git.kernel.org/kees/c/2a5eb9995528 Take care, -- Kees Cook