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 969621EB9EF for ; Mon, 21 Oct 2024 18:54:46 +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=1729536886; cv=none; b=Xku3hxe3R3gleWoKA8pdW52qSD8s4cWBXJM/9wtJzXhPJH1ZhXXr0z1Rb/mF1vu0rZ/dwGMDFRU1vvdrw/b0jEiorkzoZi57w0FtHk2E6MyXfX1B00NF7IUiBXmpgwLWRyBRaXZ3ygKDBwq0qRIkYUQHYJ6ewV7tUDySQL5x93A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729536886; c=relaxed/simple; bh=pEuYkqPycv70T6j20iwluHbTBwa35pUmMiou9p/knsk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JMASyu97gvOlYk3bjG+QJixU+FGD21lxsGI14Z5M4cyg4fiLFeXqi13fWQ7ocSu4JWwBQqWOcYjFnF1F5Q5UGm5X7UdGxtXzJOmH/CZyMRE0NIzQ+jvHsYzr/kQOHTZLNk6+k1R+Q8RoDcpv9HgGOilLSwh8x5Rd7AZgkl2OL1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=aOBVuOuH; 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="aOBVuOuH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18AD9C4CEC3; Mon, 21 Oct 2024 18:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1729536886; bh=pEuYkqPycv70T6j20iwluHbTBwa35pUmMiou9p/knsk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=aOBVuOuH+khtmI1KnEhVcKOc/gj4xxvnyDxJ9/MFL7xkNv+S0aemaeVC7qr7sZRpc HFUsO7MOI27vGxsMo8RqKoEvWh1esEs2JD7q0AoxNTUuEHRT5RRhfqfT7Aw6C4zSAv eqJTWIzIDdTcGeTdkAtfcj4rfjbzBi/ZEytNAfn4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-50018: net: napi: Prevent overflow of napi_defer_hard_irqs Date: Mon, 21 Oct 2024 20:54:22 +0200 Message-ID: <2024102111-CVE-2024-50018-65e9@gregkh> X-Mailer: git-send-email 2.47.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=2997; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=pEuYkqPycv70T6j20iwluHbTBwa35pUmMiou9p/knsk=; b=owGbwMvMwCRo6H6F97bub03G02pJDOlii4NPuRW9a6m78u9xpP/FwoMLrlX47Tn4aOaCQ5kbr xkLXrA26IhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJJAozzLOV7VJ6u/WWZuEu xnO6f0ovfa3SyGeYH7GvR/DQTR2hRcmvUrnWntnBssNzNwA= 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: net: napi: Prevent overflow of napi_defer_hard_irqs In commit 6f8b12d661d0 ("net: napi: add hard irqs deferral feature") napi_defer_irqs was added to net_device and napi_defer_irqs_count was added to napi_struct, both as type int. This value never goes below zero, so there is not reason for it to be a signed int. Change the type for both from int to u32, and add an overflow check to sysfs to limit the value to S32_MAX. The limit of S32_MAX was chosen because the practical limit before this patch was S32_MAX (anything larger was an overflow) and thus there are no behavioral changes introduced. If the extra bit is needed in the future, the limit can be raised. Before this patch: $ sudo bash -c 'echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs' $ cat /sys/class/net/eth4/napi_defer_hard_irqs -2147483647 After this patch: $ sudo bash -c 'echo 2147483649 > /sys/class/net/eth4/napi_defer_hard_irqs' bash: line 0: echo: write error: Numerical result out of range Similarly, /sys/class/net/XXXXX/tx_queue_len is defined as unsigned: include/linux/netdevice.h: unsigned int tx_queue_len; And has an overflow check: dev_change_tx_queue_len(..., unsigned long new_len): if (new_len != (unsigned int)new_len) return -ERANGE; The Linux kernel CVE team has assigned CVE-2024-50018 to this issue. Affected and fixed versions =========================== Fixed in 6.10.14 with commit d694ad8b7e50 Fixed in 6.11.3 with commit 5e753b743d3b Fixed in 6.12-rc1 with commit 08062af0a521 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-50018 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: Documentation/networking/net_cachelines/net_device.rst include/linux/netdevice.h net/core/net-sysfs.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/d694ad8b7e5004df86ecd415cb2320d543723672 https://git.kernel.org/stable/c/5e753b743d3b38a3e10be666c32c5434423d0093 https://git.kernel.org/stable/c/08062af0a52107a243f7608fd972edb54ca5b7f8