Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1369029pxm; Thu, 24 Feb 2022 01:34:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5e4UMkK9Wno6nuPIJNK5TiZIqbq4pZboKi+Rrv9gPaRDaTyJPCWlYpZ0shEcizCGaew8E X-Received: by 2002:a17:903:11c6:b0:14f:460d:bf10 with SMTP id q6-20020a17090311c600b0014f460dbf10mr1842063plh.124.1645695248634; Thu, 24 Feb 2022 01:34:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645695248; cv=none; d=google.com; s=arc-20160816; b=H5EQgUTUYMBPFpw1oobY0dA+dJBQHD7a68HN8M+Zi9nZFeWSwqVvnp1rbP9HWfI9Te ff0yRzMe93G7TiuDC1GINYTqbnKKBq1vfQ4shzqFCTzIG9aqYeiUtGlXecN/RawKNwpk fFPtxPbwHJiXCkeFVBWwfan5WvWxC0Z012PEU1Q8ybmNelqDpW2GYlj+Be8U7lhmXmcV vY8iIkbeBqPmpJUZZde1MnVTjI/KAQusFArliy23QyymH1dmA2EV0jq2yo8FxPC2utoP FbIKLsClXIvZiHc9Wf3gpX6lo6pABR8o9GrdGs2+hMwt9CueTEOq39M3qeq1/z5cKEkL vGMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=thrYYz9q4DcC0rOHSVDRqBTRDM3HEZ49oAwiCU0vtIA=; b=ZiUqxSRnFiqGejlG6/Tw1gm7plmiSnF0J3YS0iE8IElFOV7uB1g8Icp1hHS+S6ANrv MX3jKnWsJA+BJ9T3eEp26Eg55VJJQKQ02LQbZt/HbA01OpveCDU/+gxdpT4TWiqpNf+e bIoUWb7NELC9CyWtz+G+5Wgb8uqhr7urFIx8p7kfBLZ2hFmPywGfj6X8mgGhsWkYgzd7 Hu9c5Q6SXe8uT+HyuEv8wDqT5VkAC/N/uM6BuJ+lkNslRhFx2n8bL/94Q+kngZokovWM Hp9REoRjyjkIYk0CXBFaQLs7hvc2urET43J3y5TFZGS3J2vYuqKzy6+uBDFvEOuceuVG pQWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gpGlAeee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w24si1863926ply.197.2022.02.24.01.33.53; Thu, 24 Feb 2022 01:34:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gpGlAeee; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232139AbiBXIyO (ORCPT + 99 others); Thu, 24 Feb 2022 03:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbiBXIyM (ORCPT ); Thu, 24 Feb 2022 03:54:12 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 61EDE162020 for ; Thu, 24 Feb 2022 00:53:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645692822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=thrYYz9q4DcC0rOHSVDRqBTRDM3HEZ49oAwiCU0vtIA=; b=gpGlAeeeED/JQh+YrP5CiO8JU9JdrmOEaLc6q1G+gFEV/410TgSWvmc4o8LEw539BNgx9+ VQL9wKuIJGNG6zfSM1kB3IfO7W3MOYsejOpmEO479VPaQ+FBGY9HSxiqa3AEG4C2JGS5x7 zDuvoeRroslj52c5NxR1qqbUtP6FB5I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-2e81YYi9MyyiXnp89lNAuQ-1; Thu, 24 Feb 2022 03:53:41 -0500 X-MC-Unique: 2e81YYi9MyyiXnp89lNAuQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41803800496; Thu, 24 Feb 2022 08:53:39 +0000 (UTC) Received: from localhost (unknown [10.39.194.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA567607CB; Thu, 24 Feb 2022 08:53:32 +0000 (UTC) Date: Thu, 24 Feb 2022 08:53:31 +0000 From: Stefan Hajnoczi To: Stefano Garzarella Cc: "Michael S. Tsirkin" , Jason Wang , netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, syzbot+1e3ea63db39f2b4440e0@syzkaller.appspotmail.com, kvm@vger.kernel.org, Anirudh Rayabharam , syzbot+3140b17cb44a7b174008@syzkaller.appspotmail.com, linux-kernel@vger.kernel.org, Mike Christie , Dan Carpenter , stable@vger.kernel.org Subject: Re: [PATCH v2] vhost/vsock: don't check owner in vhost_vsock_stop() while releasing Message-ID: References: <20220222094742.16359-1-sgarzare@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eMHA10fN330j9lI9" Content-Disposition: inline In-Reply-To: <20220222094742.16359-1-sgarzare@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --eMHA10fN330j9lI9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 22, 2022 at 10:47:42AM +0100, Stefano Garzarella wrote: > vhost_vsock_stop() calls vhost_dev_check_owner() to check the device > ownership. It expects current->mm to be valid. >=20 > vhost_vsock_stop() is also called by vhost_vsock_dev_release() when > the user has not done close(), so when we are in do_exit(). In this > case current->mm is invalid and we're releasing the device, so we > should clean it anyway. >=20 > Let's check the owner only when vhost_vsock_stop() is called > by an ioctl. >=20 > When invoked from release we can not fail so we don't check return > code of vhost_vsock_stop(). We need to stop vsock even if it's not > the owner. >=20 > Fixes: 433fc58e6bf2 ("VSOCK: Introduce vhost_vsock.ko") > Cc: stable@vger.kernel.org > Reported-by: syzbot+1e3ea63db39f2b4440e0@syzkaller.appspotmail.com > Reported-and-tested-by: syzbot+3140b17cb44a7b174008@syzkaller.appspotmail= =2Ecom > Signed-off-by: Stefano Garzarella > --- > v2: > - initialized `ret` in vhost_vsock_stop [Dan] > - added comment about vhost_vsock_stop() calling in the code and an expla= nation > in the commit message [MST] >=20 > v1: https://lore.kernel.org/virtualization/20220221114916.107045-1-sgarza= re@redhat.com > --- > drivers/vhost/vsock.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) Reviewed-by: Stefan Hajnoczi --eMHA10fN330j9lI9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmIXR4oACgkQnKSrs4Gr c8i0LQf/bGGbSYckr30SGrkHytT/rZHQYzSD8L7Mcj6YDjh7rV/lE31ATrVY9JY4 qZ/hJTMlfAx8gqVYEmZrUh9xM09BjRAdSjGy92sdpbVYhWbr1D0HmDS+hQvFQjXs HHpjWQeHtKjAfw8nz6HfgcH3329t+oVH5V4RQ5pOeLNq0Tm58uYdhmf7IqIrb9TI LySJlzqTqsRzI8URPo6u9i+PqNhTnbjYTSBP2/WnAZeSrHUDXlOmeJ5cXGweinGe CiH+66Eay0ga1M/Xym1xsota2L8lfQlO9HF1XkTJiYEeQDYthIJUc7wuZvnftCgh ZND4ieEesa+iV+Lyaxno7s+gT0fLHw== =f2iv -----END PGP SIGNATURE----- --eMHA10fN330j9lI9--