← Back to Pull requests

objcache: avoid unsafe database sharing under QEMU user emulation #63114

Closed
unknown closed this pull request without merging on Sep 15, 2026 08:08 UTC
View on GitHub
unknown unknown commented on Sep 11, 2026 10:57 UTC
Author

Julia's compiled-code cache can become unusable after a process running under QEMU user-mode emulation dies while holding a database lock. Later processes using the same cache can then hang, including native Julia processes sharing the depot.

On Linux, LMDB uses process-shared robust mutexes. Normally, the kernel marks a lock when its owner dies so the next process can recover it. QEMU user mode does not implement the robust-list syscalls needed for this recovery, but glibc can still allow the mutex to be created. QEMU's syscall implementation explicitly returns ENOSYS for both operations.

For example, a small C reproducer on Linux with glibc 2.44 and QEMU 11.1.1 creates a shared robust mutex, lets a child exit while holding it, and tries to acquire it with a two-second deadline:

Native:
get_robust_list: 0 (success)
pthread_mutex_init: 0 (Success)
lock after owner exits: 130 (Owner died)

qemu-x86_64-static, same executable:
get_robust_list: -1 (Function not implemented)
pthread_mutex_init: 0 (Success)
lock after owner exits: 110 (Connection timed out)

LMDB's ordinary lock acquisition has no such deadline. This PR checks get_robust_list before opening the database and disables caching if the query fails. Julia continues compiling normally, and the REPL explains:

Note: The compiled-code cache is disabled: robust mutex support could not be verified.

The query reads the current thread's registration without replacing libc's robust list. This is a conservative check for the QEMU limitation: a sandbox denying the query also disables caching, and success does not prove that every robust-mutex operation works in an arbitrary environment. Non-Linux platforms retain their existing behavior.

The PR also separates default databases by the JIT's target triple:

Before: <depot>/cache/v1.14/objcache-lmdb1/data.mdb
After:  <depot>/cache/v1.14/objcache-lmdb1/<target-triple>/data.mdb

This addresses a separate compatibility problem: builds sharing a depot can have different word sizes or libc mutex layouts. Different keys for compiled code do not make the underlying LMDB files compatible. Target-specific directories keep those databases apart. The syscall check is still needed when native and emulated processes have the same target triple.

Existing cache files are left in place; the new directories start empty. An explicit JULIA_OBJCACHE_PATH is still used verbatim, so callers setting it must choose separate paths for incompatible targets.

Diff: 327 lines (+245 / -82) across 4 files Reviewer: xal-0 Review duration: 5591m
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 327 lines diff across 4 files
0.42
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.347
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #63114"
general weight: 0.35
Reviewers
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: 42% (MEDIUM) · Higher = larger blast radius
42%
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: 16.6% · Safe to merge
16.6%