test(runner): verify sandbox isolation with a hostile program suite
This commit is contained in:
1 parent
afee564bf4
commit
e858280d91
38 files changed
+1359
-168
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
// Timeout survival: a child in its own session outlives the parent; the PID
|
||||
// namespace must take it down with the run.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) > 1 {
|
||||
time.Sleep(time.Hour)
|
||||
return
|
||||
}
|
||||
child := exec.Command(os.Args[0], "daemon")
|
||||
child.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
||||
if err := child.Start(); err != nil {
|
||||
fmt.Println("start failed:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("parent done")
|
||||
}
|
||||
Reference in new issue
Block a user