[dyn_modules] Check target of dcall from dynamic modules is valid.

Unlike other calls from Dynamic Modules, dynamic calls cannot be
validated entirely at compile time. While we check that the selector
used matches a selector that was allowed (either because a method with
that selector name was exposed as dynamically callable or because the
selector was allowlisted during bytecode compilation), the compiler
doesn't know statically whether the target of the call is exposed.

In prior changes we modified the annotator to add a pragma indicating
whether a member is dynamically-callable or
implicitly-dynamically-callable. Here we use that information to set a
bit on functions and their corresponding dynamic invocation forwarders,
which is verified by the interpreter to make sure the dynamic call is
still allowed.

TEST=none yet - will be added in subsequent CL (see CL chain)

Bug: b/448095881
Change-Id: I27acb4e690a68e08fe1f1ca94e0d77cc7dc4d11e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498300
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Sigmund Cherem
2026-05-13 09:40:57 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 51050481c9
commit cca6298498
10 changed files with 141 additions and 47 deletions
@@ -55,3 +55,22 @@ callable:
- library: 'dart:vmservice_io'
- library: 'dart:_internal'
member: 'extractTypeArguments'
dynamically-callable:
- library: 'dart:async'
- library: 'dart:cli'
- library: 'dart:collection'
- library: 'dart:concurrent'
- library: 'dart:convert'
- library: 'dart:core'
- library: 'dart:core'
class: '_Closure'
member: 'get:call'
- library: 'dart:developer'
- library: 'dart:ffi'
- library: 'dart:io'
- library: 'dart:isolate'
- library: 'dart:math'
- library: 'dart:nativewrappers'
- library: 'dart:typed_data'
- library: 'dart:vmservice_io'