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

libgojni.so MTE crash (memory unsafe code) #44276

Closed
bedair81 opened this issue Apr 26, 2024 · 6 comments
Closed

libgojni.so MTE crash (memory unsafe code) #44276

bedair81 opened this issue Apr 26, 2024 · 6 comments
Labels
Resolution: Answered When the issue is resolved with a simple answer

Comments

@bedair81
Copy link

bedair81 commented Apr 26, 2024

Description

When enabling MTE on a react native app, specifically https://github.com/ZeusLN/zeus, the app crashes. I first assumed this was an app bug but after attempting to debug for a few hours it seems to be libgojni.so is a shared object not related to the app code itself. Unsure whether its a react native issue but if not I hope someone can point me to the right place. I would like to get this issue solved soon :)

Steps to reproduce

  1. Use platform with MTE support(I am using a Google Pixel 8 Pro)
  2. Install application with npx react-native@latest start
  3. Build android app
  4. Tap on quick start option in app
  5. Observe Crash

React Native Version

0.73.7

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 70.84 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.0.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.5.1
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.04.22.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK: Not Found
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.2 AI-232.10300.40.2321.11668458
  Xcode:
    version: /undefined
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.7
    wanted: 0.73.7
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: false


### Stacktrace or Logs

```text
type: crash
osVersion: google/husky/husky:14/AP1A.240405.002.B1/2024042200:user/release-keys
uid: 10235 (u:r:untrusted_app:s0:c235,c256,c512,c768)
cmdline: app.zeusln.zeus
processUptime: 3s

signal: 11 (SIGSEGV), code 9 (SEGV_MTESERR), faultAddr 800c58e25fff080
threadName: Thread-1
MTE: enabled

backtrace:
    /data/app/~~LGMKC1QjK5elV8lDRGjkdw==/app.zeusln.zeus-UaxxLuxXkSyrgZGa9Wh-Jg==/lib/arm64/libgojni.so (pc 45e808)


### Reproducer

https://github.com/ZeusLN/zeus

### Screenshots and Videos

_No response_
@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 26, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@bedair81
Copy link
Author

not really sure how i can use the shared library in a template, the issue itself is reproducible 100% of the time following my steps above

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Apr 26, 2024
@cortinico
Copy link
Contributor

When enabling MTE on a react native app

What is MTE?

@bedair81
Copy link
Author

bedair81 commented Apr 26, 2024

When enabling MTE on a react native app

What is MTE?

Memory Tagging Extensions, its a new hardware feature that allows the debugging of memory unsafe code. Please see:
https://source.android.com/docs/security/test/memory-safety/arm-mte
https://newsroom.arm.com/blog/memory-safety-arm-memory-tagging-extension
for an in depth explanation :)

@cortinico
Copy link
Contributor

libgojni.so

FYI, React Native doesn't produce this dynamic library.

@bedair81 could you provide a repro

  1. using this template https://github.com/new?template_name=reproducer-react-native&template_owner=react-native-community
  2. enabling the MTE as suggested by the Android documentation
  3. reproduce the crash

@cortinico cortinico added Needs: Author Feedback and removed Needs: Attention Issues where the author has responded to feedback. labels Apr 30, 2024
@bedair81
Copy link
Author

bedair81 commented May 6, 2024

After doing some more investigation/testing, I think I've narrowed down the issue to some native "Go" code running in the app. I don't believe its a react native issue, sorry for wasting your time and thanks for helping me out!

@bedair81 bedair81 closed this as completed May 6, 2024
@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels May 6, 2024
@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Triage 🔍 Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Needs: Attention Issues where the author has responded to feedback. labels May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests

2 participants