Move runuser to execute

This commit is contained in:
Vrganj 2021-01-17 15:44:40 +00:00
parent 14565b16e4
commit 9851352f87
30 changed files with 76 additions and 132 deletions

View File

@ -41,7 +41,7 @@ exec 200>&-
# runner # runner
timeout -s KILL 20 \ timeout -s KILL 20 \
lxc-attach --clear-env -n piston -- \ lxc-attach --clear-env -n piston -- \
/bin/bash -l -c "bash /exec/$lang $newinc $epoch" /bin/bash -l -c "runuser runner$newinc /exec/$lang $newinc $epoch"
# process janitor # process janitor
lxc-attach --clear-env -n piston -- \ lxc-attach --clear-env -n piston -- \

View File

@ -1,4 +1,4 @@
cd /tmp/$2 cd /tmp/$2
timeout -s KILL 2 sed "/___code___/Q" code.code > code.stdin timeout -s KILL 2 sed "/___code___/Q" code.code > code.stdin
timeout -s KILL 2 sed "1,/___code___/d" code.code > code.awk timeout -s KILL 2 sed "1,/___code___/d" code.code > code.awk
runuser runner$1 -c "cd /tmp/$2 ; timeout -s KILL 3 awk -f code.awk < code.stdin" timeout -s KILL 3 awk -f code.awk < code.stdin

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 xargs -a args.args -d '\n' timeout -s KILL 3 bash code.code < stdin.stdin
xargs -a args.args -d '\n' timeout -s KILL 3 bash code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' brainfuck code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' brainfuck code.code < stdin.stdin
"

View File

@ -1,7 +1,5 @@
#!/usr/bin/bash #!/usr/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 gcc -std=c11 -o binary -x c code.code
gcc -std=c11 -o binary -x c code.code timeout -s KILL 3 xargs -a args.args ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args ./binary < stdin.stdin
"

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 g++ -std=c++17 -o binary -x c++ code.code
g++ -std=c++17 -o binary -x c++ code.code timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
"

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary
mcs $(echo code.code | sed 's/\///') -nowarn:0219 -out:binary timeout -s KILL 3 xargs -a args.args -d '\n' mono binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' mono binary < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' deno run code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' deno run code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' elixir code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' elixir code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' emacs -Q --script code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' emacs -Q --script code.code < stdin.stdin
"

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 cp code.code interim.go
cp code.code interim.go go build interim.go
go build interim.go timeout -s KILL 3 xargs -a args.args -d '\n' ./interim < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./interim < stdin.stdin
"

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c "\ cd /tmp/$2
cd /tmp/$2 cp code.code code.hs
cp code.code code.hs ghc -dynamic -o binary code.hs > /dev/null 2>&1
ghc -dynamic -o binary code.hs > /dev/null 2>&1 timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
"

View File

@ -2,10 +2,6 @@
cd /tmp/$2 cd /tmp/$2
name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\/\\\n\s{]+)" code.code) name=$(grep -Po "(?<=\n|\A)\s*(public\s+)?(class|interface)\s+\K([^\/\\\n\s{]+)" code.code)
cp code.code $name.java
runuser runner$1 -c " javac $name.java
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' java $name < stdin.stdin
cp code.code $name.java
javac $name.java
timeout -s KILL 3 xargs -a args.args -d '\n' java $name < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' jelly fu code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' jelly fu code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' julia code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' julia code.code < stdin.stdin
"

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 cp code.code code.kt
cp code.code code.kt kotlinc code.kt -include-runtime -d code.jar
kotlinc code.kt -include-runtime -d code.jar timeout -s KILL 3 xargs -a args.args -d '\n' java -jar code.jar < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' java -jar code.jar < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' lua code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' lua code.code < stdin.stdin
"

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 nasm -f elf32 -o binary.o code.code
nasm -f elf32 -o binary.o code.code ld -m elf_i386 binary.o -o binary
ld -m elf_i386 binary.o -o binary timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
"

View File

@ -1,8 +1,6 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 nasm -f elf64 -o binary.o code.code
nasm -f elf64 -o binary.o code.code ld -m elf_x86_64 binary.o -o binary
ld -m elf_x86_64 binary.o -o binary timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' node code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' node code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 python3 -m paradoc code.code < args.args
timeout -s KILL 3 python3 -m paradoc code.code < args.args
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' perl code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' perl code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' php code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' php code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' python code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' python code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' python3.8 code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' python3.8 code.code < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' ruby code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ruby code.code < stdin.stdin
"

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 rustc -o binary code.code
rustc -o binary code.code timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' ./binary < stdin.stdin
"

View File

@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 timeout -s KILL 3 xargs -a args.args -d '\n' swift code.code < stdin.stdin
timeout -s KILL 3 xargs -a args.args -d '\n' swift code.code < stdin.stdin
"

View File

@ -1,10 +1,8 @@
#!/bin/bash #!/bin/bash
runuser runner$1 -c " cd /tmp/$2
cd /tmp/$2 mv code.code interim.ts
mv code.code interim.ts tsc interim.ts
tsc interim.ts rm -f interim.ts
rm -f interim.ts mv interim.js code.code
mv interim.js code.code timeout -s KILL 3 xargs -a args.args -d '\n' node code.code < stdin.stdin
xargs -a args.args -d '\n' timeout -s KILL 3 node code.code < stdin.stdin
"

View File

@ -3,7 +3,7 @@
mkdir -p /var/lib/lxc/piston/rootfs/exec mkdir -p /var/lib/lxc/piston/rootfs/exec
rm -f /var/lib/lxc/piston/rootfs/exec/* rm -f /var/lib/lxc/piston/rootfs/exec/*
cp -f executors/* /var/lib/lxc/piston/rootfs/exec cp -f executors/* /var/lib/lxc/piston/rootfs/exec
chmod 700 /var/lib/lxc/piston/rootfs/exec/* chmod 555 /var/lib/lxc/piston/rootfs/exec/*
chown -R root:root /var/lib/lxc/piston/rootfs/exec chown -R root:root /var/lib/lxc/piston/rootfs/exec
lxc-start -n piston -d lxc-start -n piston -d