Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1607840rbb; Mon, 26 Feb 2024 15:32:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUk7fPbYJeu8vuv6+TJV9xyv9DtXBWjVn0cn5qCJwn8CrcnHbF9TTv7jjWEHIG/tpE/l/b5rWJ1j7/wtpLxw/i6z/MBGaGUBCqfKw4zjA== X-Google-Smtp-Source: AGHT+IHffOHw9dS6lF8ZLHHZ9BnBbiKx2rx3LAQgzxf+e1+yOrA69eO0wuGgxnnRe4Y1ggw/97MF X-Received: by 2002:a17:906:2b88:b0:a3f:2e6f:800e with SMTP id m8-20020a1709062b8800b00a3f2e6f800emr5355121ejg.24.1708990341713; Mon, 26 Feb 2024 15:32:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708990341; cv=pass; d=google.com; s=arc-20160816; b=RxjTFBaOZvoY1Sj7U/59rTUO12ervXvAhp+hrdV+L7mF68Krv2KaatHsrucLsBtk3p OZjILsKnmO8aIJDMUXy+FSr06wz7wU1oCkbFPyTzj8NUDLZ5xVfD9L7dshI+LdFaKrzd osuoaFcN/7raB+mz5Fhd3bSMOWm9QbKQg9YysxAnbCINLi5SF55HrjlA6wNqbD7xJRi0 eTzVU97IFDmk5UWNFoO4zvCQi2Try/wNJez8v3hcZRDzcstaYS+eDrW1EwVL66jqys5R KuOVADOBap4tqpdham6rdE9HaOy62y6BxLKKQKvVZhqCK5oAqjme3Iud52YyR32zihVm jeNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=e/+vWLgFOyGXzZvHbRQQYhnMyMxUqGESN9iHCw7s5MU=; fh=MtyaghIPPcmQSOVmXLqWYBZZ9ZCAMyWP4nQn0bnol6g=; b=EfF7XNoI1Qta8YBoJvaUEdeVKPw7Xl854J+sv3j00GHCOy7DpXvsPGt5oDTanDB2k7 n1B+GAw6O1Edo+WvfyePstVAShQGtfq9RwPstw/x3cUYPT6PQqnnJxStjRLCSqwTkiu7 0j3Z7+A+oDa7XgColmqN2W0V0K1eCjdZuW3jkB9Rx4kC9PWoCstb08u9QAY4qlvXoinK 4AsTZABijClcQBKayqCzV7kHQKtYwJ5q+A2/MuvoptieLuynq36tJRp0TOHAA2JfAOZ6 znXek/EU7cu8cCqns7k+yIxADkzJpVyOq3H1MrDxl4/5EL0Sd2X7C/gVhG1+XtkJ7jam 5PCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0UBjxsy7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82441-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id mc18-20020a170906eb5200b00a3e7199aadfsi176675ejb.513.2024.02.26.15.32.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:32:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82441-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=@linutronix.de header.s=2020 header.b=0UBjxsy7; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-82441-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82441-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 04E371F22F7B for ; Mon, 26 Feb 2024 23:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 191F8135A74; Mon, 26 Feb 2024 23:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0UBjxsy7"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wkbR+21V" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3E16A60864; Mon, 26 Feb 2024 23:31:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708990306; cv=none; b=XfTGiHp2Z/PD0m4dy+8NpdvEo5hvDn1LR9UZSx+quOYTWVYIKeqC8mLRVPz5ugHeZ8ZHtpmFBoTpmsQPFtbeG6NttcJ/n5BBItnFLG1SofxK5OoQn5izIQGJZVEpzcGn0pImwyz/QgApEfYbwyqiIa6OEfIlkfBHesG/nzO9Pxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708990306; c=relaxed/simple; bh=Uj02hhUC3ciONiJFobENSypCac+14b1YFOPPRCYYOlQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=tBETB6ST96BdOqZWFn620aO8jfUPuHy8E8GitT42H36DBsPNw0yL/Wks9CjggpAbZW94LKkSRfe9RYFXlhHi9+pCfqfBwtTK3Rwr2MW8WXMsHPHFp9nsxQ2iD5CbGig6m1psGjy6o7GCXuyMhJ/7NJ9EAJkT1dbxN1YIVsk1ZfY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0UBjxsy7; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wkbR+21V; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 26 Feb 2024 23:31:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708990302; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/+vWLgFOyGXzZvHbRQQYhnMyMxUqGESN9iHCw7s5MU=; b=0UBjxsy7MYD4DhCHeghuFlKmXEnFVl7qg09685aTjRLdVCqMxdPc/9ZDDZtNbUwWVmdBO3 xeelNLeUDSEYBYTrg/rboHdkPPVXeyBigZqkeb48e0DAl8T+CMplRLig8mjd4vuTJFa8+B TGEtwu03cWan7Yw84QEN7gXngCh3EjFxYMoqGgy/bWV1rWGP1+tF7Ds7mSPkizKfqLRpTF 4GDbwdlu5Eeo9J835AuwTTfnyjav30fBvK/pgeP95CHeB1oWHRN8GQkFWOIMlIfAz8er2e toZ8eTBBZPs54RjLMO5Q8HNV75L4GZLXCdiV/N0KaeDuR8LlIqHSD6d9qA8pZA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708990302; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e/+vWLgFOyGXzZvHbRQQYhnMyMxUqGESN9iHCw7s5MU=; b=wkbR+21Vwi8weJWoI5V+D8shkmOPlfhQjox5NUlMUc21r/szfO3Rmj9J1VVWK46suTnaWL fb+hpkyp59IPtgAw== From: "tip-bot2 for Kees Cook" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86: Increase brk randomness entropy for 64-bit systems Cc: y0un9n132@gmail.com, Kees Cook , Thomas Gleixner , Jiri Kosina , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240217062545.1631668-1-keescook@chromium.org> References: <20240217062545.1631668-1-keescook@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170899030090.398.7397849626399402025.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/core branch of tip: Commit-ID: 44c76825d6eefee9eb7ce06c38e1a6632ac7eb7d Gitweb: https://git.kernel.org/tip/44c76825d6eefee9eb7ce06c38e1a6632ac7eb7d Author: Kees Cook AuthorDate: Fri, 16 Feb 2024 22:25:43 -08:00 Committer: Thomas Gleixner CommitterDate: Tue, 27 Feb 2024 00:23:55 +01:00 x86: Increase brk randomness entropy for 64-bit systems In commit c1d171a00294 ("x86: randomize brk"), arch_randomize_brk() was defined to use a 32MB range (13 bits of entropy), but was never increased when moving to 64-bit. The default arch_randomize_brk() uses 32MB for 32-bit tasks, and 1GB (18 bits of entropy) for 64-bit tasks. Update x86_64 to match the entropy used by arm64 and other 64-bit architectures. Reported-by: y0un9n132@gmail.com Signed-off-by: Kees Cook Signed-off-by: Thomas Gleixner Acked-by: Jiri Kosina Closes: https://lore.kernel.org/linux-hardening/CA+2EKTVLvc8hDZc+2Yhwmus=dzOUG5E4gV7ayCbu0MPJTZzWkw@mail.gmail.com/ Link: https://lore.kernel.org/r/20240217062545.1631668-1-keescook@chromium.org --- arch/x86/kernel/process.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index ab49ade..45a9d49 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -1030,7 +1030,10 @@ unsigned long arch_align_stack(unsigned long sp) unsigned long arch_randomize_brk(struct mm_struct *mm) { - return randomize_page(mm->brk, 0x02000000); + if (mmap_is_ia32()) + return randomize_page(mm->brk, SZ_32M); + + return randomize_page(mm->brk, SZ_1G); } /*