Skip to content

runtime: keep sandbox checker thread-local - #3452

Closed
adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/sandbox-checker-tls
Closed

adilalperenciftci wants to merge 1 commit into
aether-lang-dev:mainfrom
adilalperenciftci:fix/sandbox-checker-tls

Conversation

@adilalperenciftci

Copy link
Copy Markdown
Contributor

Summary

I reproduced a mismatch between the thread-local generated permission stack and the process-global _aether_sandbox_checker. A thread entering or leaving a sandbox block could replace or clear the checker used by another thread.

  • Store the checker as AETHER_TLS_SHARED, aligning its lifetime with the generated sandbox state.
  • Expose aether_sandbox_get_checker() for the preload bridge.
  • Use the weak getter in the preload layer so standalone LD_PRELOAD use remains valid when no embedded runtime symbol is present.
  • Add a synchronized two-thread regression test proving independent allow and deny decisions.

Verification

  • BEFORE: FAIL checker state crossed threads: main=1 worker=1
  • AFTER: PASS: sandbox checker state is thread-local
  • Active standalone preload policy probe passed.
  • Targeted sandbox toolchain, trusted-name, preload lookup, child-signal, clone-fence, and fork-grant tests passed.
  • make check-changelog
  • make check-tests
  • make test: 634 passed, 0 failed

Signed-off-by: Adil Alperen Çiftci adilalperenciftci@users.noreply.github.com

I reproduced one thread replacing another thread's in-process sandbox checker while their permission stacks stayed thread-local. Store the checker in TLS and let the preload bridge query it through a weak getter, which keeps standalone preload use valid.

Add a synchronized two-thread regression test for policy isolation.

Signed-off-by: Adil Alperen Çiftci <adilalperenciftci@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@adilalperenciftci

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the current runtime sandbox architecture. Commit 6854baa moved grant levels into thread-local runtime state and added tests/regression/test_sandbox_thread_levels.ae; I verified that regression passes on current main. Rebasing this older checker-pointer implementation would duplicate the newer model.

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