Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4780970ybc; Tue, 26 Nov 2019 14:40:30 -0800 (PST) X-Google-Smtp-Source: APXvYqypifoIAcy9fJFgtszojteGLu5l+KHA10I7WVZN4Qeb1oGee/Z441w796EtMwL90Qnq/5qO X-Received: by 2002:a17:906:1d19:: with SMTP id n25mr44872252ejh.151.1574808030606; Tue, 26 Nov 2019 14:40:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574808030; cv=none; d=google.com; s=arc-20160816; b=b/C4TAzZg2uCl2Enm7z5yHygNhDXInKua2da9N614U7cnHem9lF8FmmueY5cDLy3jr qCIyU7qEwWFF6HZMlgih8lOipwoDF+uwIbnn4z43I34rQ1Srk7W3ezfZoM5tuZTlHW3O ZEFHzxt0RSRi5zKWAnbbtvKVZ9tuTvJrUbJNNW7gPubP3ijtNzxGd1EWbT/T50A3ff0u Z+1py3FQfwlPd/lMxSEWMR9Uhiih+u44q/tXQlAzGVxwS2ETZcUB8RlPM5J5GTl3jTYX K4Q/PXDOmDCCDqx2b20ZTLwB0cTDnpouIjkDrMaZ224+f5EciFPonnxYOdhhyDdDdkUG WdEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aQKfmBv2yKMNdqlFuvFrUP+W4esk/MfQ+sUbEF3RggI=; b=R+L53K9rBheAZYidwbVE2a0rHiWNprVtaqQD9wiD/VAWD7tdsyknHJu48QmZLycng5 j407TTUUK7Pczld90divlVvQBnUtxGKjd52ijfzmdtDPKO/d1Lu5BU3P4WKpOZx80uC0 vm1j/NxS5V3h0LJFivR6LspVM1Vd/N4DU+ui5Pc2joBPjsWWxZcqCCtPCcI2eHuwUzsz jsc+B6gDIgYAwMfRywQrLR0dk4toxXPtm5m34Om92hsTwBX1UD8IJiuqIF4Jmcq+naKA wWEl5Hpl3HlyLP2tTyoiw/juJM+r2cFoHymhTNcBI7XiSqI8yZ1qKBhv+CWRrieSUb0S Lyag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si9901345edw.338.2019.11.26.14.40.06; Tue, 26 Nov 2019 14:40:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727051AbfKZWg5 (ORCPT + 99 others); Tue, 26 Nov 2019 17:36:57 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:27598 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbfKZWg5 (ORCPT ); Tue, 26 Nov 2019 17:36:57 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xAQMX26s057546; Tue, 26 Nov 2019 17:36:43 -0500 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 2whcxpr31n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Nov 2019 17:36:42 -0500 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id xAQMYrGQ013272; Tue, 26 Nov 2019 22:36:41 GMT Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by ppma04wdc.us.ibm.com with ESMTP id 2wevd77a5d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 26 Nov 2019 22:36:41 +0000 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAQMafvx55116208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 26 Nov 2019 22:36:41 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 590C3AC05B; Tue, 26 Nov 2019 22:36:41 +0000 (GMT) Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C769AC060; Tue, 26 Nov 2019 22:36:40 +0000 (GMT) Received: from LeoBras.aus.stglabs.ibm.com (unknown [9.18.235.137]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 26 Nov 2019 22:36:40 +0000 (GMT) From: Leonardo Bras To: Paul Mackerras , Benjamin Herrenschmidt , Michael Ellerman Cc: Leonardo Bras , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] Replace current->mm by kvm->mm on powerpc/kvm Date: Tue, 26 Nov 2019 19:36:29 -0300 Message-Id: <20191126223631.389779-1-leonardo@linux.ibm.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-26_07:2019-11-26,2019-11-26 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 suspectscore=2 spamscore=0 phishscore=0 mlxlogscore=606 bulkscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911260191 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --- Changes since v2: - Rebased on torvalds/master and updated the remaining patches. 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 Leonardo Bras (2): powerpc/kvm/book3s: Replace current->mm by kvm->mm powerpc/kvm/book3e: Replace current->mm by kvm->mm arch/powerpc/kvm/book3s_64_mmu_hv.c | 4 ++-- arch/powerpc/kvm/book3s_64_vio.c | 10 ++++++---- arch/powerpc/kvm/book3s_hv.c | 10 +++++----- arch/powerpc/kvm/booke.c | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) -- 2.23.0