New issue
Advanced search Search tips

Issue 641369 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 641366



Sign in to add a comment

In cryptohomed put InitializeTpmComplete on mount_thread

Project Member Reported by apronin@chromium.org, Aug 26 2016

Issue description

To avoid deadlocks (see  issue 641366 ), break InitializeTpmComplete logic into several tasks, if needed, and put on mount_thread. 
 
On breaking into several tasks:

FIFO nature of the message loop eliminates the need for explicit waiting for tasks completion. 

Breaking into several tasks allows reusing the existing code, and at least some concurrency with other operations (only if an operation was ongoing at the time the tasks were created).
Blocking: 641366
Summary: In cryptohomed put InitializeTpmComplete on mount_thread (was: Put InitializeTpmComplete on mount_thread)
* InitializePkcs11 must be called after MountTaskResetTpmContext is done, so let's trigger it from MountTaskResetTpmContext.

* Adding event about taking ownership and finalizing install attributes must be done after MountTaskResetTpmContext are done, so let's just PostTask these actions as a separate task after PostTask'ing all MountTaskResetTpmContext's - it will happen in the FIFO order after they all are done.

* But calling the PostTask's themselves can happen from tpm_init->worker_thread_. No need to create a separate task just for that yet (we may need to do that, if we decide to eliminate mounts_lock_ later and do all mounts accesses from mount_thread_ only).
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 2 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/ed76c765e79bc4eb690eb421953a92ce1ee49023

commit ed76c765e79bc4eb690eb421953a92ce1ee49023
Author: Andrey Pronin <apronin@google.com>
Date: Fri Aug 26 17:47:48 2016

cryptohome: fix deadlock in InitializeTpmComplete

Fixing possible deadlock: a task on mount_thread_ waiting on mounts_lock_
prevents later tasks from running, while InitializeTpmComplete holds
monts_lock_ and waits on a later task.

BUG= chromium:641369 
TEST=cbuildbot --hwtest on monroe, peach_pit, daisy_skate
     test_that dut login_Cryptohome login_OwnershipNotRetaken
     unittest ServiceTest.NoDeadlocksInInitializeTpmComplete

Change-Id: Ia7a3dcf8169fcd3ef11c9fe6406ad7839ddab8b8
Reviewed-on: https://chromium-review.googlesource.com/376818
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Darren Krahn <dkrahn@chromium.org>

[modify] https://crrev.com/ed76c765e79bc4eb690eb421953a92ce1ee49023/cryptohome/service.h
[modify] https://crrev.com/ed76c765e79bc4eb690eb421953a92ce1ee49023/cryptohome/service.cc
[modify] https://crrev.com/ed76c765e79bc4eb690eb421953a92ce1ee49023/cryptohome/service_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment