Skip to content

Commit

Permalink
Switch to isolate v2 with Ubuntu 22.04
Browse files Browse the repository at this point in the history
Co-authored-by: Filippo Casarin <casarin.filippo17@gmail.com>
  • Loading branch information
wil93 and Virv12 committed Oct 5, 2024
1 parent f0d969b commit 738971e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# syntax=docker/dockerfile:1
FROM ubuntu:20.04

RUN apt-get update
RUN apt-get install -y \
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cgroup-lite \
cppreference-doc-en-html \
Expand Down
2 changes: 1 addition & 1 deletion cms/grading/Sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -1076,7 +1076,7 @@ def build_box_options(self):
if self.box_id is not None:
res += ["--box-id=%d" % self.box_id]
if self.cgroup:
res += ["--cg", "--cg-timing"]
res += ["--cg"]
if self.chdir is not None:
res += ["--chdir=%s" % self.chdir]
for src, dest, options in self.dirs:
Expand Down
28 changes: 28 additions & 0 deletions config/isolate.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This is a configuration file for Isolate

# All sandboxes are created under this directory.
# To avoid symlink attacks, this directory and all its ancestors
# must be writeable only to root.
box_root = /var/local/lib/isolate

# Directory where lock files are created.
lock_root = /run/isolate/locks

# Control group under which we place our subgroups
# Either an explicit path to a subdirectory in cgroupfs, or "auto:file" to read
# the path from "file", where it is put by isolate-cg-helper.
cg_root = /sys/fs/cgroup

# Block of UIDs and GIDs reserved for sandboxes
first_uid = 60000
first_gid = 60000
num_boxes = 1000

# Only root can create new sandboxes (default: 0=everybody can)
#restricted_init = 1

# Per-box settings of the set of allowed CPUs and NUMA nodes
# (see linux/Documentation/cgroups/cpusets.txt for precise syntax)

#box0.cpus = 4-7
#box0.mems = 1
3 changes: 1 addition & 2 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.3"

services:
testdb:
image: postgres
Expand All @@ -19,6 +17,7 @@ services:
volumes:
- "./codecov:/home/cmsuser/cms/codecov"
privileged: true
cgroup: host
command: >
wait-for-it testdb:5432 -- sh -c "
dropdb --host=testdb --username=postgres cmsdbfortesting ;
Expand Down
2 changes: 1 addition & 1 deletion isolate
4 changes: 2 additions & 2 deletions prerequisites.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ def install_isolate():

print("===== Copying isolate config to /usr/local/etc/")
makedir(os.path.join(USR_ROOT, "etc"), root, 0o755)
copyfile(os.path.join(".", "isolate", "default.cf"),
os.path.join(USR_ROOT, "etc", "isolate"),
copyfile(os.path.join(".", "config", "isolate.conf.sample"),
os.path.join(USR_ROOT, "etc", "isolate", "isolate.cf"),
root, 0o640, group=cmsuser_grp)


Expand Down

0 comments on commit 738971e

Please sign in to comment.