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 DCC8018CBFE for ; Sat, 11 Jan 2025 12:30:33 +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=1736598633; cv=none; b=LvjIdKIwF7A4ED6mp1C3XMd4/EAt24XgrzImK8D7yXb5YDqFlRn6o4DnEfg7gdNY/5YvXI5I8JcilbHxCaugOM5casKQXrhVnKAiPfWb3I2PuI7muVxpb26RrJB/6POxu1ARUdKnDYs+8KYz/l0XvnKBcxBVEmHVCXVDT4rsyxU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736598633; c=relaxed/simple; bh=Yq+f+5RHpG9CTdw5/EFmng1UseF7ZIAOphnOMfnJiIo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Y96ThNBQ9coQEQXGFSY4XRCnvCeEHSPQmICErueEI6kwJIARC+5MjigtdpLAxB3N/qeueu4gLrfC7wE5PfdORq65e+87t5oY9xnBfg8f2BPWtT2yfOdjPbQpfnNv87j0kj/ELz0G/46UKhaROeTUOGcjw/U+bjwPRXiObq8Q7tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oI78Q2LY; 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="oI78Q2LY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8FC5C4CED2; Sat, 11 Jan 2025 12:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736598633; bh=Yq+f+5RHpG9CTdw5/EFmng1UseF7ZIAOphnOMfnJiIo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=oI78Q2LYP3zctTjV5UzA71p6WwOjxGP91jJIIo9IOm71fAyuQJbsi4RI1xkECLVJx g8HikNYPMZpAXlhP6rIc32K9uA0SG1l5Qfi2nhHPGXwfeSDeVKf8ZgORiHx0lf8dGt wQyfAwt7NnD+g3hzkhOmeq2HoVHmidqU+xUh4PW4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-55642: block: Prevent potential deadlocks in zone write plug error recovery Date: Sat, 11 Jan 2025 13:30:06 +0100 Message-ID: <2025011100-CVE-2024-55642-29a8@gregkh> X-Mailer: git-send-email 2.48.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=5464; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Yq+f+5RHpG9CTdw5/EFmng1UseF7ZIAOphnOMfnJiIo=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlNKR7HHx/Y+27BMfPeyJW/D6ZHur5NP+LDPl2lb59OC 2smbx9/RywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEzE9jbD/GzmTvn9GqX3DOef tl+3/YxsDPPMCwwLJtTJROh8tmGKcPgVk9XP+XOlz5QVAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: block: Prevent potential deadlocks in zone write plug error recovery Zone write plugging for handling writes to zones of a zoned block device always execute a zone report whenever a write BIO to a zone fails. The intent of this is to ensure that the tracking of a zone write pointer is always correct to ensure that the alignment to a zone write pointer of write BIOs can be checked on submission and that we can always correctly emulate zone append operations using regular write BIOs. However, this error recovery scheme introduces a potential deadlock if a device queue freeze is initiated while BIOs are still plugged in a zone write plug and one of these write operation fails. In such case, the disk zone write plug error recovery work is scheduled and executes a report zone. This in turn can result in a request allocation in the underlying driver to issue the report zones command to the device. But with the device queue freeze already started, this allocation will block, preventing the report zone execution and the continuation of the processing of the plugged BIOs. As plugged BIOs hold a queue usage reference, the queue freeze itself will never complete, resulting in a deadlock. Avoid this problem by completely removing from the zone write plugging code the use of report zones operations after a failed write operation, instead relying on the device user to either execute a report zones, reset the zone, finish the zone, or give up writing to the device (which is a fairly common pattern for file systems which degrade to read-only after write failures). This is not an unreasonnable requirement as all well-behaved applications, FSes and device mapper already use report zones to recover from write errors whenever possible by comparing the current position of a zone write pointer with what their assumption about the position is. The changes to remove the automatic error recovery are as follows: - Completely remove the error recovery work and its associated resources (zone write plug list head, disk error list, and disk zone_wplugs_work work struct). This also removes the functions disk_zone_wplug_set_error() and disk_zone_wplug_clear_error(). - Change the BLK_ZONE_WPLUG_ERROR zone write plug flag into BLK_ZONE_WPLUG_NEED_WP_UPDATE. This new flag is set for a zone write plug whenever a write opration targetting the zone of the zone write plug fails. This flag indicates that the zone write pointer offset is not reliable and that it must be updated when the next report zone, reset zone, finish zone or disk revalidation is executed. - Modify blk_zone_write_plug_bio_endio() to set the BLK_ZONE_WPLUG_NEED_WP_UPDATE flag for the target zone of a failed write BIO. - Modify the function disk_zone_wplug_set_wp_offset() to clear this new flag, thus implementing recovery of a correct write pointer offset with the reset (all) zone and finish zone operations. - Modify blkdev_report_zones() to always use the disk_report_zones_cb() callback so that disk_zone_wplug_sync_wp_offset() can be called for any zone marked with the BLK_ZONE_WPLUG_NEED_WP_UPDATE flag. This implements recovery of a correct write pointer offset for zone write plugs marked with BLK_ZONE_WPLUG_NEED_WP_UPDATE and within the range of the report zones operation executed by the user. - Modify blk_revalidate_seq_zone() to call disk_zone_wplug_sync_wp_offset() for all sequential write required zones when a zoned block device is revalidated, thus always resolving any inconsistency between the write pointer offset of zone write plugs and the actual write pointer position of sequential zones. The Linux kernel CVE team has assigned CVE-2024-55642 to this issue. Affected and fixed versions =========================== Issue introduced in 6.10 with commit dd291d77cc90eb6a86e9860ba8e6e38eebd57d12 and fixed in 6.12.6 with commit 7fa80134cf266325fa61139320091001c9b3c477 Issue introduced in 6.10 with commit dd291d77cc90eb6a86e9860ba8e6e38eebd57d12 and fixed in 6.13-rc3 with commit fe0418eb9bd69a19a948b297c8de815e05f3cde1 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-2024-55642 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: block/blk-zoned.c include/linux/blkdev.h 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/7fa80134cf266325fa61139320091001c9b3c477 https://git.kernel.org/stable/c/fe0418eb9bd69a19a948b297c8de815e05f3cde1