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  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]
Date:	Mon, 22 Dec 2014 22:20:13 +0800
From:	Peng Fan <van.freenix@...il.com>
To:	Marc Zyngier <marc.zyngier@....com>,
	"christoffer.dall@...aro.org" <christoffer.dall@...aro.org>
CC:	"gleb@...nel.org" <gleb@...nel.org>,
	"pbonzini@...hat.com" <pbonzini@...hat.com>,
	"linux@....linux.org.uk" <linux@....linux.org.uk>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"kvmarm@...ts.cs.columbia.edu" <kvmarm@...ts.cs.columbia.edu>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] arm:kvm remove len 8 for mmio read write buf

Just began learning this piece of code.
Thanks for correcting me. 

On 12/22/2014 07:51 PM, Marc Zyngier wrote:
> On 22/12/14 11:23, Peng Fan wrote:
>> For arm 32 bit architecture, 8 bytes load/store operation in one instruction
>> will not be generated by compiler.
> 
> Ever heard of lrdr/strd?
> 
>> And before invoke mmio_read_buf, there is a piece of code:
>> "
>>                  len = run->mmio.len;
>>                  if (len > sizeof(unsigned long))
>>                          return -EINVAL;
>>
>> 		data = mmio_read_buf(run->mmio.data, len);
>> "
>>
>> This piece code also tells that len variable does not exceeds 4 bytes.
>> So, remove 8 bytes assign in mmio_read_buf and mmio_write_buf.
> 
> NAK. This code is shared between arm and arm64. See commit f42798c.
> 
> 	M.
> 
>>
>> Signed-off-by: Peng Fan <van.freenix@...il.com>
>> CC: Gleb Natapov <gleb@...nel.org>
>> CC: Paolo Bonzini <pbonzini@...hat.com>
>> CC: Christoffer Dall <christoffer.dall@...aro.org>
>> CC: Marc Zyngier <marc.zyngier@....com>
>> CC: Russell King <linux@....linux.org.uk>
>> ---
>>  arch/arm/kvm/mmio.c | 10 ----------
>>  1 file changed, 10 deletions(-)
>>
>> diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
>> index 4cb5a93..953a819 100644
>> --- a/arch/arm/kvm/mmio.c
>> +++ b/arch/arm/kvm/mmio.c
>> @@ -30,7 +30,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
>>  		u8	byte;
>>  		u16	hword;
>>  		u32	word;
>> -		u64	dword;
>>  	} tmp;
>>  
>>  	switch (len) {
>> @@ -46,10 +45,6 @@ static void mmio_write_buf(char *buf, unsigned int len, unsigned long data)
>>  		tmp.word	= data;
>>  		datap		= &tmp.word;
>>  		break;
>> -	case 8:
>> -		tmp.dword	= data;
>> -		datap		= &tmp.dword;
>> -		break;
>>  	}
>>  
>>  	memcpy(buf, datap, len);
>> @@ -61,7 +56,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
>>  	union {
>>  		u16	hword;
>>  		u32	word;
>> -		u64	dword;
>>  	} tmp;
>>  
>>  	switch (len) {
>> @@ -76,10 +70,6 @@ static unsigned long mmio_read_buf(char *buf, unsigned int len)
>>  		memcpy(&tmp.word, buf, len);
>>  		data = tmp.word;
>>  		break;
>> -	case 8:
>> -		memcpy(&tmp.dword, buf, len);
>> -		data = tmp.dword;
>> -		break;
>>  	}
>>  
>>  	return data;
>>
> 
> 
--
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