-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
lib: modem_key_mgmt: enable CMEE _after_ taking lock #20185
Conversation
Thank you for your contribution! Note: This comment is automatically posted and updated by the Contribs GitHub Action. |
Hi, and thank you for your contribution!
I think it makes sense to do this in the other functions as well! We should also have a changelog entry for this in the changelog. |
You can find the documentation preview for this PR at this link. Note: This comment is automatically posted by the Documentation Publish GitHub Action. |
27be2b6
to
6e2d2a2
Compare
Would it make sense to put this under "Security", "Libraries" or "Developing with nRF91"? |
It should be under modem libraries. There is already an entry there for the modem key mgmt library. |
6e2d2a2
to
732e6c7
Compare
Hope something like this works? Also I can try to check with @joerchan since I don't think he added his changes to the changelog 😉 |
CI InformationTo view the history of this post, clich the 'edited' button above Inputs:Sources:sdk-nrf: PR head: e69916cc58149e8caf6e283381bb8b17dde6a73b more detailssdk-nrf:
Github labels
List of changed files detected by CI (2)
Outputs:ToolchainVersion: 342151af73 Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped;
|
doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst
Outdated
Show resolved
Hide resolved
Separate PR, got some changes that go with it also :) |
Wait with enabling CMEE until we have managed to acquire the lock. This prevents the following edge case: Thread A calls a function that acquires lock before enabling CMEE, like `read`. Thread B calls one that has the opposite (wrong?) order, like `clear`. 1. Thread A takes lock 2. Thread A enables CMEE (was_enabled = false) 3. Thread A happens to get scheduled out 4. Thread B enables CMEE (was_enabled = true) 5. Thread B blocks on trying to take lock 6. Thread A disables CMEE (since was_enabled == false) and releases lock 7. Thread B takes lock, tries to run command (but CMEE is disabled!) 8. Thread B doesn't try to disable CMEE since it was enabled before. Signed-off-by: Kamil Krzyzanowski <[email protected]>
Add new entry for race condition fix and move the fixes into their own list as suggested by @peknis Signed-off-by: Kamil Krzyzanowski <[email protected]>
732e6c7
to
e69916c
Compare
Fixed the changelog as requested. |
Wait with enabling CMEE until we have managed to acquire the lock. This prevents the following edge case:
Thread A calls a function that acquires lock before enabling CMEE, like
read
.Thread B calls one that has the opposite (wrong?) order, like
clear
.I am also wondering if it could make sense to take the mutex when enabling CMEE in the other functions or if the probability of that being a problem is low enough that there is no point?