--sandbox_block_path: help doesn't say an absent path isn't blocked, or that replacing the path unblocks a running action
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- linux
- Ambito
- build-system
Direzione di ricerca
Cerca nel codice sorgente di Bazel il testo della guida esistente per --sandbox_block_path e ispeziona il punto di ingresso dell'opzione linux-sandbox. Aggiorna la guida o la documentazione per indicare quando il percorso è bloccato e quando una sostituzione può sbloccarlo, quindi esegui l'output --help pertinente per verificare la formulazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The reporter of #4963 wanted --sandbox_block_path "to prevent likely cases of loss of hermeticity". Its help is one line: "For sandboxed actions, disallow access to this path." On Linux I found two cases where an action read a path passed to this flag. Neither is in the flag's help or in the docs.
The first is a path that does not exist when an action's sandbox is set up. linux-sandbox skips it. That is what #4963 asked for, and b6bb800 made it so, released in 7.3.0. The same issue asked for the flag's description to "document what this is", and the help still reads as quoted above. I'm not asking for a warning. I mention the silence because it leaves the build no way to show that the path wasn't blocked. On 9.2.0 the console output with the flag and an absent path was the same as without the flag, apart from timings and the output directory's name. It was still the same at --sandbox_debug -s once timestamps and PIDs are removed, and at that verbosity an applied block prints a bind mount line naming the path. 7.2.1 failed the build instead: "Mount target '...' does not exist."
Because the check runs for each action, a path that appears during the build was blocked for some actions and not others. I ran two genrules, B depending on A, with the blocked file absent at the start. A host process created it after A had started. Action A read it. B, set up afterwards, got Permission denied. With the file present from the start both were denied, and without the flag both read it.
The second case is a block that was applied. While an action ran, I replaced the blocked file from outside the sandbox, once by renaming a new file over it and once by deleting and recreating it. Both times the running action read the new file. Rewriting the file in place kept it blocked, and actions started afterwards were blocked again. With a blocked directory on 9.1.1, the action's /proc/self/mountinfo listed the bind mount before the replacement and not after. That matches mount_namespaces(7): a mount point replaced from another mount namespace is detached, as the kernel has done since Linux 3.18. Renaming a new file over the old one is the usual way to update a file atomically. So a blocked file that a host process updates that way while an action runs becomes an undeclared input of that action.
The mechanism isn't new. The kernel documents it, and another sandbox that hides paths with bind mounts ran into it and wrote it down when it changed its own cleanup (https://github.com/anthropics/sandbox-runtime/pull/184). What I couldn't find in Bazel's help or tracker is that an action already running can read a blocked path that appears, or is replaced, after its sandbox was set up. The nearest issue, #24514, is a different limit of the same flag, which a maintainer traced to symlink resolution.
All of this was on Linux, Debian 13 with kernel 6.12, under linux-sandbox. On 9.2.0 I ran every case twice, each from a fresh workspace and output root. The absent path and the path that appeared mid-build gave the same results on 8.8.0, and on 9.1.1 with a blocked directory. I didn't run macOS, where these paths are passed to sandbox-exec (#4963), and I didn't run the hermetic sandbox. processwrapper-sandbox ignores the flag altogether: under it the file was readable with the flag set.
For linux-sandbox, one sentence in the help would cover both: for each action, the path is blocked only if it exists when that action's sandbox is set up, and only until something replaces it while the action runs.
- Lingua principale
- Java
- Stelle
- 26.2k
- Fork
- 4.7k
- Merge medio
- 3g 11h
- PR unite (30g)
- 125
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bazelbuild/bazel
-
team-Rules-Java type: bug untriaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
bazelbuild/bazel#33068 ·
I maintainer di solito rispondono entro 2 giorni
-
Remote repo contents cache rejects repos with a backslash in a file name on UnixForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertateam-Remote-Exec type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bazelbuild/bazel#32601 · 3 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
bazelbuild/bazel#32132 ·
I maintainer di solito rispondono entro 2 giorni
-
Docs: run/build.mdx describes a sandboxing warning removed in 2017 and a flag deleted in 9.0.0Forse già presa @lavishdev l’ha presa 70 giorni fa. Apertahelp wanted P2 team-Documentation team-OSS type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
bazelbuild/bazel#31316 ·
I maintainer di solito rispondono entro 2 giorni
-
Rename gen_mdx_reference_docs to gen_reference_docsForse già presa @kapunahelewong l’ha presa 73 giorni fa. ApertaP2 team-Documentation team-OSS type: documentation (cleanup)
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
bazelbuild/bazel#31211 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di bazelbuild/bazel
Issue simili
-
[P2] 生产环境下启动门闩的失败明细不进容器标准输出Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Lincoln-cn/JAiRouter#1473 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
exercism/java-analyzer#379 ·
-
area: ui bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
tetsuji16/microProject#1893 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
liberation-data/fornax4j#325 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: FE and Kinesis extraction pipes render flow starting at the centre and scroll the source arm backwardsForse già presa @chonkzillaofficial l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
BCCE-team/BuildCraft#85 ·