From: James Hogan <james.hogan@imgtec.com>
To: stable <stable@vger.kernel.org>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
Gleb Natapov <gleb@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Ralf Baechle <ralf@linux-mips.org>, <kvm@vger.kernel.org>,
<linux-mips@linux-mips.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load
Date: Mon, 8 Jun 2015 09:33:50 +0100 [thread overview]
Message-ID: <5575536E.8080608@imgtec.com> (raw)
In-Reply-To: <554CC530.20906@imgtec.com>
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
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@osadl.org>
>
> Looks good to me. I wrote an MMIO test to reproduce the issue, and this
> fixes it.
>
> Reviewed-by: James Hogan <james.hogan@imgtec.com>
> Tested-by: James Hogan <james.hogan@imgtec.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@imgtec.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:
>>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: stable <stable@vger.kernel.org>
Cc: Nicholas Mc Guire <hofrat@osadl.org>,
Gleb Natapov <gleb@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Ralf Baechle <ralf@linux-mips.org>,
kvm@vger.kernel.org, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load
Date: Mon, 8 Jun 2015 09:33:50 +0100 [thread overview]
Message-ID: <5575536E.8080608@imgtec.com> (raw)
Message-ID: <20150608083350.3wtDEbr0l9xRZt-7XPmua_Uoz97IlHqCZ9VMmFZQLB4@z> (raw)
In-Reply-To: <554CC530.20906@imgtec.com>
[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]
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@osadl.org>
>
> Looks good to me. I wrote an MMIO test to reproduce the issue, and this
> fixes it.
>
> Reviewed-by: James Hogan <james.hogan@imgtec.com>
> Tested-by: James Hogan <james.hogan@imgtec.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@imgtec.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:
>>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-06-08 8:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 12:47 [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load Nicholas Mc Guire
2015-05-08 14:16 ` James Hogan
2015-05-08 14:16 ` James Hogan
2015-06-08 8:33 ` James Hogan [this message]
2015-06-08 8:33 ` James Hogan
2015-06-10 12:57 ` Jiri Slaby
2015-06-12 12:07 ` Luis Henriques
2015-06-12 12:07 ` Luis Henriques
2015-06-19 19:14 ` Greg KH
2015-06-19 19:14 ` Greg KH
2015-06-19 19:14 ` Greg KH
2015-07-08 14:25 ` [PATCH stable <3.17] MIPS: KVM: Do " James Hogan
2015-07-08 14:25 ` James Hogan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5575536E.8080608@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=gleb@kernel.org \
--cc=hofrat@osadl.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=pbonzini@redhat.com \
--cc=ralf@linux-mips.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.