Skip to content

Commit 73292bd

Browse files
authored
fix(sandbox): allow spec-guard reads in rootfs
1 parent 3d57f88 commit 73292bd

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
working-directory: api/src
5858
run: |
5959
gcc -O2 -static -Wall -Wextra -Werror -o /tmp/spec-guard spec-guard.c
60+
chmod 0555 /tmp/spec-guard
6061
# Smoke: spec-guard must execvp its argument cleanly. Use a
6162
# parent process with a known FD population so we also assert
6263
# the close-inherited-FDs path runs (child must see only the

api/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ RUN git clone -b master --single-branch https://github.com/google/nsjail.git . \
2929
RUN make -j$(nproc)
3030

3131
COPY api/src/spec-guard.c /tmp/spec-guard.c
32+
# KVM/nsjail execution may need read permission on virtiofs-backed rootfs.
3233
RUN gcc -O2 -static -o /usr/local/bin/spec-guard /tmp/spec-guard.c \
33-
&& chmod 0111 /usr/local/bin/spec-guard
34+
&& chmod 0555 /usr/local/bin/spec-guard
3435

3536
# ============================================================================
3637
# Stage 1b: Build language runtime packages (only consumed by sandbox-runner-baked)

docker/Dockerfile.worker-sandbox

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ RUN git clone -b master --single-branch https://github.com/google/nsjail.git . \
4242
RUN make -j$(nproc)
4343

4444
COPY api/src/spec-guard.c /tmp/spec-guard.c
45+
# KVM/nsjail execution may need read permission on virtiofs-backed rootfs.
4546
RUN gcc -O2 -static -o /usr/local/bin/spec-guard /tmp/spec-guard.c \
46-
&& chmod 0111 /usr/local/bin/spec-guard
47+
&& chmod 0555 /usr/local/bin/spec-guard
4748

4849
# ============================================================================
4950
# Stage 2: Build worker

launcher/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ RUN git clone -b master --single-branch https://github.com/google/nsjail.git . \
3333
RUN make -j$(nproc)
3434

3535
COPY api/src/spec-guard.c /tmp/spec-guard.c
36+
# KVM/nsjail execution may need read permission on virtiofs-backed rootfs.
3637
RUN gcc -O2 -static -o /usr/local/bin/spec-guard /tmp/spec-guard.c \
37-
&& chmod 0111 /usr/local/bin/spec-guard
38+
&& chmod 0555 /usr/local/bin/spec-guard
3839

3940
FROM oven/bun:1.3.14-debian AS sandbox-build
4041

0 commit comments

Comments
 (0)