lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <SN6PR2101MB1693B87627474E6541A5E1B2D7089@SN6PR2101MB1693.namprd21.prod.outlook.com>
Date:   Sat, 19 Nov 2022 05:37:56 +0000
From:   "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
To:     Sasha Levin <sashal@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>,
        Anirudh Rayabharam <anrayabh@...ux.microsoft.com>,
        Wei Liu <wei.liu@...nel.org>
CC:     "mingo@...hat.com" <mingo@...hat.com>,
        KY Srinivasan <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Dexuan Cui <decui@...rosoft.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "bp@...en8.de" <bp@...en8.de>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH AUTOSEL 6.0 14/44] x86/hyperv: fix invalid writes to MSRs
 during root partition kexec

From: Sasha Levin <sashal@...nel.org> Sent: Friday, November 18, 2022 6:11 PM
> 
> From: Anirudh Rayabharam <anrayabh@...ux.microsoft.com>
> 
> [ Upstream commit 2982635a0b3d08d6fee2ff05632206286df0e703 ]
> 
> hyperv_cleanup resets the hypercall page by setting the MSR to 0. However,
> the root partition is not allowed to write to the GPA bits of the MSR.
> Instead, it uses the hypercall page provided by the MSR. Similar is the
> case with the reference TSC MSR.
> 
> Clear only the enable bit instead of zeroing the entire MSR to make
> the code valid for root partition too.
> 
> Signed-off-by: Anirudh Rayabharam <anrayabh@...ux.microsoft.com>
> Reviewed-by: Michael Kelley <mikelley@...rosoft.com>
> Link: https://lore.kernel.org/all/20221027095729.1676394-3-anrayabh@linux.microsoft.com/
> Signed-off-by: Wei Liu <wei.liu@...nel.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>

Same with this one -- no stable backports are needed as the patch is
more about enabling a new scenario than fixing a bug.  Again, Wei Liu or
Anirudh should confirm.

Michael

> ---
>  arch/x86/hyperv/hv_init.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 3de6d8b53367..10186bd6d67e 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -537,6 +537,7 @@ void __init hyperv_init(void)
>  void hyperv_cleanup(void)
>  {
>  	union hv_x64_msr_hypercall_contents hypercall_msr;
> +	union hv_reference_tsc_msr tsc_msr;
> 
>  	unregister_syscore_ops(&hv_syscore_ops);
> 
> @@ -552,12 +553,14 @@ void hyperv_cleanup(void)
>  	hv_hypercall_pg = NULL;
> 
>  	/* Reset the hypercall page */
> -	hypercall_msr.as_uint64 = 0;
> -	wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
> +	hypercall_msr.as_uint64 = hv_get_register(HV_X64_MSR_HYPERCALL);
> +	hypercall_msr.enable = 0;
> +	hv_set_register(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
> 
>  	/* Reset the TSC page */
> -	hypercall_msr.as_uint64 = 0;
> -	wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
> +	tsc_msr.as_uint64 = hv_get_register(HV_X64_MSR_REFERENCE_TSC);
> +	tsc_msr.enable = 0;
> +	hv_set_register(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64);
>  }
> 
>  void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die)
> --
> 2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ