citadeld: Fix deadlock due to missing unique_lock scope

In CitadelProxy::callApp(), we need to release the app-specific
lock before we invoke _stats_collection.schedule(). Otherwise,
the deferred callback may also try to grab that lock, causing deadlock:

  callApp:   hold _appLocks[], call schedule() => block on _cv_mutex
  deferred:  hold _cv_mutex, call cacheStats() => block on _appLocks[]

Many thanks to ascull@ for figuring this out.

Bug: 128522246
Test: By inspection, because I couldn't reproduce the bug myself

Change-Id: I301605a5d2b078e2a7389a58d345e33cb081f5bf
Signed-off-by: Bill Richardson <wfrichar@google.com>
1 file changed
tree: f700d75f02379bce4c10fdad844b11170efda44f
  1. citadel/
  2. hals/
  3. manual_tests/
  4. .checkpatch.conf
  5. .clang-format
  6. Android.bp
  7. LICENSE
  8. METADATA
  9. MODULE_LICENSE_APACHE2
  10. NOTICE
  11. README.md
README.md

Android components for Nugget

Android communicates with Nugget apps in order to implement security related HALs. Currently, those HALs are Keymaster, Weaver and OemLock.

Services

Apps that define a protobuf service will have an app interface class autogenerated. These classes will wrap a NuggetClient. The generator can be found in the generator directory.

Asynchronous communication

Work in progress.

Currently, everything is synchronous and just exposes the call_application() function from the Nugget transport API. In future, asynchronous calls may be desired. Support for this could be added in:

  • Nugget transport API
  • NuggetClient on top of call_application()
  • Generated services

citadel

This directory contains the components to support Citadel connected to Android.