From mboxrd@z Thu Jan 1 00:00:00 1970 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 410681CAB9 for ; Thu, 22 Aug 2024 03:32:59 +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=1724297580; cv=none; b=Hm0zhQaYLwR/p5Al5tSV0N0v4ryngwqAHx04nKOgRNM0crHCBjBS07T233/Xo0BoIEwz7Bi/AcaHnovhHJhl8S2jNmg1l1Wwt/48TjZSONVTogZ0UbVS249r0SOSJREXh2i0XOs1tQBhi65GTQweoHg2iugsAL4Xporn7vyYaFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724297580; c=relaxed/simple; bh=mnKf3yd4oeOOEIrMzQSprURvaY83nLnFBRltchT6I74=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=pPQbmOFUu8fygCnnAS9PK8o6gpGowIRONpy0XAsoZCRsSR+VBqivBPnOjnnhkwmkiuvraV6xO79j6LENEUu3Lgm99xBFC0pnKLbXd0LdshhdOUxSfsQ1MdpZ6G5SdUu/+y3zhkS4WfiMFFnKLo6wJmJLWEahwhXYNzmkd6JNEeU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WbwOG1GZ; 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="WbwOG1GZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A00C4AF09; Thu, 22 Aug 2024 03:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724297579; bh=mnKf3yd4oeOOEIrMzQSprURvaY83nLnFBRltchT6I74=; h=From:To:Cc:Subject:Date:Reply-to:From; b=WbwOG1GZGh6gLIgl5tC5Ttg04NcH1djZwy2Hh5IqYzjCUm6AZVtIEUYli+pxKVEuU 7meszxBayvSyvQfqvTRCTcE9ROBJKe9dUay/Eohk8NA2OkwsA8akL24vJR0O1/OjHr b4T4/vlTVecEw6NfNjAq7a96S7MGOfXEkXe5Bdjw= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48921: sched/fair: Fix fault in reweight_entity Date: Thu, 22 Aug 2024 11:31:22 +0800 Message-ID: <2024082218-CVE-2022-48921-5016@gregkh> X-Mailer: git-send-email 2.46.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=3445; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=mnKf3yd4oeOOEIrMzQSprURvaY83nLnFBRltchT6I74=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnHNrJzfq9snDZ3hb1e8ruXfA2nXd5MCFz071Truw+vd 3/YZzd7WkcsC4MgE4OsmCLLl208R/dXHFL0MrQ9DTOHlQlkCAMXpwBM5M9Thvn12pvWv3gjMikk 9776risR9/cZcX9imKez/+UMbWbv73du33HvKM06tof1wX4A X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: sched/fair: Fix fault in reweight_entity Syzbot found a GPF in reweight_entity. This has been bisected to commit 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an invalid sched_task_group") There is a race between sched_post_fork() and setpriority(PRIO_PGRP) within a thread group that causes a null-ptr-deref in reweight_entity() in CFS. The scenario is that the main process spawns number of new threads, which then call setpriority(PRIO_PGRP, 0, -20), wait, and exit. For each of the new threads the copy_process() gets invoked, which adds the new task_struct and calls sched_post_fork() for it. In the above scenario there is a possibility that setpriority(PRIO_PGRP) and set_one_prio() will be called for a thread in the group that is just being created by copy_process(), and for which the sched_post_fork() has not been executed yet. This will trigger a null pointer dereference in reweight_entity(), as it will try to access the run queue pointer, which hasn't been set. Before the mentioned change the cfs_rq pointer for the task has been set in sched_fork(), which is called much earlier in copy_process(), before the new task is added to the thread_group. Now it is done in the sched_post_fork(), which is called after that. To fix the issue the remove the update_load param from the update_load param() function and call reweight_task() only if the task flag doesn't have the TASK_NEW flag set. The Linux kernel CVE team has assigned CVE-2022-48921 to this issue. Affected and fixed versions =========================== Issue introduced in 5.10.80 with commit c85c6fadbef0 and fixed in 5.10.137 with commit 8f317cd88805 Issue introduced in 5.15.3 with commit 3869eecf0504 and fixed in 5.15.27 with commit e0bcd6b57793 Issue introduced in 5.16 with commit 4ef0c5c6b5ba and fixed in 5.16.13 with commit 589a954daab5 Issue introduced in 5.16 with commit 4ef0c5c6b5ba and fixed in 5.17 with commit 13765de8148f Issue introduced in 5.14.19 with commit 25d40b828fb8 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-2022-48921 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: kernel/sched/core.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/8f317cd888059c59e2fa924bf4b0957cfa53f78e https://git.kernel.org/stable/c/e0bcd6b5779352aed88f2e538a82a39f1a7715bb https://git.kernel.org/stable/c/589a954daab5e18399860b6c8ffaeaf79844eb20 https://git.kernel.org/stable/c/13765de8148f71fa795e0a6607de37c49ea5915a