fix(runner): load the seccomp policy on amd64 and make the A16 bombs deterministic
This commit is contained in:
1 parent
e858280d91
commit
1ebd23693e
8 files changed
+68
-24
No files matched your search
@@ -32,7 +32,11 @@ const (
|
||||
reportSchema = "lincodex.runner-a16-report/v1"
|
||||
// weakenedProcesses replaces the process limit in the weakened config.
|
||||
weakenedProcesses = 4096
|
||||
apkDatabase = "/lib/apk/db/installed"
|
||||
// leftoverGrace bounds the wait of the weakened-limit check for killed
|
||||
// sandbox processes to finish exiting; leftoverPoll is its poll step.
|
||||
leftoverGrace = 2 * time.Second
|
||||
leftoverPoll = 20 * time.Millisecond
|
||||
apkDatabase = "/lib/apk/db/installed"
|
||||
)
|
||||
|
||||
// runnerVersion is set with -ldflags -X by the Make targets.
|
||||
@@ -301,8 +305,10 @@ func TestA16WeakenedProcessLimitIsDetected(t *testing.T) {
|
||||
}
|
||||
// Under the weakened limit an OOM kill may hit nsjail itself and
|
||||
// leave a dead, unreaped process to the container's PID 1; only live
|
||||
// processes count here.
|
||||
if leftover := nothingLeft(executor, cfg.SandboxUID, nil); leftover != "" {
|
||||
// processes count here. A process killed with its cgroup can still
|
||||
// be exiting when the run returns, so the check waits for the
|
||||
// kernel to finish it before it reports a leftover.
|
||||
if leftover := nothingLeftWithin(executor, cfg.SandboxUID, leftoverGrace); leftover != "" {
|
||||
t.Fatalf("%s: %s", tc.Name, leftover)
|
||||
}
|
||||
}
|
||||
@@ -311,6 +317,19 @@ func TestA16WeakenedProcessLimitIsDetected(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// nothingLeftWithin repeats the live-process check of nothingLeft until it
|
||||
// passes or the grace period ends, and returns the last finding.
|
||||
func nothingLeftWithin(executor *sandbox.Executor, uid int, grace time.Duration) string {
|
||||
deadline := time.Now().Add(grace)
|
||||
for {
|
||||
leftover := nothingLeft(executor, uid, nil)
|
||||
if leftover == "" || time.Now().After(deadline) {
|
||||
return leftover
|
||||
}
|
||||
time.Sleep(leftoverPoll)
|
||||
}
|
||||
}
|
||||
|
||||
// nothingLeft reports run directories, run cgroups, or sandbox user
|
||||
// processes that outlived a run, or an empty string. With a baseline of
|
||||
// earlier zombies, a new exited but unreaped process also counts: the suite
|
||||
|
||||
Reference in new issue
Block a user