Closed Bug 1689358 Opened 3 years ago Closed 8 months ago

Add ARM/AArch64 support to the oxidized minidump rust writer

Categories

(Toolkit :: Crash Reporting, task)

ARM
Linux
task

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: gsvelto, Assigned: gsvelto)

References

(Blocks 3 open bugs)

Details

Attachments

(1 file, 1 obsolete file)

As per title

Assignee: nobody → msirringhaus
Status: NEW → ASSIGNED
Attachment #9199806 - Attachment is obsolete: true

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → msirringhaus
Status: NEW → ASSIGNED

I'm actively working on this.

Assignee: msirringhaus → gsvelto

This needs some work in the crash-context crate and then in the minidump-writer crate. Currently none of the architectures work (AArch64, ARM, x86-64 and i686, the latter two are only required for running within the Android emulator).

I've got a patch that works with the GeckoView example app within the emulator in Android 7.1.2 / x86-64. Unfortunately because we're pulling procfs-core in minidump-writer we also pull in a new version of chrono which crashes on Android (0.4.20). This issue is fixed in 0.4.21 but it requires the windows-sys crate so we cannot pull it just yet. I fear I'll have to patch some of the crates to move forward without pulling in unwanted dependencies.

I've attached a crude but working WIP that enables use of the minidump-writer crate on Android. For the time being I only tested it within the x86-64 emulator so I don't know if the ARM/AArch64 code paths work (most likely they don't). The work in minidump-writer has been done on top of the migration to the procfs-core crate which hasn't landed upstream yet so it's folded within this patch. procfs-core poses an issue with our current vendored sources because it requires version 0.4.20+ of chrono. Unfortunately version 0.4.20 is buggy and 0.4.21+ depends on windows-sys so I had to patch it to rely on chrono 0.4.19. This appears to work so I'll leave it at that.

This is almost ready to land. I'm using upstream git versions in this patch but I'll be asking Jake Shadle if he can cut out some new releases of crash-context and minidump-writer because it would be best to use published releases. I'll also offer to handle the release process myself in the future given that we'll iterate heavily on those crates in the coming months and I don't want to burden him with our churn.

Bad news: try runs show that the new version of the chrono crate introduces errors. It seems like we have to re-evaluate the option of removing support for procfs-core in minidump-writer until we can vendor some more recent versions of chrono (which rely on windows- crates which we can't vendor).

We could use an older version of chrono with procfs-core. It was bumped due to a security bug: https://github.com/eminence/procfs/commit/d088503768361243e1454c59b88913db119036ce. In my opinion, libraries should have minimal compatible versions of dependencies as their constraints and security concerns should be handled by applications. Though I'm not sure whether others will agree with that take...

I'm confused about the chrono failure. That reads like the crate is broken. It seems to only use that field with the unstable-locales feature enabled.

Attachment #9335418 - Attachment description: WIP: Bug 1689358 - Generate minidumps for child process crashes using the minidump-writer crate on Android → WIP: Bug 1689358 - Generate minidumps for child process crashes using the minidump-writer crate on Android r=glandium
Attachment #9335418 - Attachment description: WIP: Bug 1689358 - Generate minidumps for child process crashes using the minidump-writer crate on Android r=glandium → Bug 1689358 - Generate minidumps for child process crashes using the minidump-writer crate on Android r=glandium
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1c1f6303ef48
Generate minidumps for child process crashes using the minidump-writer crate on Android r=glandium,supply-chain-reviewers

Backed out for causing build bustages.
So far, this only affected android builds for Android 4.1 x86 opt and Android 5.0 x86 opt.

[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -  [glslopt 0.1.9] running: "/builds/worker/fetches/sccache/sccache" "/builds/worker/fetches/clang/bin/clang++" "-O1" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-unknown-linux-gnu" "--sysroot" "/builds/worker/fetches/sysroot-x86_64-linux-gnu" "-O3" "-DNDEBUG=1" "-DTRIMMED=1" "-I/builds/worker/checkouts/gecko/toolkit/library/rust" "-I/builds/worker/workspace/obj-build/toolkit/library/rust" "-I/builds/worker/workspace/obj-build/dist/include" "-DMOZILLA_CONFIG_H" "-I" "glsl-optimizer/include" "-I" "glsl-optimizer/src/mesa" "-I" "glsl-optimizer/src/mapi" "-I" "glsl-optimizer/src/compiler" "-I" "glsl-optimizer/src/compiler/glsl" "-I" "glsl-optimizer/src/gallium/auxiliary" "-I" "glsl-optimizer/src/gallium/include" "-I" "glsl-optimizer/src" "-I" "glsl-optimizer/src/util" "-D__STDC_FORMAT_MACROS" "-D_GNU_SOURCE" "-DHAVE_ENDIAN_H" "-DHAVE_PTHREAD" "-DHAVE_TIMESPEC_GET" "-DMOZ_INCLUDE_MOZALLOC_H" "-Dmozilla_throw_gcc_h" "-o" "/builds/worker/workspace/obj-build/release/build/glslopt-3b27e6cd22ba0ffd/out/glsl-optimizer/src/compiler/glsl/standalone_scaffolding.o" "-c" "glsl-optimizer/src/compiler/glsl/standalone_scaffolding.cpp"
[task 2023-07-05T08:16:36.757Z] 08:16:36    ERROR -  error[E0432]: unresolved import `libc::user`
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -   --> /builds/worker/checkouts/gecko/third_party/rust/minidump-writer/src/linux/thread_info/x86.rs:4:5
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -    |
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -  4 | use libc::user;
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -    |     ^^^^^^^^^^ no `user` in the root
[task 2023-07-05T08:16:36.757Z] 08:16:36    ERROR -  error[E0425]: cannot find value `AT_NULL` in crate `libc`
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -      --> /builds/worker/checkouts/gecko/third_party/rust/minidump-writer/src/linux/auxv_reader.rs:94:29
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.757Z] 08:16:36     INFO -  94   |             at_null = libc::AT_NULL;
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |                             ^^^^^^^ help: a constant with a similar name exists: `PT_NULL`
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -      ::: /builds/worker/checkouts/gecko/third_party/rust/libc/src/unix/linux_like/android/mod.rs:2108:1
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -  2108 | pub const PT_NULL: u32 = 0;
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       | ---------------------- similarly named constant `PT_NULL` defined here
[task 2023-07-05T08:16:36.758Z] 08:16:36    ERROR -  error[E0425]: cannot find value `AT_PHDR` in crate `libc`
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -      --> /builds/worker/checkouts/gecko/third_party/rust/minidump-writer/src/linux/dso_debug.rs:91:25
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -  91   |         at_phdr = libc::AT_PHDR;
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |                         ^^^^^^^ help: a constant with a similar name exists: `PT_PHDR`
[task 2023-07-05T08:16:36.758Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -      ::: /builds/worker/checkouts/gecko/third_party/rust/libc/src/unix/linux_like/android/mod.rs:2114:1
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -       |
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -  2114 | pub const PT_PHDR: u32 = 6;
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -       | ---------------------- similarly named constant `PT_PHDR` defined here
[task 2023-07-05T08:16:36.759Z] 08:16:36    ERROR -  error[E0425]: cannot find value `AT_PHNUM` in crate `libc`
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -    --> /builds/worker/checkouts/gecko/third_party/rust/minidump-writer/src/linux/dso_debug.rs:92:26
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -     |
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -  92 |         at_phnum = libc::AT_PHNUM;
[task 2023-07-05T08:16:36.759Z] 08:16:36     INFO -     |                          ^^^^^^^^ not found in `libc`
<...>
Flags: needinfo?(gsvelto)
Blocks: 1841878

libc::user, libc::AT_NULL and libc::AT_PHDR are not defined for any 32-bits android platform in libc... (as in, they are missing)

libc::AT_NULL and libc::AT_PHDR are covered by https://github.com/rust-lang/libc/pull/3125

I've updated the upstream package to support Android/i686, let's see if this works: https://treeherder.mozilla.org/jobs?repo=try&revision=33a6f1a40d69f07a26c35130701543f9a9cac175

Flags: needinfo?(gsvelto)
Pushed by gsvelto@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/135fa6dfd4d1
Generate minidumps for child process crashes using the minidump-writer crate on Android r=glandium,supply-chain-reviewers
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: