Message ID | 7286289c51a932f804a694bd7f605e70160534ea.1666705333.git.baskov@ispras.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1032073wru; Tue, 25 Oct 2022 07:13:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YIohQJHYQr+g8d5nKoGd99kHaIYpSqmSPUm6Mwycd661E/eWQhrtr2jyUU8QHjlZC3oEN X-Received: by 2002:a17:902:f78c:b0:17a:ef1:e902 with SMTP id q12-20020a170902f78c00b0017a0ef1e902mr38449968pln.5.1666707222671; Tue, 25 Oct 2022 07:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666707222; cv=none; d=google.com; s=arc-20160816; b=CVIYrI2s0mep0CvejUvKNZD52NqPCTT5doUvUVQANB0FWXJd5lWZNA2tQjz6uPDx4g 5OBCBnm6DLUih5deV63nNrvnN7LTz4yQiNY+9W/twdCitpKWucxl0YwXQw06C62mVy0u /uMHSpsiqcxbr0EkhR1760OxZ9xJjMB2zSaow4JKHbiMKj89zVgvmZfsZ3IWREP4WVYA OymRoKQzUeNzV3jV7PaiCY66JMeB/gxWkUGdWKcwIeUZYQHpgTmroi455vJnUT48NOo/ U8TkjwS19BNj9Vw8ZjTTzF/h8uZsUBhU0CAwetBkp/RiQmCE7ZwHVDwm0ydraJYIIvlF J6iQ== 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=GUsxEZYsjagqsnIlo2HdS3ccrH9SY23SsZJ1t0JcDlI=; b=fMxYItgpauH/Jx4s3bWiSax4MVcw49/VpLJ6MIRyHcrgqL8D7/MOmC/ZShQfMswdWb 4asZngU13hrr4nhyQPl0NuLuKPYtp69o+S9JtM8AJeuIRAZ0f1ZzPgiDJsFW19DzDKv7 W3PRm/VEuYcY/E7UfuQTSQcgP622Ct4yypEfba+FAQJYDjlTvKErP8lhRJGseTw/kdQd pW4sm7da2m74c3IIBs3o+ofA/4wYWocIGAg6oGoqYHafZv5v67APRo+nYa16/u66Bk6P swopJVFhWRwpjgxHvccERl2AXZ8OxH7OJUtRpsrG4zXqVUYW+bfQyql907gC2TPtwETU OiXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=X6dhjPzA; 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 v24-20020a631518000000b0046eb96c940dsi3276712pgl.752.2022.10.25.07.13.28; Tue, 25 Oct 2022 07:13:42 -0700 (PDT) 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=X6dhjPzA; 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 S232960AbiJYONW (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Tue, 25 Oct 2022 10:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbiJYONU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Oct 2022 10:13:20 -0400 Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B1D9C23B; Tue, 25 Oct 2022 07:13:19 -0700 (PDT) Received: from localhost.localdomain (unknown [83.149.199.65]) by mail.ispras.ru (Postfix) with ESMTPSA id 4B05C419E9CE; Tue, 25 Oct 2022 14:13:16 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 4B05C419E9CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1666707196; bh=GUsxEZYsjagqsnIlo2HdS3ccrH9SY23SsZJ1t0JcDlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X6dhjPzAU9dm7k8w7yB3bDXecalPdxUvRW9oxgirXw/MoH9p4cYkOshbLwILP4S3S gGLz/3JOL9dT3NS1Hv/HlnNmY23Vxp0kBbVYEmD5A7NIlIwMyz7/rA7hF98msrbbae 3FCD2JmOLln5/XJA2ujE1bKt7wXznWndmBj7PQ2g= 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>, lvc-project@linuxtesting.org, x86@kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v2 03/23] x86/boot: Set cr0 to known state in trampoline Date: Tue, 25 Oct 2022 17:12:41 +0300 Message-Id: <7286289c51a932f804a694bd7f605e70160534ea.1666705333.git.baskov@ispras.ru> X-Mailer: git-send-email 2.37.4 In-Reply-To: <cover.1666705333.git.baskov@ispras.ru> References: <cover.1666705333.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, URIBL_BLOCKED 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?1747669192815940713?= X-GMAIL-MSGID: =?utf-8?q?1747669192815940713?= |
Series |
x86_64: Improvements at compressed kernel stage
|
|
Commit Message
Evgeniy Baskov
Oct. 25, 2022, 2:12 p.m. UTC
Ensure WP bit to be set to prevent boot code from writing to
non-writable memory pages.
Signed-off-by: Evgeniy Baskov <baskov@ispras.ru>
---
arch/x86/boot/compressed/head_64.S | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index d33f060900d2..2a4372b84fc8 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -684,9 +684,8 @@ SYM_CODE_START(trampoline_32bit_src) pushl $__KERNEL_CS pushl %eax - /* Enable paging again. */ - movl %cr0, %eax - btsl $X86_CR0_PG_BIT, %eax + /* Enable paging and set CR0 to known state (this also sets WP flag) */ + movl $CR0_STATE, %eax movl %eax, %cr0 lret