Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2485838pxu; Mon, 7 Dec 2020 07:49:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6Q4gKm5csdrpIisLlUz0iCuzhGpdA8HUeOkc5CS9wRlBlFTRFGwwC8IY/gI4RD8RZ2NId X-Received: by 2002:a17:906:60c8:: with SMTP id f8mr19099241ejk.14.1607356160577; Mon, 07 Dec 2020 07:49:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607356160; cv=none; d=google.com; s=arc-20160816; b=MBpDq/NAYRL3uPlLs7tMd5eBJMAqngsA7spGo4Tj9sC7Gj7UyRWzOSwJmjT707SRYR MTE6Vi3sPwhwDqezCdoTboFNdhlCUNMxI9WIAQpGSdeAXIc75ZTFnox/a7348IFSy/1P NE4BZ8r0FYfS7u7TyDxt5aDFelgPn0FDpJ5gfSHOmzu/c+yMwP4rLaXaVzXKEICDi6Kz 9fSXABw0BTh4cYeh500A7VhZaF8lA/QO2Nc2kE5eXe904HK2Q5sFl7qV4/ZAjWXIYlFx O2hUL/FojA7u/oKv7MnyF/CjmdJc2ULqWEWPqXTL/iDTY51XynntCTUMTF0Nl7HfaS1A C89A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=5ITXXusdyZJmpGUEP0ZlJR4HupY0+UiO2aCdp7brxcs=; b=gLjp/7okG91hvzm9EiFg6gSO4ZcGq5MeNdp5s2eA6+Z/jlGf4uESA6MqoLn5v9xLcJ zq55rahMAMucB5FdsiJ2MJAzCwKtOpc65/QcUF54f+jgW8JLV/sFs7b1XvmL9KAiikVC QudIZRMNlHZ25NeEbreqUcLfSADWT+TxxLBfKCVleDbfpTYPUZ5bW2h+AXeTg5fs1z9h RHRJVGPWcRkmDdh5ygQigFBWIhpnSM9Mar076E3CzhDsnt1norxNq3CccCQx6fM+fNUO OsPS38n25Ibo9j/707BLyAwWJy6pA0r1fm09niZMgiZ1tqczy8aei83KW7UG5CDLDKlz fhKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="O4tac+/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si9649901edq.549.2020.12.07.07.48.57; Mon, 07 Dec 2020 07:49:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="O4tac+/E"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbgLGPpY (ORCPT + 99 others); Mon, 7 Dec 2020 10:45:24 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51982 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbgLGPpY (ORCPT ); Mon, 7 Dec 2020 10:45:24 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B7FWtq0063050; Mon, 7 Dec 2020 10:44:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=5ITXXusdyZJmpGUEP0ZlJR4HupY0+UiO2aCdp7brxcs=; b=O4tac+/EBWGllSE+ye5b7U/sHeXauf90+dGBfeyRamVGqFoPKq/2j2L2XTVItsm+2YPn ikbBr+7EYzGf76i4Kga0MqnUntGSPXG+15opUoiV0A7fW3bOBozbw8eVXrPNfohXSl/N /Qu8+qUg7ClIgOmvV43l3V+st55x2D4pL5tWivtDIpU2H5L/vfkBxPdP4R2sdlskOcXr tnViCafXJWmQ8nprr5+LPuNQw97kVkV/IyM4Xbqlyv0J8ZdkwVnO1E45kgAM/GL2qzV3 38CPaOXwVyFDKgBKBsgsbiTqxK7tP09wPw6lN6hkAKNcxwPM5j0vf2N9/YKKOOlbVgMo Jg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 359pygguve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 10:44:41 -0500 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B7FXDHZ064742; Mon, 7 Dec 2020 10:44:40 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 359pygguuu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 10:44:40 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B7FXXIm012562; Mon, 7 Dec 2020 15:44:38 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 3581u8kvax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Dec 2020 15:44:38 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B7Fg6ng2425590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Dec 2020 15:42:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E72DD52052; Mon, 7 Dec 2020 15:42:05 +0000 (GMT) Received: from oc7455500831.ibm.com (unknown [9.171.4.19]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6874A52050; Mon, 7 Dec 2020 15:42:05 +0000 (GMT) Subject: Re: [PATCH] s390/vfio-ap: Clean up vfio_ap resources when KVM pointer invalidated To: Halil Pasic , Tony Krowiak Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, cohuck@redhat.com, alex.williamson@redhat.com, kwankhede@nvidia.com, david@redhat.com References: <20201202234101.32169-1-akrowiak@linux.ibm.com> <20201203185514.54060568.pasic@linux.ibm.com> <20201207162411.050c6cea.pasic@linux.ibm.com> From: Christian Borntraeger Message-ID: Date: Mon, 7 Dec 2020 16:42:05 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201207162411.050c6cea.pasic@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-07_11:2020-12-04,2020-12-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 clxscore=1011 priorityscore=1501 adultscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=2 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012070098 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.12.20 16:24, Halil Pasic wrote: > On Fri, 4 Dec 2020 11:48:24 -0500 > Tony Krowiak wrote: > >> On 12/3/20 12:55 PM, Halil Pasic wrote: >>> On Wed, 2 Dec 2020 18:41:01 -0500 >>> Tony Krowiak wrote: >>> >>>> The vfio_ap device driver registers a group notifier with VFIO when the >>>> file descriptor for a VFIO mediated device for a KVM guest is opened to >>>> receive notification that the KVM pointer is set (VFIO_GROUP_NOTIFY_SET_KVM >>>> event). When the KVM pointer is set, the vfio_ap driver stashes the pointer >>>> and calls the kvm_get_kvm() function to increment its reference counter. >>>> When the notifier is called to make notification that the KVM pointer has >>>> been set to NULL, the driver should clean up any resources associated with >>>> the KVM pointer and decrement its reference counter. The current >>>> implementation does not take care of this clean up. >>>> >>>> Signed-off-by: Tony Krowiak >>> Do we need a Fixes tag? Do we need this backported? In my opinion >>> this is necessary since the interrupt patches. >> >> I'll put in a fixes tag: >> Fixes: 258287c994de (s390: vfio-ap: implement mediated device open callback) >> >> Yes, this should probably be backported. > > I changed my mind regarding the severity of this issue. I was paranoid > about post-mortem interrupts, and resulting notifier byte updates by the > machine. What I overlooked is that the pin is going to prevent the memory > form getting repurposed. I.e. if we have something like vmalloc(), > vfio_pin(notifier_page), vfree(), I believe the notifier_page is not free > (available for allocation). So the worst case scenario is IMHO a resource > leak and not corruption. So I'm not sure this must be backported. > Opinions? Resource leaks qualify for backport and cc stable, but it is not a security issue so this has no urgency and CVE and these kind of things. So lets finish this without hurry, add cc stable and then look for necessary distro backports.