[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5575536E.8080608@imgtec.com>
Date: Mon, 8 Jun 2015 09:33:50 +0100
From: James Hogan <james.hogan@...tec.com>
To: stable <stable@...r.kernel.org>
CC: Nicholas Mc Guire <hofrat@...dl.org>,
Gleb Natapov <gleb@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Ralf Baechle <ralf@...ux-mips.org>, <kvm@...r.kernel.org>,
<linux-mips@...ux-mips.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load
Hi stable folk,
On 08/05/15 15:16, James Hogan wrote:
> On 07/05/15 13:47, Nicholas Mc Guire wrote:
>> Fix possible unintended sign extension in unsigned MMIO loads by casting
>> to uint16_t in the case of mmio_needed != 2.
>>
>> Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
>
> Looks good to me. I wrote an MMIO test to reproduce the issue, and this
> fixes it.
>
> Reviewed-by: James Hogan <james.hogan@...tec.com>
> Tested-by: James Hogan <james.hogan@...tec.com>
>
> It looks suitable for stable too (3.10+).
This has reached mainline, commit ed9244e6c534612d2b5ae47feab2f55a0d4b4ced
Please could it be added to stable (3.10+).
Thanks
James
>
> Cheers
> James
>
>> ---
>>
>> Thanks to James Hogan <james.hogan@...tec.com> for the explaination of
>> mmio_needed (there is not really any helpful comment in the code on this)
>> in this case (mmio_needed!=2) it should be unsigned.
>>
>> Patch was only compile tested msp71xx_defconfig + CONFIG_KVM=m
>>
>> Patch is against 4.1-rc2 (localversion-next is -next-20150506)
>>
>> arch/mips/kvm/emulate.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
>> index 6230f37..2f0fc60 100644
>> --- a/arch/mips/kvm/emulate.c
>> +++ b/arch/mips/kvm/emulate.c
>> @@ -2415,7 +2415,7 @@ enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu,
>> if (vcpu->mmio_needed == 2)
>> *gpr = *(int16_t *) run->mmio.data;
>> else
>> - *gpr = *(int16_t *) run->mmio.data;
>> + *gpr = *(uint16_t *)run->mmio.data;
>>
>> break;
>> case 1:
>>
>
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists