rust-lang / rust-lang/rust

android: stdlib stack overflow handlers are not installed

Open
#124,823 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-android T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

When updating the CI to newer NDK/APIs, I enabled aarch64-linux-android testing, and found that tests/ui/abi/stack-probes.rs was failing. Luckily, the stack probes themselves are working (the expected SIGSEGV is being triggered), but as the signal handler is not installed, the test fails and the user wouldn't receive a helpful error + backtrace in the real world.

The registration is currently in an odd state where the implementation is enabled for Linux but not Android, and yet contains Android-specific cfgs inside.

Enabling it (by adding "android" to both the mod cfg blocks) works on aarch64, but on arm, it fails because getauxval is missing from libc.

The route to fixing this:

  1. Add the getauxval declaration to libc android 32-bit (it's already in 64-bit). The original argument for not including it is that it was added in Android API 18. Since we're bumping to 21+ as the minimum API, that should not be an issue.
  2. Add android to the registration block
  3. Remove the ignore-android I'm about to add from tests/ui/abi/stack-probes.rs and tests/ui/abi/stack-probes-lto.rs and check that they still work.

cc @chriswailes Perhaps you'd like to take this one?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with library/std/src/sys/pal/unix/stack_overflow.rs and the 32-bit Android module in libc, then inspect tests/ui/abi/stack-probes.rs and stack-probes-lto.rs. Verify the Android stack-overflow registration and getauxval availability, remove the Android ignores, and run both tests to confirm the handlers work on Android targets.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.