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: <BY2PR0301MB165451C8401EDD75A38C6488A02C0@BY2PR0301MB1654.namprd03.prod.outlook.com>
Date:	Mon, 2 Nov 2015 19:42:38 +0000
From:	KY Srinivasan <kys@...rosoft.com>
To:	"Denis V. Lunev" <den@...nvz.org>
CC:	"rkagan@...tuozzo.com" <rkagan@...tuozzo.com>,
	"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"Andrey Smetanin" <asmetanin@...tuozzo.com>,
	Haiyang Zhang <haiyangz@...rosoft.com>,
	Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: RE: [PATCH 1/1] drivers/hv: correct tsc page sequence invalid value



> -----Original Message-----
> From: Denis V. Lunev [mailto:den@...nvz.org]
> Sent: Monday, November 2, 2015 3:34 AM
> Cc: rkagan@...tuozzo.com; devel@...uxdriverproject.org; linux-
> kernel@...r.kernel.org; Andrey Smetanin <asmetanin@...tuozzo.com>; KY
> Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> <haiyangz@...rosoft.com>; Vitaly Kuznetsov <vkuznets@...hat.com>;
> Denis V. Lunev <den@...nvz.org>
> Subject: [PATCH 1/1] drivers/hv: correct tsc page sequence invalid value
> 
> From: Andrey Smetanin <asmetanin@...tuozzo.com>
> 
> Hypervisor Top Level Functional Specification v3/4 says
> that TSC page sequence value = -1(0xFFFFFFFF) is used to
> indicate that TSC page no longer reliable source of reference
> timer. Unfortunately, we found that Windows Hyper-V guest
> side implementation uses sequence value = 0 to indicate
> that Tsc page no longer valid. This is clearly visible
> inside Windows 2012R2 ntoskrnl.exe HvlGetReferenceTime()
> function dissassembly:
> 
> HvlGetReferenceTime proc near
>                  xchg    ax, ax
> loc_1401C3132:
>                  mov     rax, cs:HvlpReferenceTscPage
>                  mov     r9d, [rax]
>                  test    r9d, r9d
>                  jz      short loc_1401C3176
>                  rdtsc
>                  mov     rcx, cs:HvlpReferenceTscPage
>                  shl     rdx, 20h
>                  or      rdx, rax
>                  mov     rax, [rcx+8]
>                  mov     rcx, cs:HvlpReferenceTscPage
>                  mov     r8, [rcx+10h]
>                  mul     rdx
>                  mov     rax, cs:HvlpReferenceTscPage
>                  add     rdx, r8
>                  mov     ecx, [rax]
>                  cmp     ecx, r9d
>                  jnz     short loc_1401C3132
>                  jmp     short loc_1401C3184
> loc_1401C3176:
>                  mov     ecx, 40000020h
>                  rdmsr
>                  shl     rdx, 20h
>                  or      rdx, rax
> loc_1401C3184:
>                  mov     rax, rdx
>                  retn
> HvlGetReferenceTime endp
> 
> This patch aligns Tsc page invalid sequence value with
> Windows Hyper-V guest implementation which is more
> compatible with both Hyper-V hypervisor and KVM hypervisor.
> 
> Signed-off-by: Andrey Smetanin <asmetanin@...tuozzo.com>
> CC: "K. Y. Srinivasan" <kys@...rosoft.com>
Thanks Andrey; the Hyper-V team will be updating the Hyper-V documentation.

Acked-by: K. Y. Srinivasan <kys@...rosoft.com>

Regards,

K. Y

> CC: Haiyang Zhang <haiyangz@...rosoft.com>
> CC: Vitaly Kuznetsov <vkuznets@...hat.com>
> 
> TARGET: Microsoft Hyper-V Linux guest drivers
> Signed-off-by: Denis V. Lunev <den@...nvz.org>
> ---
>  drivers/hv/hv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 6341be8..68d0701 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -139,7 +139,7 @@ static cycle_t read_hv_clock_tsc(struct clocksource
> *arg)
>  	cycle_t current_tick;
>  	struct ms_hyperv_tsc_page *tsc_pg = hv_context.tsc_page;
> 
> -	if (tsc_pg->tsc_sequence != -1) {
> +	if (tsc_pg->tsc_sequence != 0) {
>  		/*
>  		 * Use the tsc page to compute the value.
>  		 */
> @@ -161,7 +161,7 @@ static cycle_t read_hv_clock_tsc(struct clocksource
> *arg)
>  			if (tsc_pg->tsc_sequence == sequence)
>  				return current_tick;
> 
> -			if (tsc_pg->tsc_sequence != -1)
> +			if (tsc_pg->tsc_sequence != 0)
>  				continue;
>  			/*
>  			 * Fallback using MSR method.
> --
> 2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ