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 1D20A524A5 for ; Fri, 17 May 2024 13:24:38 +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=1715952279; cv=none; b=alGDiD3X4G9b6Lue/brBDFwr1S0COtWTBa2rpbaI+ZeitkVsb6GBuOeVuIIK5hyelg0SkTNJ8aOBG7yFMgV9d2qR5Cee2KjmheQE14r6FTa5rjE1Cau8cq4lpmanO94HUAUTKw6YGNM+WO2MjmtmQmMsdF6Zt9ge+gJ1QW6aCkI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715952279; c=relaxed/simple; bh=R8m2VazHHN2McVo4wDAKNAtLmlWNf+XpRCFZmldINP8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CStRb9l8HSn6jmq+HHuHA2q5Uv+EL7jCFE7//ZgdMoI5MV5RW+PQ/Suiizl+7DYRvigbWERh/DxhIQyJdMnXxOwtzAWiiCQOpqfF+rLUlskWZZV0Kr0kNdhkel6Guw71pK3hqDHlV3Ror/LCoXvPw+p3DKhE7T4rLMSlq0fNr40= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hj8yATcD; 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="hj8yATcD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40421C2BD10; Fri, 17 May 2024 13:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1715952278; bh=R8m2VazHHN2McVo4wDAKNAtLmlWNf+XpRCFZmldINP8=; h=From:To:Cc:Subject:Date:Reply-to:From; b=hj8yATcDEL93ODFk3QKQsFyei+YKJHH9OGcGUbbbtgDvl4OwQvFUgIir1Fxd+Zq3E tqc3NkgpqJ53YaZOPfRjAHuKw4tcf0aGp6wm20FbmAeU+jaKQDQLXDoP8g6inWvmaC dbp2fh2EFXJxot2BpHYSg08PRvP/hD0+eP0n3MUc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35818: LoongArch: Define the __io_aw() hook as mmiowb() Date: Fri, 17 May 2024 15:23:58 +0200 Message-ID: <2024051743-CVE-2024-35818-d446@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=4435; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=R8m2VazHHN2McVo4wDAKNAtLmlWNf+XpRCFZmldINP8=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnuUfHyboIyqz5++bzFeokpp4vQf07L9XdXBJdnVb7eL c6953lNRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEyE/xXDgtMzOSdNbP6/JqCt c/uEyz4iISY8pxjm2UhaB+2JmCLUxZFi1PvgPpPSzuXPAA== 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: LoongArch: Define the __io_aw() hook as mmiowb() Commit fb24ea52f78e0d595852e ("drivers: Remove explicit invocations of mmiowb()") remove all mmiowb() in drivers, but it says: "NOTE: mmiowb() has only ever guaranteed ordering in conjunction with spin_unlock(). However, pairing each mmiowb() removal in this patch with the corresponding call to spin_unlock() is not at all trivial, so there is a small chance that this change may regress any drivers incorrectly relying on mmiowb() to order MMIO writes between CPUs using lock-free synchronisation." The mmio in radeon_ring_commit() is protected by a mutex rather than a spinlock, but in the mutex fastpath it behaves similar to spinlock. We can add mmiowb() calls in the radeon driver but the maintainer says he doesn't like such a workaround, and radeon is not the only example of mutex protected mmio. So we should extend the mmiowb tracking system from spinlock to mutex, and maybe other locking primitives. This is not easy and error prone, so we solve it in the architectural code, by simply defining the __io_aw() hook as mmiowb(). And we no longer need to override queued_spin_unlock() so use the generic definition. Without this, we get such an error when run 'glxgears' on weak ordering architectures such as LoongArch: radeon 0000:04:00.0: ring 0 stalled for more than 10324msec radeon 0000:04:00.0: ring 3 stalled for more than 10240msec radeon 0000:04:00.0: GPU lockup (current fence id 0x000000000001f412 last fence id 0x000000000001f414 on ring 3) radeon 0000:04:00.0: GPU lockup (current fence id 0x000000000000f940 last fence id 0x000000000000f941 on ring 0) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) radeon 0000:04:00.0: scheduling IB failed (-35). [drm:radeon_gem_va_ioctl [radeon]] *ERROR* Couldn't update BO_VA (-35) The Linux kernel CVE team has assigned CVE-2024-35818 to this issue. Affected and fixed versions =========================== Fixed in 6.1.84 with commit 97cd43ba824a Fixed in 6.6.24 with commit d7d7c6cdea87 Fixed in 6.7.12 with commit 0b61a7dc6712 Fixed in 6.8.3 with commit 9adec248bba3 Fixed in 6.9 with commit 9c68ece8b2a5 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-35818 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: arch/loongarch/include/asm/Kbuild arch/loongarch/include/asm/io.h arch/loongarch/include/asm/qspinlock.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/97cd43ba824aec764f5ea2790d0c0a318f885167 https://git.kernel.org/stable/c/d7d7c6cdea875be3b241d7d39873bb431db7154d https://git.kernel.org/stable/c/0b61a7dc6712b78799b3949997e8a5e94db5c4b0 https://git.kernel.org/stable/c/9adec248bba33b1503252caf8e59d81febfc5ceb https://git.kernel.org/stable/c/9c68ece8b2a5c5ff9b2fcaea923dd73efeb174cd