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 A79C8190497 for ; Tue, 30 Jul 2024 07:49:57 +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=1722325797; cv=none; b=WGMJ4vL8KvezsT7eZ7qrH0jMkiDnzv/kpHKJ0QK2V/nXvrHB8OwddKYfKwxAJzP+sofUvxsIPdH27E7H4tQH1qqM+YTH4KKgxeD5ZPS5UMkGUzpJ705HHoXnPgv56EUnGRTYCVR0wzD3AxiqA4ZQyFTzu0PQwV9jwd4JvhW+v2c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722325797; c=relaxed/simple; bh=uP2DCP7D9m/YH0IIbwGlDcnld6jIKI2bKDNd1zZNbIQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UvUqBMpd/4KeMpQyraKYXXzfgmsvAh0W75IU9mx/X77BVvnTTFMnNXXlXfKBt3cNU5M+I2xZu4Lh1vPUoRRPSSCeXTE5HrmXVGdbT7x8/Qnnm/dzpliT9KtUVcvhtf34oPsAlEVG/8dwkq+XNGZNZcJHmf41onxPPPfKBZJy+SA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MQCC4FV9; 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="MQCC4FV9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18619C32782; Tue, 30 Jul 2024 07:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722325797; bh=uP2DCP7D9m/YH0IIbwGlDcnld6jIKI2bKDNd1zZNbIQ=; h=From:To:Cc:Subject:Date:Reply-to:From; b=MQCC4FV919dZ7m/tHXAQ9F2cX9iOlJsxraOXoncXHdyBBNRKmmclNb0vW6ageakbR NFVwarG3IHPmsvK4twdt4TrHDW2bE50+O3W1zL6/HaVhqdH5usNXT6aEb0otOWxGOm isDxP9vy4K47iOsT2+u6XeA3KMfeTr5QlwmUir68= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42136: cdrom: rearrange last_media_change check to avoid unintentional overflow Date: Tue, 30 Jul 2024 09:47:54 +0200 Message-ID: <2024073029-CVE-2024-42136-5f6e@gregkh> X-Mailer: git-send-email 2.45.2 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=3269; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=uP2DCP7D9m/YH0IIbwGlDcnld6jIKI2bKDNd1zZNbIQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkrZk1UcDPwnMn36N/OeYL8zE486dOmzbd6O99WKOD1j s6eu1V1HbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRq/UM8xR7HXeqv1A9dOig tXlrsk6RzIuDfAxzJef1vVJcF+HXZulw6rr/14NnX7E1AQA= 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: cdrom: rearrange last_media_change check to avoid unintentional overflow When running syzkaller with the newly reintroduced signed integer wrap sanitizer we encounter this splat: [ 366.015950] UBSAN: signed-integer-overflow in ../drivers/cdrom/cdrom.c:2361:33 [ 366.021089] -9223372036854775808 - 346321 cannot be represented in type '__s64' (aka 'long long') [ 366.025894] program syz-executor.4 is using a deprecated SCSI ioctl, please convert it to SG_IO [ 366.027502] CPU: 5 PID: 28472 Comm: syz-executor.7 Not tainted 6.8.0-rc2-00035-gb3ef86b5a957 #1 [ 366.027512] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 [ 366.027518] Call Trace: [ 366.027523] [ 366.027533] dump_stack_lvl+0x93/0xd0 [ 366.027899] handle_overflow+0x171/0x1b0 [ 366.038787] ata1.00: invalid multi_count 32 ignored [ 366.043924] cdrom_ioctl+0x2c3f/0x2d10 [ 366.063932] ? __pm_runtime_resume+0xe6/0x130 [ 366.071923] sr_block_ioctl+0x15d/0x1d0 [ 366.074624] ? __pfx_sr_block_ioctl+0x10/0x10 [ 366.077642] blkdev_ioctl+0x419/0x500 [ 366.080231] ? __pfx_blkdev_ioctl+0x10/0x10 ... Historically, the signed integer overflow sanitizer did not work in the kernel due to its interaction with `-fwrapv` but this has since been changed [1] in the newest version of Clang. It was re-enabled in the kernel with Commit 557f8c582a9ba8ab ("ubsan: Reintroduce signed overflow sanitizer"). Let's rearrange the check to not perform any arithmetic, thus not tripping the sanitizer. The Linux kernel CVE team has assigned CVE-2024-42136 to this issue. Affected and fixed versions =========================== Fixed in 6.1.98 with commit 0c97527e9160 Fixed in 6.6.39 with commit 3ee21e14c8c3 Fixed in 6.9.9 with commit e809bc112712 Fixed in 6.10 with commit efb905aeb44b 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-42136 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/cdrom/cdrom.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/0c97527e916054acc4a46ffb02842988acb2e92b https://git.kernel.org/stable/c/3ee21e14c8c329168a0b66bab00ecd18f5d0dee3 https://git.kernel.org/stable/c/e809bc112712da8f7e15822674c6562da6cdf24c https://git.kernel.org/stable/c/efb905aeb44b0e99c0e6b07865b1885ae0471ebf