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: <6eb96a45-393c-4e06-ee19-549fdbe9e316@citrix.com>
Date:   Wed, 7 Nov 2018 12:02:16 +0000
From:   Andrew Cooper <andrew.cooper3@...rix.com>
To:     Juergen Gross <jgross@...e.com>, <linux-kernel@...r.kernel.org>,
        <xen-devel@...ts.xenproject.org>, <x86@...nel.org>
CC:     <sstabellini@...nel.org>, <mingo@...hat.com>, <bp@...en8.de>,
        <hpa@...or.com>, <boris.ostrovsky@...cle.com>, <tglx@...utronix.de>
Subject: Re: [Xen-devel] [PATCH] x86/xen: fix pv boot

On 07/11/18 11:55, Andrew Cooper wrote:
> On 07/11/18 11:30, Juergen Gross wrote:
>> +	return ret;
>>  }
>>  
>>  static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val)
>>  {
>> -	return __get_user(*val, (unsigned long __user *)addr);
>> +	int ret = 0;
>> +	unsigned long rval;
>> +
>> +	asm volatile("1: mov"__i" %2,%"__r"1\n"
>> +		     "2:\n"
>> +		     ".section .fixup,\"ax\"\n"
>> +		     "3: mov %3,%0\n"
>> +		     "   jmp 2b\n"
>> +		     ".previous\n"
>> +		     _ASM_EXTABLE(1b, 3b)
>> +		     : "=r" (ret), "=r" (rval)
>> +		     : "m" (*addr), "i" (-1), "0" (ret));
>> +	*val = rval;
>> +	return ret;
> This also uses rval uninitialised if a fault occurs.
>
> Overall, how about:
>
> static inline int xen_safe_write_ulong(unsigned long *addr, unsigned
> long val)
> {
>     int ret = 0;
>
>     asm volatile("1: mov %[val], %[ptr]\n"
>                  "2:\n"
>                  ".section .fixup, \"ax\"\n"
>                  "3: mov %[err], %[ret]\n"

Actually, if you want a shorter fixup path, `sub $1, %[ret]` would also
do, and drop the [err] constraint.

~Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ