Commit df99becf authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[ubsan] Check valid types on ExternalReference-called functions

All C++ functions called directly from generated code must have
a predictable ABI. We ensure that by requiring their return and
argument types to be scalars -- in particular, they must not be
non-pointer ObjectPtr or ObjectSlot types, which is easy to get
wrong and difficult to debug. This patch adds compile-time type
checks enforcing the requirement to the macro used for creating
ExternalReferences for functions.

Bug: v8:3770
Change-Id: I442cf25e2f72b7ea84d4a50c9c665b187b179ca0
Reviewed-on: https://chromium-review.googlesource.com/c/1334974
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57560}
parent 6bafa880
This diff is collapsed.
......@@ -2356,12 +2356,6 @@ Map Map::GetPrototypeChainRootMap(Isolate* isolate) const {
return ReadOnlyRoots(isolate).null_value()->map();
}
// static
Address Object::GetOrCreateHash(Isolate* isolate, Object* key) {
DisallowHeapAllocation no_gc;
return key->GetOrCreateHash(isolate).ptr();
}
Smi Object::GetOrCreateHash(Isolate* isolate) {
DisallowHeapAllocation no_gc;
Object* hash = Object::GetSimpleHash(this);
......
......@@ -1396,8 +1396,6 @@ class Object {
// the actual object type. May create and store a hash code if needed and none
// exists.
Smi GetOrCreateHash(Isolate* isolate);
// Returns a tagged Smi as a raw Address for ExternalReference usage.
static Address GetOrCreateHash(Isolate* isolate, Object* key);
// Checks whether this object has the same value as the given one. This
// function is implemented according to ES5, section 9.12 and can be used
......
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