Skip to content

fix(apple): disable ASAN for JSC methods#22

Merged
thymikee merged 2 commits intoreact-native-community:mainfrom
Saadnajmi:asan
Feb 12, 2026
Merged

fix(apple): disable ASAN for JSC methods#22
thymikee merged 2 commits intoreact-native-community:mainfrom
Saadnajmi:asan

Conversation

@Saadnajmi
Copy link
Contributor

Upstreaming an internal change we made to JSCRuntime.cpp that I'm fairly confident in.

--- Original PR notes ---

ASAN stores stack values in a shadow stack separate from the "true" stack of the thread, which prevents JavaScriptCore's GC from finding those values. This can lead to premature freeing of objects and weird crashes.

Thankfully, we don't directly talk to JSC. We only talk to it through JSI which only ever briefly keeps JSC values on the stack, and only in very specific functions/methods. Instead of turning off ASAN or its stack use-after-free checking for the entire process, we can annotate just those few spots in JSI to tell Clang to avoid ASAN instrumentation for them to avoids these GC issues while keeping ASAN on everywhere else.

This change does not impact shipping bits. It uses an #if to ensure only builds with ASAN enabled (i.e., debug) are impacted.

@thymikee
Copy link
Member

The CI fails with this:

* What went wrong:
Could not determine the dependencies of task ':app:mergeDexRelease'.
> Could not resolve all dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not find com.facebook.react:react-android:0.79.0-nightly-20250303-cee63397b-SNAPSHOT.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/maven-metadata.xml
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/react-android-0.79.0-nightly-20250303-cee63397b-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/react-android-0.79.0-nightly-20250303-cee63397b-SNAPSHOT.pom
     Required by:
         project :app
         project :app > project :react-native-community_javascriptcore

which seems unrelated, but could you check it and maybe fix in a separate PR? 🙏🏼

@Saadnajmi
Copy link
Contributor Author

The CI fails with this:

* What went wrong:
Could not determine the dependencies of task ':app:mergeDexRelease'.
> Could not resolve all dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not find com.facebook.react:react-android:0.79.0-nightly-20250303-cee63397b-SNAPSHOT.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/maven-metadata.xml
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/react-android-0.79.0-nightly-20250303-cee63397b-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/com/facebook/react/react-android/0.79.0-nightly-20250303-cee63397b-SNAPSHOT/react-android-0.79.0-nightly-20250303-cee63397b-SNAPSHOT.pom
     Required by:
         project :app
         project :app > project :react-native-community_javascriptcore

which seems unrelated, but could you check it and maybe fix in a separate PR? 🙏🏼

#23

@thymikee thymikee merged commit 8c83bc8 into react-native-community:main Feb 12, 2026
2 of 4 checks passed
@Saadnajmi Saadnajmi deleted the asan branch February 12, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants