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:	Wed, 07 May 2014 18:21:25 +0300
From:	Nadav Amit <nadav.amit@...il.com>
To:	Paolo Bonzini <pbonzini@...hat.com>,
	Nadav Amit <namit@...technion.ac.il>, mtosatti@...hat.com,
	hpa@...or.com
CC:	gleb@...nel.org, tglx@...utronix.de, mingo@...hat.com,
	x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/5] KVM: x86: Emulator does not calculate address correctly

On 5/7/14, 4:57 PM, Paolo Bonzini wrote:
> Il 07/05/2014 14:32, Nadav Amit ha scritto:
>> In long-mode, when the address size is 4 bytes, the linear address is not
>> truncated as the emulator mistakenly does.  Instead, the offset within
>> the
>> segment (the ea field) should be truncated according to the address size.
>>
>> As Intel SDM says: "In 64-bit mode, the effective address components
>> are added
>> and the effective address is truncated ... before adding the full 64-bit
>> segment base."
>>
>> Signed-off-by: Nadav Amit <namit@...technion.ac.il>
>> ---
>>  arch/x86/kvm/emulate.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
>> index e8a5840..743e8e3 100644
>> --- a/arch/x86/kvm/emulate.c
>> +++ b/arch/x86/kvm/emulate.c
>> @@ -631,7 +631,8 @@ static int __linearize(struct x86_emulate_ctxt *ctxt,
>>      u16 sel;
>>      unsigned cpl;
>>
>> -    la = seg_base(ctxt, addr.seg) + addr.ea;
>> +    la = seg_base(ctxt, addr.seg) +
>> +        (ctxt->ad_bytes == 8 ? addr.ea : (u32)addr.ea);
>
> I think you need "fetch || ctxt->ad_bytes == 8" here.
>
> Paolo
>
Yes. I did not test the fetch scenario.
I intend to do so soon to avoid such mistakes.

Nadav
--
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