-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add tls cleanup to protect tcp #14866
Conversation
… after free Problem Description: Problem occurrence when Thread1 creat connect/recv socket and Thread2 cancel Thread1. 1. Thread2 cancel when Thread1 connect event, will cause DEBUGASSERT in devif_callback_free.Because cb in g_cbfreelist. 2. Thread2 cancel when Thread1 recvfrom sem-wait, when the FIN packet input and will trigger tcp_recvhandler and will crash.Becuase some thread stack data was freed. Signed-off-by: meijian <[email protected]>
assert: tcp conn and didn't recv ack, tcp_free will assert in L909 and no need to tcp free because tcp close will free by lpwork. Signed-off-by: meijian <[email protected]>
[Experimental Bot, please feedback here] No, this PR description does not meet the NuttX requirements. It's far too brief and lacks critical information. Here's why and how it can be improved: Summary:
Impact:
Testing:
Example of an Improved Summary: "This PR addresses an issue where abnormal application exits were causing resource leaks and potential instability in the TCP/IP stack due to incomplete TLS cleanup. The change adds a new cleanup function in the By providing more specific information and following the template closely, the PR review process will be much more efficient. Reviewers will have the context they need to understand the change and its implications. |
Summary
This PR addresses an issue where abnormal application exits were causing crash in the TCP/IP stack due to tcp conn will be used after free.
Impact
tcp_send / tcp_recv / tcp_connect
Impact on user: YES (Applications using TCP will now have improved stability on abnormal exit).
Impact on build: NO
Impact on hardware: NO
Impact on documentation: YES (Documentation should be updated to describe the new TLS cleanup mechanism and how it prevents issues on application exit)
Impact on security: Potentially YES (If the abnormal exit was exploitable, this fix might improve security. Explain clearly).
Impact on compatibility: NO (If this is true, state it explicitly)
Testing
Target: sim and others product by monkey
Log: see " pthread is being canceled, need to cleanup cb",and device didn't crash