Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655107

Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and 4k)

From David Hildenbrand <david@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and 4k)
Date 2017-06-01 14:50 +0200
Message-ID <tNxI6-2Aw-13@gated-at.bofh.it> (permalink)
References <tMvS2-2uZ-7@gated-at.bofh.it> <tMvS3-2uZ-23@gated-at.bofh.it> <tNwCl-1Yg-5@gated-at.bofh.it>
Organization Red Hat GmbH

Show all headers | View raw


On 01.06.2017 13:39, Christian Borntraeger wrote:
> On 05/29/2017 06:32 PM, David Hildenbrand wrote:
> 
>>  	new = old = pgste_get_lock(ptep);
>>  	pgste_val(new) &= ~(PGSTE_GR_BIT | PGSTE_GC_BIT |
>> @@ -748,6 +764,11 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
>>  	ptep = get_locked_pte(mm, addr, &ptl);
>>  	if (unlikely(!ptep))
>>  		return -EFAULT;
>> +	if (!pgtable_has_pgste(mm, __pa(ptep))) {
>> +		pte_unmap_unlock(ptep, ptl);
>> +		WARN_ONCE(true, "Guest address on page table without pgste");
> 
> All these WARN_ONCE. Is there a way how a malicious user can trigger this or is this checked
> everywhere and triggered would be indeed a bug?

Very good question I added these for testing purposes, but leaving the
WARN_ONCE here is wrong.

The user can create memslots with "wrong" memory. Whenever such memory
is linked into the gmap, we return -EFAULT. So we will only have page
table with "pgstes" in our GMAP at any time.

However, all these functions here go via memslots:

test_and_clear_guest_dirty
-> via memslot from memslot list

set_guest_storage_key
reset_guest_reference_bit
get_guest_storage_key
pgste_perform_essa
set_pgste_bits
get_pgste
->  come via gfn_to_hva() -> gfn_to_memslot() -> search_memslots -> via
memslot list


And then use the calculated host address to just walk the ordinary
process page tables (get_locked_pte) and not the pgste.

So simply returning -EFAULT here is the right thing to, dropping the
WARN_ONCE.

Thanks!

-- 

Thanks,

David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste David Hildenbrand <david@redhat.com> - 2017-05-29 18:40 +0200
  [PATCH RFC 2/2] KVM: s390: Introduce KVM_VM_S390_LATE_MMAP David Hildenbrand <david@redhat.com> - 2017-05-29 18:40 +0200
  [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and 4k) David Hildenbrand <david@redhat.com> - 2017-05-29 18:40 +0200
    Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and  4k) Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-01 13:40 +0200
      Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and  4k) David Hildenbrand <david@redhat.com> - 2017-06-01 14:50 +0200
    Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and  4k) David Hildenbrand <david@redhat.com> - 2017-06-01 15:00 +0200
      Re: [PATCH RFC 1/2] s390x: mm: allow mixed page table types (2k and  4k) Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 09:20 +0200
  Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-01 12:50 +0200
    Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-01 13:30 +0200
    Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste David Hildenbrand <david@redhat.com> - 2017-06-01 13:30 +0200
      Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-06-02 09:10 +0200
    Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-06-02 09:10 +0200
      Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-02 09:20 +0200
        Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 09:30 +0200
          Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-02 10:20 +0200
        Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 09:30 +0200
      Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 09:20 +0200
      Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-02 11:50 +0200
        Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 12:20 +0200
          Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-02 13:00 +0200
            Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Christian Borntraeger <borntraeger@de.ibm.com> - 2017-06-02 15:30 +0200
              Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-07 14:40 +0200
        Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste Heiko Carstens <heiko.carstens@de.ibm.com> - 2017-06-02 12:30 +0200
          Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable  vm.alloc_pgste Martin Schwidefsky <schwidefsky@de.ibm.com> - 2017-06-02 12:50 +0200
      Re: [PATCH RFC 0/2] KVM: s390: avoid having to enable vm.alloc_pgste David Hildenbrand <david@redhat.com> - 2017-06-02 13:00 +0200

csiph-web