Skip to content

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Jan 17, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Added stack overflow protection to prevent VM crashes during deep recursion scenarios.
  • Chores

    • Enhanced Android build support in CI pipeline.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Warning

Rate limit exceeded

@youknowone has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ffbc2f5 and 4bdf5c4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • crates/vm/Cargo.toml
  • crates/vm/src/vm/mod.rs
  • crates/vm/src/vm/thread.rs
📝 Walkthrough

Walkthrough

This PR adds C stack overflow detection to the VirtualMachine by introducing platform-aware stack boundary discovery, a soft limit tracking field, and overflow checks before recursion depth increases. It also adds the psm dependency and configures Android NDK in the CI pipeline for proper cross-compilation.

Changes

Cohort / File(s) Summary
CI Configuration
\.github/workflows/ci\.yaml
Introduces Android NDK setup step using nttld/setup-ndk@v1 (r27) and defines environment variables (CC, AR, CARGO_TARGET_LINKER) pointing to NDK tools for aarch64-linux-android compilation.
Dependencies
crates/vm/Cargo\.toml
Adds psm = "0.1" dependency to support stack boundary detection.
C Stack Overflow Guard
crates/vm/src/vm/mod\.rs, crates/vm/src/vm/thread\.rs
Implements per-thread C stack soft limit tracking via new c_stack_soft_limit field in VirtualMachine. Adds platform-specific stack bounds discovery (Windows: GetCurrentThreadStackLimits/SetThreadStackGuarantee; Unix: pthread_attr_getstack). Integrates overflow check into with_recursion to prevent stack exhaustion. Includes conservative fallback and Miri-aware conditionals.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A guard upon the C stack grows,
With platform-wisdom, careful flows,
Android NDK now stands so tall,
psm arrives to catch the fall! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'stack soft limit' accurately summarizes the main change: introducing a C stack overflow guard with soft limit tracking in the VirtualMachine.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@youknowone youknowone force-pushed the stack-soft-limit branch 3 times, most recently from a9c3b8f to 8793446 Compare January 18, 2026 07:21
@github-actions
Copy link
Contributor

Code has been automatically formatted

The code in this PR has been formatted using:

  • cargo fmt --all
    Please pull the latest changes before pushing again:
git pull origin stack-soft-limit

@youknowone youknowone marked this pull request as ready for review January 18, 2026 08:19
@youknowone youknowone merged commit f8a78e6 into RustPython:main Jan 18, 2026
13 checks passed
@youknowone youknowone deleted the stack-soft-limit branch January 18, 2026 09:09
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.

1 participant