stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: Paolo Bonzini <pbonzini@redhat.com>, KVM <kvm@vger.kernel.org>,
	Gleb Natapov <gleb@kernel.org>, Alexander Graf <agraf@suse.de>,
	Cornelia Huck <cornelia.huck@de.ibm.com>,
	Jens Freimann <jfrei@linux.vnet.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	stable@vger.kernel.org
Subject: Re: [GIT PULL 2/2] KVM: s390/mm: try a cow on read only pages for key ops
Date: Wed, 27 Aug 2014 09:13:07 +0200	[thread overview]
Message-ID: <53FD8503.8040802@de.ibm.com> (raw)
In-Reply-To: <1409108771.30127.21.camel@deadeye.wl.decadent.org.uk>

On 27/08/14 05:06, Ben Hutchings wrote:
> On Mon, 2014-08-25 at 15:10 +0200, Christian Borntraeger wrote:
>> The PFMF instruction handler  blindly wrote the storage key even if
>> the page was mapped R/O in the host. Lets try a COW before continuing
>> and bail out in case of errors.
>>
>> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
>> Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
>> Cc: stable@vger.kernel.org
>> ---
>>  arch/s390/mm/pgtable.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
>> index 19daa53..5404a62 100644
>> --- a/arch/s390/mm/pgtable.c
>> +++ b/arch/s390/mm/pgtable.c
>> @@ -986,11 +986,21 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
>>  	pte_t *ptep;
>>  
>>  	down_read(&mm->mmap_sem);
>> +retry:
>>  	ptep = get_locked_pte(current->mm, addr, &ptl);
>>  	if (unlikely(!ptep)) {
>>  		up_read(&mm->mmap_sem);
>>  		return -EFAULT;
>>  	}
>> +	if (!(pte_val(*ptep) & _PAGE_INVALID) &&
>> +	     (pte_val(*ptep) & _PAGE_PROTECT)) {
>> +			pte_unmap_unlock(*ptep, ptl);
>> +			if (fixup_user_fault(current, mm, addr, FAULT_FLAG_WRITE)) {
>> +				up_read(&mm->mmap_sem);
>> +				return -EFAULT;
>> +			}
>> +			goto retry;
>> +		}
> 
> Every line below the first 'if' is indented one tab stop too far.
> 
> Ben.
> 
>>  	new = old = pgste_get_lock(ptep);
>>  	pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |
> 

Hmm, indeed. Drat. Paolo, do you want a revert, resend?

Christian


  reply	other threads:[~2014-08-27  7:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1408972211-27122-1-git-send-email-borntraeger@de.ibm.com>
2014-08-25 13:10 ` [GIT PULL 1/2] KVM: s390: Fix user triggerable bug in dead code Christian Borntraeger
2014-08-25 13:10 ` [GIT PULL 2/2] KVM: s390/mm: try a cow on read only pages for key ops Christian Borntraeger
2014-08-27  3:06   ` Ben Hutchings
2014-08-27  7:13     ` Christian Borntraeger [this message]
2014-08-27 10:07       ` Paolo Bonzini

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=53FD8503.8040802@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=ben@decadent.org.uk \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gleb@kernel.org \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --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).