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 5B00F10A03 for ; Wed, 19 Jun 2024 14:54:40 +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=1718808880; cv=none; b=GUV+0QRMN7bJbdGFNLGGiynhbEAVVWtiMbPkZQYVsr4Oz+ozSV8l651V1wqV0EAjBHuq3uu1H6sI1YtzOAghdM5TkzCehjR3LH9EVfh/2eSevUZZ8bomIhCXQPBlXEp+RGEKYvKykQc15F/lzjeQ8fQfQvNMV5sRGnUMOpJ5ohk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718808880; c=relaxed/simple; bh=J1zG+UIkBvn/2Pw1ee+iMAxWyp9bqNP+dlsbPXdcUS4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=vAySGwyhw5WXBvftjiLTbMNcpV7f91NU4N1mk1AQhcpEqegYybub5LxgH9oyp6AuCgVa+rgLdt27dHbRkAcLNGjAmIq4kW9fSPNMXl4ZmVa7KroPkoHtrozj7WRp7rI+WzjPOIrj/puJKkWt7VTEk2qG6XIhbBXkO0lC6XAEPwU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cNN/UgKi; 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="cNN/UgKi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D74CC2BBFC; Wed, 19 Jun 2024 14:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718808879; bh=J1zG+UIkBvn/2Pw1ee+iMAxWyp9bqNP+dlsbPXdcUS4=; h=From:To:Cc:Subject:Date:Reply-to:From; b=cNN/UgKixJfl9IgpWY3i4yFe5U/ZjgOMTgVnD6g2vb8mYCdYe/PlxlMCrm7fs2Jug R2Q8zJNXjybvRBaLydQ9EyGmguiO5PFDHq4O5RshQjfgq7GlN8gJTxlWYu3Qgxjc0C gbU2GyiigkGj4FNOE4mRofIYBFfiK8DMcQlCeX6M= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47584: iocost: Fix divide-by-zero on donation from low hweight cgroup Date: Wed, 19 Jun 2024 16:54:23 +0200 Message-ID: <2024061917-CVE-2021-47584-5246@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=3281; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=J1zG+UIkBvn/2Pw1ee+iMAxWyp9bqNP+dlsbPXdcUS4=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlFHyW/W2rVFjv/emDyec3fbY81p1TyzG0we7xs07b3J 6vO3ZOv64hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJ1DUwzPdZrtxb5/DkYPpT r4U/rqtxirP8jmKYX89u/nKNorGmzeTY//tWVLS+jt95HwA= 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: iocost: Fix divide-by-zero on donation from low hweight cgroup The donation calculation logic assumes that the donor has non-zero after-donation hweight, so the lowest active hweight a donating cgroup can have is 2 so that it can donate 1 while keeping the other 1 for itself. Earlier, we only donated from cgroups with sizable surpluses so this condition was always true. However, with the precise donation algorithm implemented, f1de2439ec43 ("blk-iocost: revamp donation amount determination") made the donation amount calculation exact enabling even low hweight cgroups to donate. This means that in rare occasions, a cgroup with active hweight of 1 can enter donation calculation triggering the following warning and then a divide-by-zero oops. WARNING: CPU: 4 PID: 0 at block/blk-iocost.c:1928 transfer_surpluses.cold+0x0/0x53 [884/94867] ... RIP: 0010:transfer_surpluses.cold+0x0/0x53 Code: 92 ff 48 c7 c7 28 d1 ab b5 65 48 8b 34 25 00 ae 01 00 48 81 c6 90 06 00 00 e8 8b 3f fe ff 48 c7 c0 ea ff ff ff e9 95 ff 92 ff <0f> 0b 48 c7 c7 30 da ab b5 e8 71 3f fe ff 4c 89 e8 4d 85 ed 74 0 4 ... Call Trace: ioc_timer_fn+0x1043/0x1390 call_timer_fn+0xa1/0x2c0 __run_timers.part.0+0x1ec/0x2e0 run_timer_softirq+0x35/0x70 ... iocg: invalid donation weights in /a/b: active=1 donating=1 after=0 Fix it by excluding cgroups w/ active hweight < 2 from donating. Excluding these extreme low hweight donations shouldn't affect work conservation in any meaningful way. The Linux kernel CVE team has assigned CVE-2021-47584 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10 with commit f1de2439ec43 and fixed in 5.10.88 with commit a7c80674538f Issue introduced in 5.10 with commit f1de2439ec43 and fixed in 5.15.11 with commit 3a1a4eb57417 Issue introduced in 5.10 with commit f1de2439ec43 and fixed in 5.16 with commit edaa26334c11 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-2021-47584 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-iocost.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/a7c80674538f15f85d68138240aae440b8039519 https://git.kernel.org/stable/c/3a1a4eb574178c21241a6200f4785572e661c472 https://git.kernel.org/stable/c/edaa26334c117a584add6053f48d63a988d25a6e