Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D750928983A for ; Wed, 18 Jun 2025 11:08:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244880; cv=none; b=eT902Wxp5dg7E/fS3deih6zPguN59OqcUzFJbJ5IfP/pb5HUZruPU8AxGianN6lzXc284srVVKpIz4RkPqeRRZnm71WNMT1nwbhVtmyCY7g4G4rBE8fO/WgjM6dkRbYkeJ9RqiG8jiKd/RusoYEnLzLu6YNc0X/k3r104vm424I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244880; c=relaxed/simple; bh=cpPfGJ7zCFDN8+JsvsTLBIUgwDi34t7TPkG1h8ZmYdo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mZ3FuFtPSQXPheZmoIY+NkC/5rpTGgRQ1LQQVryCW/95rynurMbgibcP8LB2uVRAFwvKyCtJQ9TLp4hoJ/OvDbea6uKxf67CBqvo9v8d/qTOO3ljVAeJkTsGhIfcA5OhC4Qm5RcInIpmbTxQj2gnY5Gk7fCT8rukg0jiPl1591I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fEtWYJVj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="fEtWYJVj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D83E7C4CEE7; Wed, 18 Jun 2025 11:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244880; bh=cpPfGJ7zCFDN8+JsvsTLBIUgwDi34t7TPkG1h8ZmYdo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fEtWYJVj/UgH4bFS276cC6ZLD/nz0GuSDqKvgvc9TE1STLa9MWgLVIr3h1Xm1Vi0b 1kxpO1z7jbwKSx4emnJXLMN+k+xWuT2V1ntjCc+RhgleZuflQCI57xTiWyOKV8B3Wa D8PrchAyfVEACrxvKpV33jM0/5YVNk3L3rgoS8gQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50064: virtio-blk: Avoid use-after-free on suspend/resume Date: Wed, 18 Jun 2025 13:02:09 +0200 Message-ID: <2025061850-CVE-2022-50064-70a7@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3293; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Xrr2qaLFbUiwkFPT+p55/qui7B8S939j49JsoWcIecA=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlBc5IPcTfUcGx443PSf1bq9xPtrkWcW6KWXPZcc1b36 zO9q8WRHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRF48YFmzsXnFWZTnv9z8t f+aHfvCY4q+s9ZRhfsq7UIXLzvkHl/xZME03qlq1ZvPZAwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: virtio-blk: Avoid use-after-free on suspend/resume hctx->user_data is set to vq in virtblk_init_hctx(). However, vq is freed on suspend and reallocated on resume. So, hctx->user_data is invalid after resume, and it will cause use-after-free accessing which will result in the kernel crash something like below: [ 22.428391] Call Trace: [ 22.428899] [ 22.429339] virtqueue_add_split+0x3eb/0x620 [ 22.430035] ? __blk_mq_alloc_requests+0x17f/0x2d0 [ 22.430789] ? kvm_clock_get_cycles+0x14/0x30 [ 22.431496] virtqueue_add_sgs+0xad/0xd0 [ 22.432108] virtblk_add_req+0xe8/0x150 [ 22.432692] virtio_queue_rqs+0xeb/0x210 [ 22.433330] blk_mq_flush_plug_list+0x1b8/0x280 [ 22.434059] __blk_flush_plug+0xe1/0x140 [ 22.434853] blk_finish_plug+0x20/0x40 [ 22.435512] read_pages+0x20a/0x2e0 [ 22.436063] ? folio_add_lru+0x62/0xa0 [ 22.436652] page_cache_ra_unbounded+0x112/0x160 [ 22.437365] filemap_get_pages+0xe1/0x5b0 [ 22.437964] ? context_to_sid+0x70/0x100 [ 22.438580] ? sidtab_context_to_sid+0x32/0x400 [ 22.439979] filemap_read+0xcd/0x3d0 [ 22.440917] xfs_file_buffered_read+0x4a/0xc0 [ 22.441984] xfs_file_read_iter+0x65/0xd0 [ 22.442970] __kernel_read+0x160/0x2e0 [ 22.443921] bprm_execve+0x21b/0x640 [ 22.444809] do_execveat_common.isra.0+0x1a8/0x220 [ 22.446008] __x64_sys_execve+0x2d/0x40 [ 22.446920] do_syscall_64+0x37/0x90 [ 22.447773] entry_SYSCALL_64_after_hwframe+0x63/0xcd This patch fixes this issue by getting vq from vblk, and removes virtblk_init_hctx(). The Linux kernel CVE team has assigned CVE-2022-50064 to this issue. Affected and fixed versions =========================== Issue introduced in 5.19 with commit 4e0400525691d0e676dbe002641f9a61261f1e1b and fixed in 5.19.4 with commit 2b54e14535bc34bf649372060d518ec9f2b893b3 Issue introduced in 5.19 with commit 4e0400525691d0e676dbe002641f9a61261f1e1b and fixed in 6.0 with commit 8d12ec10292877751ee4463b11a63bd850bc09b5 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-50064 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/block/virtio_blk.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/2b54e14535bc34bf649372060d518ec9f2b893b3 https://git.kernel.org/stable/c/8d12ec10292877751ee4463b11a63bd850bc09b5