Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not obfuscate library uris when the library contains entrypoint annotation #44215

Closed
mkustermann opened this issue Nov 15, 2020 · 13 comments
Closed
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@mkustermann
Copy link
Member

If a library contains a @pragma('vm:entry-point') annotation we should ensure to not obfuscate library uris as well as ensure to keep library uris available to make it possible for an embedder to invoke such an entry point.

@mkustermann mkustermann added area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Nov 15, 2020
@stuartmorgan
Copy link
Contributor

How difficult would this be to fix? We're hitting more issues with this recently in Flutter due to new plugin registration mechanics; is this something we could potentially fix in the short term instead of having to work around it?

@alexmarkov alexmarkov added the P1 A high priority bug; for example, a single project is unusable or has many test failures label Mar 3, 2022
@alexmarkov
Copy link
Contributor

This bug has been causing multiple problems, so we should probably bump its priority. Tentatively assigning P1.

/cc @a-siva @mraleph

@mraleph
Copy link
Member

mraleph commented Mar 8, 2022

@jensjoha Jens, could you take a look at this to unblock Flutter? It should be doable in the Kernel transforms that computes obfuscation prohibitions. (ObfuscationProhibitionsVisitor), so should be doable in pure Dart.

@jensjoha
Copy link
Contributor

jensjoha commented Mar 9, 2022

So the suggested fix works when plugged in to flutter.

But for my own curiosity I couldn't figure out where the obfuscation was happening in the VM (without the proposed fix), considering the uri isn't obfuscated in kernel_loader.cc. So for future reference it happens here:

Obfuscator obfuscator(T, /*private_key=*/String::Handle(Z));
String& str = String::Handle(Z);
for (intptr_t i = 0; i < scripts.length(); i++) {
const Script& script = scripts.At(i);
str = script.url();
str = Symbols::New(T, str);
str = obfuscator.Rename(str, /*atomic=*/true);
script.set_url(str);
}

Fix in the pipeline @ https://dart-review.googlesource.com/c/sdk/+/236220.

copybara-service bot pushed a commit that referenced this issue Mar 14, 2022
flutter/flutter#99477
#44215

TEST=Test was added.

Change-Id: I585da436f9692d7f2e08db7f74c1a71ad09a1cb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/236220
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
@stuartmorgan
Copy link
Contributor

Is this fixed for master, or is there more follow-up needed?

@mraleph mraleph closed this as completed Mar 18, 2022
@mraleph
Copy link
Member

mraleph commented Mar 18, 2022

I am gonna close given that @jensjoha has tested with Flutter and says it works.

@stuartmorgan
Copy link
Contributor

Awesome, thanks for the quick fix!

@absar
Copy link

absar commented May 1, 2022

Any estimates when it will land into Flutter stable? It's a blocker, since it's preventing us from releasing obfuscated Apps since Flutter 2.10

@absar
Copy link

absar commented Jun 3, 2022

Issue still exists in Flutter Channel stable 3.0.1 when APK or appbundle is obfuscated

Background plugin isolate log:

2022-06-03 19:56:02.589 29540-1486/? E/flutter: [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception:
NoSuchMethodError: No top-level getter 'Ild' declared.
  Receiver: top-level
  Tried calling: Ild, stack trace: Warning: This VM has been configured to produce stack traces that violate the Dart standard.
  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
  pid: 29540, tid: 1486, name Unknown
  build_id: '8deece9b97153dcde758a3ce15c56eaf'
  isolate_dso_base: 7830404000, vm_dso_base: 7830404000
  isolate_instructions: 78306bc7f0, vm_instructions: 78306b8000
      #00 abs 00000078306c5eb3 virt 00000000002c1eb3 _kDartIsolateSnapshotInstructions+0x96c3
2022-06-03 19:56:02.589 29540-1486/? E/flutter: [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
2022-06-03 19:56:02.589 29540-1486/? E/flutter: [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
2022-06-03 19:56:02.592 29540-1486/? E/flutter: [ERROR:flutter/runtime/runtime_controller.cc(382)] Could not create root isolate.
2022-06-03 19:56:02.592 29540-1486/? E/flutter: [ERROR:flutter/shell/common/shell.cc(600)] Could not launch engine with configuration.

@srmncnk
Copy link

srmncnk commented Jun 3, 2022

Probably flutter_isolate plugin is affected as well.

@mraleph
Copy link
Member

mraleph commented Jun 4, 2022

@absar please file a separate issue with instructions on how to reproduce.

@absar
Copy link

absar commented Jun 4, 2022

@mraleph filed #49181

@conanlovevit
Copy link

conanlovevit commented Jul 26, 2022

Still error with 2.10.5 when APK or appbundle is obfuscated, My phone shows black screen.
Any suggest please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. P1 A high priority bug; for example, a single project is unusable or has many test failures type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

8 participants