From 0253f244793e935d635ddc76926b6489d988d745 Mon Sep 17 00:00:00 2001 From: Kevin Diaz Date: Sat, 3 Oct 2020 13:16:15 -0400 Subject: [PATCH] Create nasm64 executor and test file --- lxc/executors/nasm64 | 4 ++++ lxc/tests/test64.nasm | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 lxc/executors/nasm64 create mode 100644 lxc/tests/test64.nasm diff --git a/lxc/executors/nasm64 b/lxc/executors/nasm64 new file mode 100755 index 0000000..8723995 --- /dev/null +++ b/lxc/executors/nasm64 @@ -0,0 +1,4 @@ +cd /tmp/$2 +timeout -s KILL 10 nasm -f elf64 -o binary.o code.code +timeout -s KILL 10 ld -m elf_x86_64 binary.o -o binary +runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 ./binary" diff --git a/lxc/tests/test64.nasm b/lxc/tests/test64.nasm new file mode 100644 index 0000000..191b8d3 --- /dev/null +++ b/lxc/tests/test64.nasm @@ -0,0 +1,18 @@ +SECTION .data + good: db "good", 0x0a, 0x0 + txtlen: equ $ - good + +SECTION .text +GLOBAL _start + +_start: + ;sys_write + mov rax, 1 + mov rdi, 1 + mov rsi, good + mov rdx, txtlen + syscall + ;sys_exit + mov rax, 60 + mov rdi, 0 + syscall