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]
Date:   Fri, 7 Apr 2017 19:38:03 +0000
From:   Jork Loeser <Jork.Loeser@...rosoft.com>
To:     Vitaly Kuznetsov <vkuznets@...hat.com>,
        "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
        "x86@...nel.org" <x86@...nel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "KY Srinivasan" <kys@...rosoft.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: RE: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline

> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@...hat.com]
> Sent: Friday, April 7, 2017 04:27
> To: devel@...uxdriverproject.org; x86@...nel.org
> Cc: linux-kernel@...r.kernel.org; KY Srinivasan <kys@...rosoft.com>;
> Haiyang Zhang <haiyangz@...rosoft.com>; Stephen Hemminger
> <sthemmin@...rosoft.com>; Thomas Gleixner <tglx@...utronix.de>; Ingo
> Molnar <mingo@...hat.com>; H. Peter Anvin <hpa@...or.com>; Steven
> Rostedt <rostedt@...dmis.org>; Jork Loeser <Jork.Loeser@...rosoft.com>
> Subject: [PATCH 1/7] x86/hyperv: make hv_do_hypercall() inline

> diff --git a/arch/x86/include/asm/mshyperv.h
> b/arch/x86/include/asm/mshyperv.h index 7c9c895..331e834 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -170,6 +170,51 @@ void hv_remove_crash_handler(void);
> 
>  #if IS_ENABLED(CONFIG_HYPERV)
>  extern struct clocksource *hyperv_cs;
> +extern void *hv_hypercall_pg;
> +
> +static inline u64 hv_do_hypercall(u64 control, void *input, void
> +*output) {
> +	u64 input_address = (input) ? virt_to_phys(input) : 0;
> +	u64 output_address = (output) ? virt_to_phys(output) : 0; #ifdef
> +CONFIG_X86_64
> +	u64 hv_status;
> +
> +	if (!hv_hypercall_pg)
> +		return (u64)ULLONG_MAX;
> +
> +	__asm__ __volatile__("mov %3, %%r8\n"
> +			     "call *%4"
> +			     : "=a" (hv_status)
> +			     : "c" (control), "d" (input_address),
> +			       "r" (output_address), "m" (hv_hypercall_pg)
> +			     : "cc", "r8", "%r9", "%r10", "%r11");
Is clobbering memory required here?


> +
> +	return hv_status;
> +
> +#else
> +	u32 control_hi = control >> 32;
> +	u32 control_lo = control & 0xFFFFFFFF;
> +	u32 hv_status_hi;
> +	u32 hv_status_lo;
> +	u32 input_address_hi = input_address >> 32;
> +	u32 input_address_lo = input_address & 0xFFFFFFFF;
> +	u32 output_address_hi = output_address >> 32;
> +	u32 output_address_lo = output_address & 0xFFFFFFFF;
> +
> +	if (!hv_hypercall_pg)
> +		return (u64)ULLONG_MAX;
> +
> +	__asm__ __volatile__ ("call *%8"
> +			      : "=d"(hv_status_hi), "=a"(hv_status_lo)
> +			      : "d" (control_hi), "a" (control_lo),
> +				"b" (input_address_hi), "c"
> (input_address_lo),
> +				"D"(output_address_hi),
> "S"(output_address_lo),
> +				"m" (hv_hypercall_pg)
> +			      : "cc");

Please clobber ecx register for x86 path as well, e.g. by passing as output w/ "+". Please also clobber memory.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ