-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
DebugID
for the auto generated obfuscation mapping file
#51941
Comments
Tentatively triaging to |
I think this is a reasonable request - it's not entirely clear to me where this should be done though and what kind of UUID we should be attaching. One option here is to somehow tie this to build-id of the binary, but this requires some post processing because for Mach-O LC_UUID is currently generated by external toolchain. |
It seems the purpose here is to de-obfuscate symbol names that were obtained at runtime (e.g. via As @mraleph points out, our AOT compiler has a mode where it outputs assembly and as such doesn't know at compilation time the build-id. I'd say that this is already a little problematic for stack traces, as they
=> Possibly we could make our runtime find the Doing this would make the non-symbolic stack traces in assembly mode better, provide programmatic access to If we used another UUID for the obfuscation map, then we'd need to surface that at runtime via API but also include in the obfuscation map. As the current format of obfuscation map is a simple array of string, we'd break the format by adding a UUID in there (or would need a hack by emitting a obfuscation entry we misuse to encode UUID) |
Consider source maps as well, it'd be awesome if the generated source maps append the |
So I've made CL 306640. In that CL, when printing out a non-symbolic stack trace, the runtime still uses the build ID information from the app isolate instructions image if that information is available. If not, the runtime then looks in the DSO loaded for the app isolate instructions for its build ID (ELF) or UUID (Mach-O) information and uses that instead. I'll do a followup CL that exposes the build ID via |
For direct-to-ELF snapshots, the story remains the same as before, as we use the information from the Image header if available. If it isn't, then we fall back to dladdr to get the dynamic shared object containing the app snapshot and then walk the ELF or Mach-O headers to find the build ID or UUID information. TEST=vm/dart/use_dwarf_stack_traces_flag Issue: #51941 Change-Id: I3705ed244d1b4a1255e75fffd238a29fc2a60800 Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-product-x64-try,vm-aot-win-debug-x64c-try,vm-aot-android-release-arm_x64-try,vm-aot-android-release-arm64c-try,vm-fuchsia-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306640 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
TEST=vm/dart/build_id Issue: #51941 CoreLibraryReviewExempt: Native runtime only API Change-Id: Ib3757480f0eab6d147385a87adf657f4f709ec4e Cq-Include-Trybots: luci.dart.try:vm-aot-dwarf-linux-product-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-mac-product-arm64-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-win-release-x64-try,vm-aot-win-product-x64-try,vm-aot-win-debug-x64c-try,vm-aot-android-release-arm_x64-try,vm-fuchsia-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307122 Reviewed-by: Slava Egorov <vegorov@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com>
I've checked the beta channel and can see the Right now I'm able to read the What we'd need is a way to retrieve the Also, is there a way to generate a Let me know your thoughts. |
Actually, I found a way to match the
Using sentry-cli's So |
I would assume so, since I assume
|
@sstrickl thanks. Any plans or ideas on how to tackle this? |
Is the code that prints the names of classes (e.g. via What one can do right now is e.g. import 'dart:developer';
main() {
log('App startup, build-id: ${NativeRuntime.buildId}');
...
foo(...);
}
void foo(...) {
log('Got object ${object.runtimeType}');
try {
...
} catch (e, s) {
log('Got exception ${e.runtimeType}');
}
} One can then post-process all this logging information, finding the printed It wouldn't be precise, as one may actually print intentionally a string that also corresponds to an obfuscated symbol name, but the probability of that happening are quite low - and for logs this edge case may not matter at all. @marandaneto would that work for you? |
Hi @mkustermann yes, we'd like to symbolicate the minified names gotten by The solution would be that the mapping file would contain the The problem is that a compiled version of a Flutter web app does not have any reference to the |
The log will contain obfuscated symbols + build-id needed to symbolize (similar to our stack traces). So maybe the issue here is that you have trouble getting the
or make programmatic API in
@marandaneto could you open a separate issue for web support? |
@mkustermann Sure, for AOT compiled apps, we have all we need, the given API I will open an issue for Flutter Web support. |
Hi, thanks for all the hard work.
If you're compiling an AOT app such as a Flutter app with obfuscation enabled, you can't deobfuscate the runtime types, See caveat.
Example:
For tools such as sentry.io this is important because we'd like to have the best user experience, but if you collect user's breadcrumbs/view hierarchy/etc and they are all obfuscated, well, not that useful.
You can though export the mapping file to remap the obfuscated types by using the extra param
--extra-gen-snapshot-options=--save-obfuscation-map=mapping.json
.The problem is that right now you can't associate the version of the app with the generated file, since the
version
isn't unique enough.For some other platforms, we can hook into the build pipeline and auto-generate a
DebugID
before uploading the mapping file to sentry.io and injecting theDebugID
to the app, so it's also accessible at runtime, with this association you can remap the obfuscated types on the server.The problem is that Dart/Flutter itself does not have build hooks and hooking up into each build tool of each platform isn't scalable/too complicated/fragile since new versions might break the build hooks, etc.
We request that the obfuscation tooling does that automatically, by generating and appending a unique/deterministic
DebugID
to the mapping file, plus that the Dart language gives a way to access theDebugID
at runtime through an API (maybe thedart:developer
package?).We're trying to solve this problem with some other platforms as well, for example, source maps, see our proposal for more details.
More context on this thread as well.
The text was updated successfully, but these errors were encountered: