Message ID | 672320297f9d8860ddafbfa90933f8df7b537a5d.1671098103.git.baskov@ispras.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp328044wrn; Thu, 15 Dec 2022 04:44:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf63uGvn6aEWKU1kr3y/BgZLJ7IFqodAcd36HJ4HtAFSV+TDZxPW36wWSHhvUA/hjLkE6Vh2 X-Received: by 2002:a17:907:b689:b0:7c1:7441:57f3 with SMTP id vm9-20020a170907b68900b007c1744157f3mr13615745ejc.10.1671108251112; Thu, 15 Dec 2022 04:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671108251; cv=none; d=google.com; s=arc-20160816; b=rx09Y9C1vNx2FmrakWp/A0QD31tDeD5k1qwZ3GeOBYa5u8oMBDPdiOe95d8gcnMU5e jjXnwxPwEl75hEpg+shbHoWasXoP0Zejiqg7u9AAEuoPGgaJYSeoYl9n8CBNhoqLR6f6 28Bbkjw7bBBERgfLH9pJ9Ysh0Ai08cS3T4a5XZQH7c97iedUMwKt5wKXsAPM63JEC33o mWdY+FchI2KV89ccOmo6jsHtEJIUORdJcPBQCkfKxC9RaJdyYAjf1y628d/gRGuPz/xD tIB5/MuZ+/0eUF66j8TafJy0UOB3ObOPVcwXVYC+uTr0Y1cQWC/H2t9vD6eR1sWQAcF1 xfng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=oJrp1q8lTiiWjPIUAQspoypZPG+SdjrTnu5JNDfc4sk=; b=iC/TAXwTXkC/4BDnxMeSVKCy/pE9+gzj++BNqG/HLlyQ+KXP7B4AghmsJi6VTlSUyS Yy0RgYfmNuCffLOktXB6LMKmVsWzvK573euHi6llc65ctD1/LAHtqRHcYx4al3T4/Lcs dVnznWZ5KTadJsigau8puNJ7BNkDEgoivQn7LX/pn4UGvZ63LMf8C+CpanuW7HzLROw6 cehYknyrhVYUvcN3weLtZ+EYgiqk2br+rOQ9xM8lc3/S5kGOeKsggnMLnD/p736liKlL A7bxDjirV24+pzT0/ExjONLtZ8NNsjAnkyH3iLi7vmBbfq7qnEU5WY2orPIYqYrevSDn hXEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Qb1Arfhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tz14-20020a170907c78e00b007c1286ad884si11762518ejc.677.2022.12.15.04.43.47; Thu, 15 Dec 2022 04:44:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Qb1Arfhd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229822AbiLOMmd (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Thu, 15 Dec 2022 07:42:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229915AbiLOMl2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Dec 2022 07:41:28 -0500 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F5532F02C; Thu, 15 Dec 2022 04:40:28 -0800 (PST) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 1DFCD400CBDC; Thu, 15 Dec 2022 12:40:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 1DFCD400CBDC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1671108025; bh=oJrp1q8lTiiWjPIUAQspoypZPG+SdjrTnu5JNDfc4sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qb1Arfhd/4C5zhNb9vvUwaM+UFsgx/jGZ34fdhfGupEJX8YsLQT2QV7uhYo37qP7J NZpY79EHgMeLMqGJmx0GMO7J+9ArdTrJ96ez2lxcEdDqbLJVnNRXU2a3avnZKJSEe+ Ha8JxsNsdOlaRM2oKBopyv7u3CLntMhx7lqkmcJw= From: Evgeniy Baskov <baskov@ispras.ru> To: Ard Biesheuvel <ardb@kernel.org> Cc: Evgeniy Baskov <baskov@ispras.ru>, Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>, Dave Hansen <dave.hansen@linux.intel.com>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Alexey Khoroshilov <khoroshilov@ispras.ru>, Peter Jones <pjones@redhat.com>, "Limonciello, Mario" <mario.limonciello@amd.com>, joeyli <jlee@suse.com>, lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v4 16/26] x86/boot: Reduce lower limit of physical KASLR Date: Thu, 15 Dec 2022 15:38:07 +0300 Message-Id: <672320297f9d8860ddafbfa90933f8df7b537a5d.1671098103.git.baskov@ispras.ru> X-Mailer: git-send-email 2.37.4 In-Reply-To: <cover.1671098103.git.baskov@ispras.ru> References: <cover.1671098103.git.baskov@ispras.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752284005206840733?= X-GMAIL-MSGID: =?utf-8?q?1752284005206840733?= |
Series |
x86_64: Improvements at compressed kernel stage
|
|
Commit Message
Evgeniy Baskov
Dec. 15, 2022, 12:38 p.m. UTC
Set lower limit of physical KASLR to 64M. Previously is was set to 512M when kernel is loaded higher than that. That prevented physical KASLR from being performed on x86_32, where upper limit is also set to 512M. The limit is pretty arbitrary, and the most important is to set it above the ISA hole, i.e. higher than 16M. It was not that important before, but now kernel is not getting relocated to the lower address when booting via EFI, exposing the KASLR failures. Tested-by: Mario Limonciello <mario.limonciello@amd.com> Tested-by: Peter Jones <pjones@redhat.com> Signed-off-by: Evgeniy Baskov <baskov@ispras.ru> --- arch/x86/boot/compressed/kaslr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index c0ee116c4fa2..74d1327adbba 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -852,10 +852,10 @@ void choose_random_location(unsigned long input, /* * Low end of the randomization range should be the - * smaller of 512M or the initial kernel image + * smaller of 64M or the initial kernel image * location: */ - min_addr = min(*output, 512UL << 20); + min_addr = min(*output, 64UL << 20); /* Make sure minimum is aligned. */ min_addr = ALIGN(min_addr, CONFIG_PHYSICAL_ALIGN);