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 87F05142E97 for ; Tue, 21 May 2024 15:05:51 +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=1716303951; cv=none; b=U3kjL/v+hxipGUfzSYQYPD/FM2YHbmMNmZXkVUl2MKsg0G9Dp5b/wr3N8+tvC3BswxUqsNRcEoQhvePH1ZRus+axWVoaUl/Xz5qHPBkj/O9lnXy9CYHkWx1/o8Jyc1sqDGiAR2Ke+GPe4W6HmCcyktjq8+TLqJql2kk7pKOXLiM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716303951; c=relaxed/simple; bh=sFJOq6t13ciSnrBwnjFr9oA6/yb/Kia9wE98jATsGy0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JAExdLmKZPZO+/lljbLZgNFRvxyr71LONVE4o6VSSOZI10Yu/vwJRK7exMry8saB7zZIRQDuVX3wSRvA2ZDuCiib5uQJ2tBgQQ1Q81IUIT7FMee4hoOlQTOSZXcuTiVhizUQU4A7jqJK/1ddD88EYr7A6ftnAZXgCo5SWkhiR2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AezfVg+r; 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="AezfVg+r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DAACC2BD11; Tue, 21 May 2024 15:05:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716303951; bh=sFJOq6t13ciSnrBwnjFr9oA6/yb/Kia9wE98jATsGy0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=AezfVg+rogWCwet/GJOGHg6NyLjl32+RueFV6uuST4UjasBqrVPilwZyIhJBOTNtr 1Tk6rvHEkYQ4z7XiYulIj4x90ZExiq2ttuzBgddgDaQLaY6PouOvdcSng+JyfRaAxR MM0F09DzX3QPa/yYDptgICU3SkLTSpWMR2vONpnU= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47396: mac80211-hwsim: fix late beacon hrtimer handling Date: Tue, 21 May 2024 17:04:13 +0200 Message-ID: <2024052148-CVE-2021-47396-42fa@gregkh> X-Mailer: git-send-email 2.45.1 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=3242; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=sFJOq6t13ciSnrBwnjFr9oA6/yb/Kia9wE98jATsGy0=; b=owGbwMvMwCRo6H6F97bub03G02pJDGk+26/su6MSyS7AsfdY3nPvKnFbq+kHtZp337n0cNZlD qE8r3yFjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIpjrDgmslcr3R4grJD388 /P/+pLlF1qTsLIa5Ik+UW4xTLrdm8ZVoNF5YtiF1r2YQAA== 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: mac80211-hwsim: fix late beacon hrtimer handling Thomas explained in https://lore.kernel.org/r/87mtoeb4hb.ffs@tglx that our handling of the hrtimer here is wrong: If the timer fires late (e.g. due to vCPU scheduling, as reported by Dmitry/syzbot) then it tries to actually rearm the timer at the next deadline, which might be in the past already: 1 2 3 N N+1 | | | ... | | ^ intended to fire here (1) ^ next deadline here (2) ^ actually fired here The next time it fires, it's later, but will still try to schedule for the next deadline (now 3), etc. until it catches up with N, but that might take a long time, causing stalls etc. Now, all of this is simulation, so we just have to fix it, but note that the behaviour is wrong even per spec, since there's no value then in sending all those beacons unaligned - they should be aligned to the TBTT (1, 2, 3, ... in the picture), and if we're a bit (or a lot) late, then just resume at that point. Therefore, change the code to use hrtimer_forward_now() which will ensure that the next firing of the timer would be at N+1 (in the picture), i.e. the next interval point after the current time. The Linux kernel CVE team has assigned CVE-2021-47396 to this issue. Affected and fixed versions =========================== Issue introduced in 3.9 with commit 01e59e467ecf and fixed in 5.4.151 with commit 9bee85de2c81 Issue introduced in 3.9 with commit 01e59e467ecf and fixed in 5.10.71 with commit 2c204cf594df Issue introduced in 3.9 with commit 01e59e467ecf and fixed in 5.14.10 with commit ed2adf69e298 Issue introduced in 3.9 with commit 01e59e467ecf and fixed in 5.15 with commit 313bbd1990b6 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-47396 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/net/wireless/mac80211_hwsim.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/9bee85de2c8155388c09a2e1530a243ec1c96f05 https://git.kernel.org/stable/c/2c204cf594df3b9468368dc9d0b24d482d93cda7 https://git.kernel.org/stable/c/ed2adf69e29848d1eb9df99633dde655421c92ed https://git.kernel.org/stable/c/313bbd1990b6ddfdaa7da098d0c56b098a833572