fix(runner): load the seccomp policy on amd64 and make the A16 bombs deterministic

This commit is contained in:
shira committed 2026-10-11 09:44:45 +03:00
1 parent e858280d91
commit 1ebd23693e
8 files changed
+68 -24

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
// Goroutine bomb: unbounded goroutines parked on a channel need no new OS
// threads, so only their stacks grow; the cgroup memory limit must stop it.
package main
func main() {
block := make(chan struct{})
for {
go func() { <-block }()
}
}
+8 -3
View File
@@ -1,5 +1,7 @@
// Thread bomb: goroutines blocked in system calls force the runtime to
// create threads; the cgroup process limit must stop it.
// Thread bomb: 256 goroutines blocked in system calls force the runtime to
// create an OS thread for each; the cgroup process limit must stop it. The
// goroutine count is bounded so that their stacks stay far below the memory
// limit and the process limit is always the one that stops the program.
package main
import (
@@ -7,15 +9,18 @@ import (
"syscall"
)
const blockedGoroutines = 256
func main() {
var fds [2]int
if err := syscall.Pipe(fds[:]); err != nil {
os.Exit(2)
}
for {
for range blockedGoroutines {
go func() {
buffer := make([]byte, 1)
_, _ = syscall.Read(fds[0], buffer)
}()
}
select {}
}
+12
View File
@@ -325,6 +325,18 @@
"limit": "memory"
}
},
{
"name": "go_goroutine_bomb",
"category": "memory",
"language": "go",
"source": "go/goroutine_bomb.go",
"input": "",
"expected_output": "",
"expect": {
"outcome": "memory_limit_exceeded",
"limit": "memory"
}
},
{
"name": "go_disk_fill",
"category": "disk",