-
Notifications
You must be signed in to change notification settings - Fork 10
mptcp: cope racing subflow creation in mptcp_rcv_space_adjust #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jira VULN-46444 cve CVE-2024-53122 commit-author Paolo Abeni <[email protected]> commit ce7356a Additional active subflows - i.e. created by the in kernel path manager - are included into the subflow list before starting the 3whs. A racing recvmsg() spooling data received on an already established subflow would unconditionally call tcp_cleanup_rbuf() on all the current subflows, potentially hitting a divide by zero error on the newly created ones. Explicitly check that the subflow is in a suitable state before invoking tcp_cleanup_rbuf(). Fixes: c76c695 ("mptcp: call tcp_cleanup_rbuf on subflows") Signed-off-by: Paolo Abeni <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/02374660836e1b52afc91966b7535c8c5f7bafb0.1731060874.git.pabeni@redhat.com Signed-off-by: Jakub Kicinski <[email protected]> (cherry picked from commit ce7356a) Signed-off-by: Anmol Jain <[email protected]>
Great first PR! I noticed a few things, please rectify them.
You can edit the PR and,
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! @jainanmol84 🥌
I looked at this and got a merge conflict on the fuzz above the conflicted change.
Because the Since it looks like they're exclusively referring to I'm not going to block this for an update since we don't have a codified method of dealing with conflicts in surrounding code but usually if the code in conflict shares the same variables / symbols we might want to mention it, even if its not in the commit message and what we learned. Maybe we add this to the PR as like an due diligence check, I could open a discussion on an Issue for public committers to |
Mentioning merge conflicts for surrounding code in the PR seems like a good idea. I've typically not mentioned them in the 'upstream-diff' section of the commit message with the justification that they technically aren't a difference from the code that was changed in the upstream commit. However I do look at those surrounding conflicts and make a determination about whether they are relevant or not. Not mentioning them at all might prevent the case where a reviewer makes a different determination as to their relevance than I did. In this particular case I also noticed the surrounding difference and also determined that I didn't think they were relevant to the changeset under review. TLDR; For backported code, let's mention merge conflicts in the code surrounding the code change under review at least in the PR, or even in an 'upstream-diff' commit log section if you think it might be useful to a future commit log reader. Merge away @jainanmol84 |
FWIW, the upstream stable backport to 6.1.119 mentioned in https://lore.kernel.org/linux-cve-announce/2024120252-CVE-2024-53122-f35c@gregkh/T/#u also has this without the $ git show 24995851d58c --pretty=fuller
commit 24995851d58c4a205ad0ffa7b2f21e479a9c8527
Author: Paolo Abeni <[email protected]>
AuthorDate: Tue Nov 19 09:35:49 2024 +0100
Commit: Greg Kroah-Hartman <[email protected]>
CommitDate: Fri Nov 22 15:37:33 2024 +0100
mptcp: cope racing subflow creation in mptcp_rcv_space_adjust
commit ce7356ae35943cc6494cc692e62d51a734062b7d upstream.
Additional active subflows - i.e. created by the in kernel path
manager - are included into the subflow list before starting the
3whs.
A racing recvmsg() spooling data received on an already established
subflow would unconditionally call tcp_cleanup_rbuf() on all the
current subflows, potentially hitting a divide by zero error on
the newly created ones.
Explicitly check that the subflow is in a suitable state before
invoking tcp_cleanup_rbuf().
Fixes: c76c6956566f ("mptcp: call tcp_cleanup_rbuf on subflows")
Signed-off-by: Paolo Abeni <[email protected]>
Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
Link: https://patch.msgid.link/02374660836e1b52afc91966b7535c8c5f7bafb0.1731060874.git.pabeni@redhat.com
Signed-off-by: Jakub Kicinski <[email protected]>
[ Conflicts in protocol.c, because commit f410cbea9f3d ("tcp: annotate
data-races around tp->window_clamp") has not been backported to this
version. The conflict is easy to resolve, because only the context is
different, but not the line to modify. ]
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 78ac5c538e13..1acd4e37a0ea 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2057,7 +2057,8 @@ static void mptcp_rcv_space_adjust(struct mptcp_sock *msk, int copied)
slow = lock_sock_fast(ssk);
WRITE_ONCE(ssk->sk_rcvbuf, rcvbuf);
tcp_sk(ssk)->window_clamp = window_clamp;
- tcp_cleanup_rbuf(ssk, 1);
+ if (tcp_can_send_ack(ssk))
+ tcp_cleanup_rbuf(ssk, 1);
unlock_sock_fast(ssk, slow);
}
} What's important is to not try backporting this fix to kernels that don't have the commit listed in Fixes. According to RH, they fixed this even for EL8, so perhaps they had backported the buggy commit to there - but this doesn't tell us when they did that. We may have 8.x LTS branches that don't have that, so need to be careful to check first. |
Here's how the same conflict is mentioned in the upstream stable commit I quoted above:
|
Re: Merge conflict This PR exists as the result of me helping Amol get familiar with the Kernel CVE process by making her fix one CVE and assisting in that. I focused on the process of it and not much on the CVE fix itself because I believe that Anmol can/should handle that, given her experience with userspace CVEs. Given that the issue was introduced with v5.10, when we were presented with a merge conflict, I suggested that we pull in the patch from v5.15--the closest longterm tree. The commit's message is generated by our cherry pick script but the actual diff is from the patch merged in the v5.15 tree: https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/net/mptcp/protocol.c?h=v5.15.179&id=0a9a182ea5c7bb0374e527130fd85024ace7279b +1 on mentioning if there is a merge conflict and the engineer's solution for it. |
As long as we always use the Upstream Commit SHA but you can see that RedHat made changes from the 5.10. so a different line would have been in conflict but ultimately still in contextual information. I have updates I need to do to the WIKI anyways to remove RT stuff so maybe I'll include that if everyone generally agrees. |
Commit <5518f239aff1> ("iommu/vt-d: Move scalable mode ATS enablement to probe path") changed the PCI ATS enablement logic to run earlier, specifically before the default domain attachment. On some client platforms, this change resulted in boot failures, causing the kernel to panic with the following message and call trace: Kernel panic - not syncing: DMAR hardware is malfunctioning CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.14.0-rc3+ #175 Call Trace: <TASK> dump_stack_lvl+0x6f/0xb0 dump_stack+0x10/0x16 panic+0x10a/0x2b7 iommu_enable_translation.cold+0xc/0xc intel_iommu_init+0xe39/0xec0 ? trace_hardirqs_on+0x1e/0xd0 ? __pfx_pci_iommu_init+0x10/0x10 pci_iommu_init+0xd/0x40 do_one_initcall+0x5b/0x390 kernel_init_freeable+0x26d/0x2b0 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x15/0x120 ret_from_fork+0x35/0x60 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1a/0x30 RIP: 1f0f:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0000:0000000000000000 EFLAGS: 841f0f2e66 ORIG_RAX: 1f0f2e6600000000 RAX: 0000000000000000 RBX: 1f0f2e6600000000 RCX: 2e66000000000084 RDX: 0000000000841f0f RSI: 000000841f0f2e66 RDI: 00841f0f2e660000 RBP: 00841f0f2e660000 R08: 00841f0f2e660000 R09: 000000841f0f2e66 R10: 0000000000841f0f R11: 2e66000000000084 R12: 000000841f0f2e66 R13: 0000000000841f0f R14: 2e66000000000084 R15: 1f0f2e6600000000 </TASK> ---[ end Kernel panic - not syncing: DMAR hardware is malfunctioning ]--- Fix this by reverting the timing change for ATS enablement introduced by the offending commit and restoring the previous behavior. Fixes: 5518f23 ("iommu/vt-d: Move scalable mode ATS enablement to probe path") Reported-by: Jarkko Nikula <[email protected]> Closes: https://lore.kernel.org/linux-iommu/[email protected]/ Signed-off-by: Lu Baolu <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
commit 4f1492e Author: Lu Baolu <[email protected]> Date: Wed Apr 16 15:36:08 2025 +0800 iommu/vt-d: Revert ATS timing change to fix boot failure Commit <5518f239aff1> ("iommu/vt-d: Move scalable mode ATS enablement to probe path") changed the PCI ATS enablement logic to run earlier, specifically before the default domain attachment. On some client platforms, this change resulted in boot failures, causing the kernel to panic with the following message and call trace: Kernel panic - not syncing: DMAR hardware is malfunctioning CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.14.0-rc3+ #175 Call Trace: <TASK> dump_stack_lvl+0x6f/0xb0 dump_stack+0x10/0x16 panic+0x10a/0x2b7 iommu_enable_translation.cold+0xc/0xc intel_iommu_init+0xe39/0xec0 ? trace_hardirqs_on+0x1e/0xd0 ? __pfx_pci_iommu_init+0x10/0x10 pci_iommu_init+0xd/0x40 do_one_initcall+0x5b/0x390 kernel_init_freeable+0x26d/0x2b0 ? __pfx_kernel_init+0x10/0x10 kernel_init+0x15/0x120 ret_from_fork+0x35/0x60 ? __pfx_kernel_init+0x10/0x10 ret_from_fork_asm+0x1a/0x30 RIP: 1f0f:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0000:0000000000000000 EFLAGS: 841f0f2e66 ORIG_RAX: 1f0f2e6600000000 RAX: 0000000000000000 RBX: 1f0f2e6600000000 RCX: 2e66000000000084 RDX: 0000000000841f0f RSI: 000000841f0f2e66 RDI: 00841f0f2e660000 RBP: 00841f0f2e660000 R08: 00841f0f2e660000 R09: 000000841f0f2e66 R10: 0000000000841f0f R11: 2e66000000000084 R12: 000000841f0f2e66 R13: 0000000000841f0f R14: 2e66000000000084 R15: 1f0f2e6600000000 </TASK> ---[ end Kernel panic - not syncing: DMAR hardware is malfunctioning ]--- Fix this by reverting the timing change for ATS enablement introduced by the offending commit and restoring the previous behavior. Fixes: 5518f23 ("iommu/vt-d: Move scalable mode ATS enablement to probe path") Reported-by: Jarkko Nikula <[email protected]> Closes: https://lore.kernel.org/linux-iommu/[email protected]/ Signed-off-by: Lu Baolu <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]> (cherry picked from commit 4f1492e) Upstream-Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Signed-off-by: Jerry Snitselaar <[email protected]> JIRA: https://issues.redhat.com/browse/RHEL-89891
Commit message
Kernel build logs
kernel-build.log
kernel-build.log
Kselftests
kselftest-after.log
kselftest-before.log