[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86/kexec: Fix kexec-reboot with CET active
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Wed, 30 Mar 2022 11:00:21 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wPREeCdMwfWN/OrzsJ9qkfGJrGjv9HyfQxfvelFs0hM=; b=I6p1dYLuHu1fP9V4jg+j/BZ+8yaVTjqnD5UmESK2J/CGokbqPqG42pe/cl0IHTS537RsLZtGujPFqEtxbX0z5iXsBQsdOTpNXHNOUaw9Jv2Lb4nrqyYx/rivM4Lhj4JLYjA4c4QINgtT1PpWAiRBlGdy6v4a7QUcM5AP2s6L9wZsB4MKoaYmMtwa3JwXycQBuG1509L7dCbMJtGg3R5AsUmN9cHAo+m+IrVpxAlyc897myg8s+sUMWJYHWc3Vw0zhBm4uSci6k8rM10EXoeXHgx9FDC9VoflWEkjAkxrSltLteE49v9Sl+zMCQdynY4+pbfxqojAiw2yRTVqtteZDQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RtbnwHJNi/DIiYVkRf4DD6RZru+YJl6G2t1AFUVtPEL8lNly4kwiZNeNWwGH8E60kdv3orqq6QNLDZjkJUv9EZuhUYUa0EkHh/cFCm7ndiXaE4LciuASohhTMb/p/oz+r18Haig2GA+MSgn5PgOVimXbGWs8p27YGda2PFGabRJsGlZXDcSVNEksSm2bNYk7ItchoQwXg4uo+OoKsV2p4NP+gnjlymEEyr0ALZ/oGFCCk1pfXO4cF896vFFBkMso79EhkgiKPom5jaAETJS4cTjKRYp+fiJuekbHxEc/G9UFIwdGMcMzCQTey/xxcBg4RQrcZoYdX2EAkWrvwkw5dA==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 30 Mar 2022 09:00:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 07.03.2022 21:53, Andrew Cooper wrote:
> --- a/xen/arch/x86/machine_kexec.c
> +++ b/xen/arch/x86/machine_kexec.c
> @@ -156,6 +156,16 @@ void machine_kexec(struct kexec_image *image)
> */
> local_irq_disable();
>
> + /* Reset CPUID masking and faulting to the host's default. */
> + ctxt_switch_levelling(NULL);
> +
> + /* Disable CET. */
> + if ( read_cr4() & X86_CR4_CET )
> + {
> + wrmsrl(MSR_S_CET, 0);
> + write_cr4(read_cr4() & ~X86_CR4_CET);
> + }
It just occurred to me: Isn't using read_cr4() here somewhat risky?
If we crashed on the CR4 write in write_cr4(), we'd try to load CR4
here again with a value which may cause another fault.
Jan
|