← Back to Pull requests

Feature/path resolution #1

Closed
unknown closed this pull request without merging on Oct 26, 2026 13:54 UTC
View on GitHub
unknown unknown commented on Oct 24, 2026 16:33 UTC
Author

Command path resolution (execvp) for xv6

Problem: exec() resolves names relative to the cwd, and all UPROGS live in /, so after cd every bare command (ls, mkdir, ...) failed with exec ls failed.

Fix (user space only, no kernel/fs changes):

  • int execvp(char file, char argv) in user/ulib.c, declared in user/user.h.

  • Name contains / → exec as-is, no search (/ls, ./prog, a/b/prog).

  • Bare name → search / first, then cwd. Search path is one array in ulib.c.

  • / first so a process cannot hijack a bare name by planting an executable in its cwd. This matters for our project, which assumes the process is untrusted.

  • Bounded by MAXPATH: an over-long name returns -1, with no overflow or truncation.

  • user/sh.c now calls execvp, so pipes, redirection, ; and & are all covered.

  • init.c, usertests.c and grind.c are intentionally unchanged (see docs).
  • Tests:

  • user/pathtest.c: run from /pt/a/b, it sweeps every program in UPROGS by bare name. The list comes from a header generated from the Makefile, so new programs are picked up automatically. It also covers absolute/relative paths, nonexistent and empty names, a MAXPATH-length name, the cwd-hijack case, and argv passthrough.

  • scripts/test_path_e2e.py (make test-path): boots QEMU at CPUS=1 and CPUS=3, drives the real shell, runs pathtest from a subdirectory and usertests -q. It saves raw logs to scripts/logs/ and restores fs.img afterwards.

  • Result: 46/46 PASS, and usertests -q passes on both CPU settings.

  • Negative controls: reverting to exec() fails 16 cases; reverting to cwd-first fails the hijack test.
  • For everyone:*

  • Use execvp(), not exec(), in your own test programs and harnesses.

  • Plain make builds only the kernel. Run make fs.img or make qemu after changing user programs.

  • New programs added to UPROGS are covered by pathtest automatically.

  • Details: docs/path-resolution.md
  • Diff: 241 lines (+180 / -61) across 3 files Reviewer: Piyush2005-code Review duration: 2720m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.44) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 241 lines diff across 3 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.328
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #1"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.8% (MEDIUM) · Higher = larger blast radius
    43.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.3% · Safe to merge
    17.3%