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 719C115098C for ; Thu, 22 Feb 2024 16:22:35 +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=1708618955; cv=none; b=kWGy2hvMa/QAhcVDRc1PzvgpcLZsHJMOshYa9VOjXbWm2kkTmpCM7ZfxmWwaTw2mxdTY4H7b8Kt8C7/3qJSHFnx6pt39kaHompTf0xlCZ0DBzN9aHXx1ih3r4gXmfGxGVlURlX/A017Wx3Ssgm3NUr2ep+uENGhRVjjiABjAYSY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708618955; c=relaxed/simple; bh=PQDAG8l6DZtDkHWYkQbLqrDaB8jsfaoAPTiylxiZ0JM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bKUSGTdGP3HHpJGjmaKF7dVOBo9aRquLvetIVdwLLopzLxxxahXhYlpzvffvgR1B9uhVcoazMInloBLJa9a8EdQV/MFmDNGh3P/efTBMpYteA4SIe/uHmcII4OUKjcqMvency4Myc6uIC3FOOxWeCVAWSoKs2OZ/Co67787CIME= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TXI+ursh; 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="TXI+ursh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90F95C433C7; Thu, 22 Feb 2024 16:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1708618955; bh=PQDAG8l6DZtDkHWYkQbLqrDaB8jsfaoAPTiylxiZ0JM=; h=From:To:Cc:Subject:Date:Reply-to:From; b=TXI+urshQsdYUIbf0qu80pZJ1TD673BO0yuU1zIUDoF577KuxZ8ZqXlUQM6TH2Pok zGrluvkncXBaZ8JlWx2Hq/Br1yqmdmctaysjFXEUKnfoR3rltGH9fD5qhOJV5OQbcE gOPaUmlrgdLgE6f0JRQMy5HYCJ3CNYG8BIqwkp3o= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-26591: bpf: Fix re-attachment branch in bpf_tracing_prog_attach Date: Thu, 22 Feb 2024 17:21:59 +0100 Message-ID: <2024022258-CVE-2024-26591-8b42@gregkh> X-Mailer: git-send-email 2.43.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=3234; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=PQDAG8l6DZtDkHWYkQbLqrDaB8jsfaoAPTiylxiZ0JM=; b=owGbwMvMwCRo6H6F97bub03G02pJDKnXS5YtOdD4pf1Fsfcmg6ePhSJi1a9JVQZcbfkcUfy6K Kjn26drHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCR4lkMCyZyXn2k8rzrSr0N w47Nq/VyL7Rk72NYsFXhzStTf5bujsV8bpuT2o0E8qQSAQ== 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: bpf: Fix re-attachment branch in bpf_tracing_prog_attach The following case can cause a crash due to missing attach_btf: 1) load rawtp program 2) load fentry program with rawtp as target_fd 3) create tracing link for fentry program with target_fd = 0 4) repeat 3 In the end we have: - prog->aux->dst_trampoline == NULL - tgt_prog == NULL (because we did not provide target_fd to link_create) - prog->aux->attach_btf == NULL (the program was loaded with attach_prog_fd=X) - the program was loaded for tgt_prog but we have no way to find out which one BUG: kernel NULL pointer dereference, address: 0000000000000058 Call Trace: ? __die+0x20/0x70 ? page_fault_oops+0x15b/0x430 ? fixup_exception+0x22/0x330 ? exc_page_fault+0x6f/0x170 ? asm_exc_page_fault+0x22/0x30 ? bpf_tracing_prog_attach+0x279/0x560 ? btf_obj_id+0x5/0x10 bpf_tracing_prog_attach+0x439/0x560 __sys_bpf+0x1cf4/0x2de0 __x64_sys_bpf+0x1c/0x30 do_syscall_64+0x41/0xf0 entry_SYSCALL_64_after_hwframe+0x6e/0x76 Return -EINVAL in this situation. The Linux kernel CVE team has assigned CVE-2024-26591 to this issue. Affected and fixed versions =========================== Issue introduced in 5.13 with commit f3a95075549e0 and fixed in 5.15.148 with commit a7b98aa10f89 Issue introduced in 5.13 with commit f3a95075549e0 and fixed in 6.1.75 with commit 6cc9c0af0aa0 Issue introduced in 5.13 with commit f3a95075549e0 and fixed in 6.6.14 with commit 8c8bcd45e9b1 Issue introduced in 5.13 with commit f3a95075549e0 and fixed in 6.7.2 with commit 50ae82f080cf Issue introduced in 5.13 with commit f3a95075549e0 and fixed in 6.8-rc1 with commit 715d82ba636c Please see https://www.kernel.org or 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-26591 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/bpf/syscall.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/a7b98aa10f895e2569403896f2d19b73b6c95653 https://git.kernel.org/stable/c/6cc9c0af0aa06f781fa515a1734b1a4239dfd2c0 https://git.kernel.org/stable/c/8c8bcd45e9b10eef12321f08d2e5be33d615509c https://git.kernel.org/stable/c/50ae82f080cf87e84828f066c31723b781d68f5b https://git.kernel.org/stable/c/715d82ba636cb3629a6e18a33bb9dbe53f9936ee