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] [day] [month] [year] [list]
Message-ID: <b35f5ef5-28bc-5747-63d2-3c5c82ae49e9@suse.com>
Date:   Wed, 7 Nov 2018 13:16:42 +0100
From:   Juergen Gross <jgross@...e.com>
To:     Andrew Cooper <andrew.cooper3@...rix.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/2018 13:02, Andrew Cooper wrote:
> 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.

Thanks for the review.

Will send V2 soon.


Juergen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ