Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/docker/judge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apt-get -qq update && \
ln -s /usr/local/bin/node /usr/bin/node

RUN yarn global add pm2 @hydrooj/hydrojudge && \
wget https://github.com/criyle/go-judge/releases/download/v1.9.4/go-judge_1.9.4_linux_amd64v3 -O /usr/bin/sandbox && \
wget https://github.com/criyle/go-judge/releases/download/v1.14.0/go-judge_1.14.0_linux_amd64v3 -O /usr/bin/sandbox && \
chmod +x /usr/bin/sandbox

ENTRYPOINT ["/root/entrypoint.sh"]
2 changes: 1 addition & 1 deletion packages/hydrojudge/src/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ process.on('unhandledRejection', (reason, p) => {
});

async function daemon() {
const shouldRun = await versionCheck((msg) => log.error(msg));
const shouldRun = await versionCheck((msg) => log.warn(msg), (msg) => log.error(msg));
if (!shouldRun) process.exit(1);
const tracing = getConfig('tracing');
if (tracing?.endpoint && tracing?.samplePercentage) initTracing(tracing.endpoint, tracing.samplePercentage);
Expand Down
10 changes: 10 additions & 0 deletions packages/hydrojudge/src/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,20 +223,30 @@ export async function versionCheck(reportWarn: (str: string) => void, reportErro
let sandboxVersion: string;
let sandboxCgroup: number;
let sandboxCgroupControllers: string[] | null;
let sandboxSeccomp: boolean | undefined;
let memorySwapLimitEnabled: boolean | undefined;
let fixSymlinkEscape: boolean;
try {
const version = await client.version();
sandboxVersion = version.buildVersion.split('v')[1];
const config = await client.config();
sandboxCgroup = config.runnerConfig?.cgroupType || 0;
sandboxCgroupControllers = config.runnerConfig?.cgroupControllers || null;
sandboxSeccomp = config.runnerConfig?.seccomp;
memorySwapLimitEnabled = config.runnerConfig?.memorySwapLimitEnabled;
fixSymlinkEscape = config.fixSymlinkEscape ?? false;
} catch (e) {
if (e?.code === 'ECONNREFUSED') reportError('Failed to connect to sandbox, please check sandbox_host config and if your sandbox is running.');
else reportError('Your sandbox version is tooooooo low! Please upgrade!');
return false;
}
const { osinfo } = await sysinfo.get();
if (sandboxSeccomp !== true) {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
reportWarn('Seccomp is not enabled in go-judge. This reduces sandbox isolation.');
}
if (memorySwapLimitEnabled !== true) {
reportWarn('go-judge swap limits are unavailable. Memory limits may not restrict swap use, and memory usage measurements may be inaccurate.');
}
if (sandboxCgroup === 2) {
const kernelVersion = osinfo.kernel.match(/^\d+\.\d+\.\d+/)[0];
if (!gte(kernelVersion, '5.19.0') || !gte(sandboxVersion, '1.6.10')) {
Expand Down
Loading