New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 613731 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Jun 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Chaps build with TPM2.0 is broken

Project Member Reported by apronin@chromium.org, May 20 2016

Issue description

Running
  USE="tpm2" emerge-$BOARD chaps 
produces two errors (the full log is attached just in case):

src/platform2/chaps/chapsd.cc:149:54: error: no member named 'message_loop_proxy' in 'base::Thread'
    chaps::TPM2UtilityImpl tpm(tpm_background_thread.message_loop_proxy());
                               ~~~~~~~~~~~~~~~~~~~~~ ^

src/platform2/chaps/tpm2_utility_impl.cc:24:10: fatal error: 'trunks/trunks_proxy.h' file not found
#include <trunks/trunks_proxy.h>
         ^

 
chaps.log
8.2 KB View Download
Labels: -Pri-2 Pri-1
This CL added the call to message_loop_proxy():
https://chromium-review.googlesource.com/#/c/312953/10

And at the same time message_loop_proxy() has been deprecated and removed:
https://bugs.chromium.org/p/chromium/issues/detail?id=465992
Cc: dkrahn@chromium.org
From https://bugs.chromium.org/p/chromium/issues/detail?id=465458#c8:
The big problem with this is that a lot of the code uses Thread::message_loop() or Thread::message_loop_proxy() for doing PostTask() etc., whereas using Thread::task_runner() would be sufficient ( issue 391045 ). So all of these callsites would need to be updated.

From https://docs.google.com/document/d/1o1vUUOjX3tC7pV5-nxchaGtElo4NwtzKOAb4Zm09ezw/edit# :
We need to change all consumers of base::Thread::message_loop() and base::Thread::message_loop_proxy() to use Thread::task_runner() and TaskRunner interface.

Further notes:
1) Error #1 is simple. Replace message_loop_proxy() with task_runner()
2) Error #2. If we remove the missing header we get:

../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:57:28: error: no matching constructor for initialization of 'trunks::TrunksFactoryImpl'
    : default_factory_(new trunks::TrunksFactoryImpl()),
                           ^
/mnt/host/source/src/aosp/system/tpm/trunks/trunks_factory_impl.h:39:12: note: candidate constructor not viable: requires single argument 'failure_is_fatal', but no arguments were provided
  explicit TrunksFactoryImpl(bool failure_is_fatal);
           ^
/mnt/host/source/src/aosp/system/tpm/trunks/trunks_factory_impl.h:43:12: note: candidate constructor not viable: requires single argument 'transceiver', but no arguments were provided
  explicit TrunksFactoryImpl(CommandTransceiver* transceiver);
           ^
/mnt/host/source/src/aosp/system/tpm/trunks/trunks_factory_impl.h:63:28: note: candidate constructor not viable: requires 1 argument, but 0 were provided
  DISALLOW_COPY_AND_ASSIGN(TrunksFactoryImpl);
                           ^
../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:58:16: error: field 'default_factory_' is uninitialized when used here [-Werror,-Wuninitialized]
      factory_(default_factory_.get()),
               ^
../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:67:45: error: no type named 'TrunksProxy' in namespace 'trunks'
        : default_trunks_proxy_(new trunks::TrunksProxy),
                                    ~~~~~~~~^
../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:549:22: error: expected '{' or ','
}  // namespace chaps
                     ^
../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:549:22: error: expected '}'
../../../../../../../../../mnt/host/source/src/platform2/chaps/tpm2_utility_impl.cc:54:17: note: to match this '{'
namespace chaps {
                ^
For new errors: 
3) call new trunks::TrunksFactoryImpl(false) instead of just new trunks::TrunksFactoryImpl(): LOG(FAILURE) or LOG(ERROR) is selected by the flag for failure.

4) default_trunks_proxy_(new trunks::TrunksProxy) must be replaced with something else.
std::unique_ptr<trunks::CommandTransceiver> default_trunks_proxy_ is used 
  a) as the next_transciever_ in BackgroundCommandTransceiver() to init default_background_transceiver_ to init default_factory_;
  b) in InitTransciever(): Init() is called on it.
TpmHandle / TrunksFtdiSpi / TpmSimulatorHandle are used internally in trunksd for CommandTransciever. Not provided externally.
Same thing with cryptohome.

Final solution: 
1) Replace message_loop_proxy() with task_runner().
2) Replace <trunks/trunks_proxy.h> with <trunks/trunks_dbus_proxy.h>
3) Replace 'new trunks::TrunksFactoryImpl()' with 'new trunks::TrunksFactoryImpl(false)'
Owner: apronin@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 7 by bugdroid1@chromium.org, May 25 2016

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

commit 675ed72718b213082c28973634427a880f4ca55e
Author: Andrey Pronin <apronin@google.com>
Date: Tue May 24 00:45:58 2016

Updated deprecated API calls in TPM2-specific code in chaps/cryptohome

BUG= chromium:613731 
TEST=USE='tpm2' emerge-$BOARD chaps cryptohome

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

[modify] https://crrev.com/675ed72718b213082c28973634427a880f4ca55e/chaps/tpm2_utility_impl.cc
[modify] https://crrev.com/675ed72718b213082c28973634427a880f4ca55e/cryptohome/tpm2_impl.cc
[modify] https://crrev.com/675ed72718b213082c28973634427a880f4ca55e/chaps/chapsd.cc

Status: Verified (was: Started)

Comment 9 by ngm@chromium.org, Jun 8 2016

Cc: ngm@chromium.org

Sign in to add a comment