Skip to content

feat(sigsafe): resolve current directory - #613

Merged
wan9chi merged 1 commit into
agent/sigsafe-cstr-fdfrom
agent/sigsafe-getcwd
Aug 9, 2026
Merged

feat(sigsafe): resolve current directory#613
wan9chi merged 1 commit into
agent/sigsafe-cstr-fdfrom
agent/sigsafe-getcwd

Conversation

@wan9chi

@wan9chi wan9chi commented Aug 9, 2026

Copy link
Copy Markdown
Member

Motivation

Preload path resolution still obtains the current directory through nix, which may allocate through libc in interception contexts. Add caller-buffer sigsafe::fs::getcwd and its explicit-allocator adapter, then immediately use it inside the existing to_absolute_path callback contract.

The macOS openat and fcntl_getpath wrappers remain private because they are implementation details of the allocation-free libSystem fast path in this slice.

That fast path stops short of libSystem's verification step. libSystem stats the path F_GETPATH returned and compares it against the descriptor, falling back to walking up through .. when they disagree. This wrapper has no slow path to fall back to, so the comparison could only turn a slightly stale answer into a hard error — and its caller records paths a process accessed rather than resolving them, where a stale name is a cosmetic inaccuracy but an error is a lost access. Skipping it also keeps the most common resolution to two syscalls.

@wan9chi wan9chi changed the title agent/sigsafe getcwd feat(sigsafe): resolve current directory Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.12%  [ -8.76% ..  +8.29%]  overhead   +53.55%
dynamic/access             change  -0.25%  [-14.96% .. +12.61%]  overhead    +6.31%
dynamic/access-relative    change  -2.66%  [-13.50% .. +10.71%]  overhead   +52.30%
static/launch              change  -0.43%  [ -8.67% ..  +7.64%]  overhead  +148.49%
static/access              change  +0.25%  [-12.29% .. +12.05%]  overhead  +820.51%
static/access-relative     change  +0.50%  [ -3.74% ..  +5.37%]  overhead +1312.56%

macos

dynamic/launch             change  +0.46%  [ -4.67% ..  +4.80%]  overhead  +223.66%
dynamic/access             change  +0.34%  [ -1.77% ..  +2.33%]  overhead    +2.87%
dynamic/access-relative    change -30.16%  [-31.42% .. -28.13%]  overhead  +231.11%

windows

dynamic/launch             change  -0.66%  [ -4.59% ..  +3.26%]  overhead   +26.81%
dynamic/access             change  +0.18%  [ -3.33% ..  +2.03%]  overhead    +1.27%
dynamic/access-relative    change  +0.00%  [ -2.45% ..  +2.14%]  overhead    +1.63%

@wan9chi
wan9chi force-pushed the agent/sigsafe-getcwd branch 5 times, most recently from 5ea57b6 to a42f21e Compare August 9, 2026 12:18
@wan9chi
wan9chi changed the base branch from agent/extract-sigsafe-alloc to agent/sigsafe-cstr-fd August 9, 2026 12:19
@wan9chi
wan9chi force-pushed the agent/sigsafe-getcwd branch 13 times, most recently from 18e37f5 to f4f0a82 Compare August 9, 2026 15:46
Co-authored-by: GPT-5 Codex <codex@openai.com>
@wan9chi
wan9chi force-pushed the agent/sigsafe-getcwd branch from f4f0a82 to 689129f Compare August 9, 2026 16:26
@wan9chi
wan9chi marked this pull request as ready for review August 9, 2026 16:40
@wan9chi
wan9chi merged commit 8a36c7b into main Aug 9, 2026
19 checks passed
@wan9chi
wan9chi deleted the agent/sigsafe-getcwd branch August 9, 2026 16:44
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