[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191107170258.36379-1-leonardo@linux.ibm.com>
Date: Thu, 7 Nov 2019 14:02:54 -0300
From: Leonardo Bras <leonardo@...ux.ibm.com>
To: kvm-ppc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Cc: Leonardo Bras <leonardo@...ux.ibm.com>,
Paul Mackerras <paulus@...abs.org>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>
Subject: [PATCH v2 0/4] Replace current->mm by kvm->mm on powerpc/kvm
By replacing, we would reduce the use of 'global' current on code,
relying more in the contents of kvm struct.
On code, I found that in kvm_create_vm() there is:
kvm->mm = current->mm;
And that on every kvm_*_ioctl we have tests like that:
if (kvm->mm != current->mm)
return -EIO;
So this change would be safe.
Also, I fixed a possible 'use after free' of kvm variable in
kvm_vm_ioctl_create_spapr_tce, where it does a mutex_unlock(&kvm->lock)
after a kvm_put_kvm(kvm).
Changes since v1:
- Fixes possible 'use after free' on kvm_spapr_tce_release (from v1)
- Fixes possible 'use after free' on kvm_vm_ioctl_create_spapr_tce
- Fixes undeclared variable error
Build test:
- https://travis-ci.org/LeoBras/linux-ppc/builds/608807573
Leonardo Bras (4):
powerpc/kvm/book3s: Fixes possible 'use after release' of kvm
powerpc/kvm/book3s: Replace current->mm by kvm->mm
powerpc/kvm/book3e: Replace current->mm by kvm->mm
powerpc/kvm/e500: Replace current->mm by kvm->mm
arch/powerpc/kvm/book3s_64_mmu_hv.c | 10 +++++-----
arch/powerpc/kvm/book3s_64_vio.c | 13 +++++++------
arch/powerpc/kvm/book3s_hv.c | 10 +++++-----
arch/powerpc/kvm/booke.c | 2 +-
arch/powerpc/kvm/e500_mmu_host.c | 6 +++---
5 files changed, 21 insertions(+), 20 deletions(-)
--
2.23.0
Powered by blists - more mailing lists