stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 --]

       reply	other threads:[~2015-06-08  8:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1431002870-30098-1-git-send-email-hofrat@osadl.org>
     [not found] ` <554CC530.20906@imgtec.com>
2015-06-08  8:33   ` James Hogan [this message]
2015-06-10 12:57     ` [PATCH] MIPS: KVM: do not sign extend on unsigned MMIO load Jiri Slaby
2015-06-12 12:07     ` Luis Henriques
2015-06-19 19:14     ` Greg KH
2015-07-08 14:25       ` [PATCH stable <3.17] MIPS: KVM: Do " 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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).