Commit 4f88af86 authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Commit Bot

Pass owners's cryptohome ID when starting Plugin VM dispatcher

The dispatcher state will reside in daemon store/cryptohome instead of
global stateful to avoid cross-user information disclosure, so it needs
to know cryptohome ID of the session owner in order to bind-mount
the right state directory.

Bug: b:143443446
Change-Id: Id29b10f2981fe9e919fe41d3e0f4c3832bde1654
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1899838Reviewed-by: default avatarTimothy Loh <timloh@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713488}
parent c83725bb
......@@ -149,6 +149,7 @@ void PluginVmImageManager::StartImport() {
chromeos::DBusThreadManager::Get()
->GetDebugDaemonClient()
->StartPluginVmDispatcher(
chromeos::ProfileHelper::GetUserIdHashFromProfile(profile_),
base::BindOnce(&PluginVmImageManager::OnPluginVmDispatcherStarted,
weak_ptr_factory_.GetWeakPtr()));
}
......
......@@ -140,8 +140,8 @@ void PluginVmManager::LaunchPluginVm() {
chromeos::DBusThreadManager::Get()
->GetDebugDaemonClient()
->StartPluginVmDispatcher(
base::BindOnce(&PluginVmManager::OnStartPluginVmDispatcher,
weak_ptr_factory_.GetWeakPtr()));
owner_id_, base::BindOnce(&PluginVmManager::OnStartPluginVmDispatcher,
weak_ptr_factory_.GetWeakPtr()));
}
void PluginVmManager::StopPluginVm() {
......
......@@ -521,10 +521,12 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
}
void StartPluginVmDispatcher(PluginVmDispatcherCallback callback) override {
void StartPluginVmDispatcher(const std::string& owner_id,
PluginVmDispatcherCallback callback) override {
dbus::MethodCall method_call(debugd::kDebugdInterface,
debugd::kStartVmPluginDispatcher);
dbus::MessageWriter writer(&method_call);
writer.AppendString(owner_id);
debugdaemon_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::BindOnce(&DebugDaemonClientImpl::OnStartPluginVmDispatcher,
......
......@@ -238,8 +238,10 @@ class COMPONENT_EXPORT(DEBUG_DAEMON) DebugDaemonClient
// StartPluginVmDispatcher/StopPluginVmDispatcher.
using PluginVmDispatcherCallback = base::OnceCallback<void(bool success)>;
// Calls debugd::kStartVmPluginDispatcher, which starts the PluginVm
// dispatcher service. |callback| is called when the method finishes.
virtual void StartPluginVmDispatcher(PluginVmDispatcherCallback callback) = 0;
// dispatcher service on behalf of |owner_id|. |callback| is called
// when the method finishes.
virtual void StartPluginVmDispatcher(const std::string& owner_id,
PluginVmDispatcherCallback callback) = 0;
// Calls debug::kStopVmPluginDispatcher, which stops the PluginVm dispatcher
// service. |callback| is called when the method finishes.
virtual void StopPluginVmDispatcher(PluginVmDispatcherCallback callback) = 0;
......
......@@ -256,6 +256,7 @@ void FakeDebugDaemonClient::StopConcierge(ConciergeCallback callback) {
}
void FakeDebugDaemonClient::StartPluginVmDispatcher(
const std::string& owner_id,
PluginVmDispatcherCallback callback) {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), true));
......
......@@ -90,7 +90,8 @@ class COMPONENT_EXPORT(DEBUG_DAEMON) FakeDebugDaemonClient
const base::Closure& error_callback) override;
void StartConcierge(ConciergeCallback callback) override;
void StopConcierge(ConciergeCallback callback) override;
void StartPluginVmDispatcher(PluginVmDispatcherCallback callback) override;
void StartPluginVmDispatcher(const std::string& owner_id,
PluginVmDispatcherCallback callback) override;
void StopPluginVmDispatcher(PluginVmDispatcherCallback callback) override;
void SetRlzPingSent(SetRlzPingSentCallback callback) override;
void SetSchedulerConfigurationV2(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment