Skip to content
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

CCB: Fix potential deadlock in PolicyHandler #3176

Closed
LitvinenkoIra opened this issue Dec 6, 2019 · 4 comments
Closed

CCB: Fix potential deadlock in PolicyHandler #3176

LitvinenkoIra opened this issue Dec 6, 2019 · 4 comments

Comments

@LitvinenkoIra
Copy link
Contributor

Bug Report

Potential deadlock in PolicyHandler

Detailed analysis:

There is a vulnerability in the PolicyHandler which causes a mutex deadlock. For example - MessageLoop thread of RpcService handles incoming messages. In case when SDL receives AllowSDLFunctionality notification, this thread calls OnAllowSDLFunctionalityNotification inside PolicyHandler. At some point of time this function captures accessor from AM which holds applications_list_lock_ there. At this moment thread AM Pool 0 of RequestController processes some RPC from queue and captures policy_manager_lock_ in PolicyHandler. After that at
some moment thread AM Pool 0 tries to get application shared pointer from AM and locks itself as this mutex are already locked with thread MessageLoop. Also, MessageLoop thread at some moment tries to acquire policy_manager_lock_ and locks itself as this mutex are already locked with thread AM Pool 0, which is waiting for applications_list_lock_ to unlock. As a result we have a
classical thread deadlock after which SDL stuck forever.

To avoid such situations, all bottlenecks related to
applications_list_lock_ and its accessors should be analyzed . Accessors should be scoped in several places to avoid similar deadlocks in the future.

Reproduction Steps
  1. Start SDL, HMI, connect Mobile
  2. Trigger PTU
  3. Send VR.ChangeLanguage
Expected Behavior

SDL should not crash

Observed Behavior

SDL crashed

OS & Version Information

@E-SAITO-TMC
Copy link

E-SAITO-TMC commented Apr 17, 2020

@joeygrover -san @theresalech -san This issue is a top priority for Toyota. Can the reproduction steps described actually reproduce this issue? Also, does this issue occur in the latest version?

@theresalech
Copy link
Contributor

Hi @E-SAITO-TMC, we have documented that this is priority for Toyota, and will include for Steering Committee review and vote when planning the contents for the Q4 Core release. This planning will take place in June.
@LitvinenkoIra, can you please advise if the Luxoft team is seeing this issue in Core 6.1?

@theresalech theresalech added the Waiting for Feedback Maintainers are waiting for feedback from an author or contributor label Apr 23, 2020
@LuxoftAKutsan
Copy link
Contributor

@theresalech
Issue reproduced on SYNC version of SDL.
On open source version of SDL issue may be non reproducible.
Script will be created.
Fix from SYNC ported to open #3383

@theresalech theresalech added fix submitted and removed Waiting for Feedback Maintainers are waiting for feedback from an author or contributor labels May 20, 2020
@jacobkeeler
Copy link
Contributor

Closing with the merge of #3383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants