Grey Wang would like Devlin Cronin, Tim and Chromium LUCI CQ to review this change.
Revert "[Extensions] Upgrade APIBindingsSystem::InitializeType DCHECK to CHECK"
This reverts commit e4ad067e9374dd36120f04a75639e86523e20409.
Reason for revert: Suspect it breaks uprev
Failure Link: https://chromium-review.git.corp.google.com/c/chromiumos/overlays/chromiumos-overlay/+/7958847?tab=checks
Original change's description:
> [Extensions] Upgrade APIBindingsSystem::InitializeType DCHECK to CHECK
>
> This CL updates a DCHECK to a CHECK in APIBindingsSystem::InitializeType
> so if the requested API is already present in the api_bindings_ map, the
> renderer is killed.
>
> This prevents an issue where requesting an unknown type for an already
> instantiated API would unconditionally overwrite and destroy the
> existing APIBinding object. Destroying the binding could cause a
> Use-After-Free if any v8::Functions created by it (which hold raw
> pointers to the binding's internal data) were subsequently invoked.
>
> An expect-death test has also been added to document this.
>
> Fixed: 513467993
> Change-Id: I676a60ba207daa76cbdc67e5d2aca2db4d6a3a30
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7934732
> Reviewed-by: Devlin Cronin <rdevlin...@chromium.org>
> Commit-Queue: Tim <tjud...@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1648609}
diff --git a/extensions/renderer/bindings/api_bindings_system.cc b/extensions/renderer/bindings/api_bindings_system.cc
index 81f305e..c9ca2f4 100644
--- a/extensions/renderer/bindings/api_bindings_system.cc
+++ b/extensions/renderer/bindings/api_bindings_system.cc
@@ -111,7 +111,7 @@
std::string api_name = type_name.substr(0, dot);
// If we've already instantiated the binding, the type should have been in
// there.
- CHECK(!api_bindings_.contains(api_name)) << api_name;
+ DCHECK(!api_bindings_.contains(api_name)) << api_name;
api_bindings_[api_name] = CreateNewAPIBinding(api_name);
}
diff --git a/extensions/renderer/bindings/api_bindings_system_unittest.cc b/extensions/renderer/bindings/api_bindings_system_unittest.cc
index a57213f..6d652fe 100644
--- a/extensions/renderer/bindings/api_bindings_system_unittest.cc
+++ b/extensions/renderer/bindings/api_bindings_system_unittest.cc
@@ -612,22 +612,4 @@
EXPECT_NE(event, other_event);
}
-// Tests that requesting an unknown type for an already-instantiated API
-// crashes the renderer. In theory this could be triggered by a compromised
-// renderer mishandling bindingUtil, so we just kill the renderer if it happens.
-TEST_F(APIBindingsSystemTest, DeathOnUnknownTypeInitialize) {
- v8::HandleScope handle_scope(isolate());
- v8::Local<v8::Context> context = MainContext();
-
- // Instantiate the 'alpha' API.
- v8::Local<v8::Object> alpha_api =
- bindings_system()->CreateAPIInstance(kAlphaAPIName, context, nullptr);
- ASSERT_FALSE(alpha_api.IsEmpty());
-
- // Trigger InitializeType for the 'alpha' API with an unknown type.
- EXPECT_DEATH_IF_SUPPORTED(
- bindings_system()->type_reference_map()->GetSpec("alpha.doesNotExist"),
- "api_bindings_\\.contains");
-}
-
} // namespace extensions
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Bot-Commit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Owners-Override | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Revert "[Extensions] Upgrade APIBindingsSystem::InitializeType DCHECK to CHECK"
This reverts commit e4ad067e9374dd36120f04a75639e86523e20409.
Reason for revert: Suspect it breaks uprev
Failure Link: https://chromium-review.git.corp.google.com/c/chromiumos/overlays/chromiumos-overlay/+/7958847?tab=checks
Original change's description:
> [Extensions] Upgrade APIBindingsSystem::InitializeType DCHECK to CHECK
>
> This CL updates a DCHECK to a CHECK in APIBindingsSystem::InitializeType
> so if the requested API is already present in the api_bindings_ map, the
> renderer is killed.
>
> This prevents an issue where requesting an unknown type for an already
> instantiated API would unconditionally overwrite and destroy the
> existing APIBinding object. Destroying the binding could cause a
> Use-After-Free if any v8::Functions created by it (which hold raw
> pointers to the binding's internal data) were subsequently invoked.
>
> An expect-death test has also been added to document this.
>
> Fixed: 513467993
> Change-Id: I676a60ba207daa76cbdc67e5d2aca2db4d6a3a30
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7934732
> Reviewed-by: Devlin Cronin <rdevlin...@chromium.org>
> Commit-Queue: Tim <tjud...@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1648609}
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |