summary refs log tree commit diff stats
path: root/results/classifier/zero-shot-user-mode/output/instruction/2825
diff options
context:
space:
mode:
Diffstat (limited to 'results/classifier/zero-shot-user-mode/output/instruction/2825')
-rw-r--r--results/classifier/zero-shot-user-mode/output/instruction/282543
1 files changed, 43 insertions, 0 deletions
diff --git a/results/classifier/zero-shot-user-mode/output/instruction/2825 b/results/classifier/zero-shot-user-mode/output/instruction/2825
new file mode 100644
index 00000000..cd9ba3ad
--- /dev/null
+++ b/results/classifier/zero-shot-user-mode/output/instruction/2825
@@ -0,0 +1,43 @@
+instruction: 0.609
+runtime: 0.267
+syscall: 0.125
+
+
+
+execveat with file descriptor and empty filename returns ENOENT when cross architectures
+Description of problem:
+On my x86_64 debian host (with binfmt_misc configured), when calling execveat with a fd , and empty pathname "", and flag AT_EMPTY_PATH. Then only x86_64 and x86 can be called normally, while programs of other architectures (arm64, arm, riscv64, etc.) will return ENOENT errors.
+
+I first encountered this problem when trying to run lxc-attach with qemu-aarch64. Its reference is [lxc/stable-6.0/src/include/fexecve.c#L30](https://github.com/lxc/lxc/blob/stable-6.0/src/include/fexecve.c#L30), which is the implementation of the fexecve function. So I wrote a simple test and compiled it with `x86_64/aarch64-linux-gnu-gcc -static test.c -o test`. execveat works fine when running natively or using qemu-x86_64/qemu-i386. When running versions for other architectures, using AT_EMPTY_PATH will result in ENOENT (No such file or directory); use /proc/self/fd/%d as the pathname and execve, it will work fine (like the rest part of the fexecve function). If binfmt_misc is turned off and run forign architectures ver, both calls will result in ENOEXEC (Exec format error).
+Steps to reproduce:
+1. Install qemu-user and binfmt_misc. Install gcc-aarch64-linux-gnu/gcc-riscv64-linux-gnu etc.
+2. Compile test.c with host gcc, then compile forign architectures ver with gcc-aarch64-linux-gnu/gcc-riscv64-linux-gnu etc. like `gcc -static test.c -o test` and `aarch64-linux-gnu-gcc -static test.c -o test-aarch64`
+3. Run different versions of test
+4. To disable/enable binfmt, you can `echo 0 > /proc/sys/fs/binfmt_misc/qemu-aarch64` or `echo 1 > /proc/sys/fs/binfmt_misc/qemu-aarch64`
+5. Sample outputs
+
+```
+rrex@debian:~/Downloads$ ./test
+****Running to prepare execve
+fd=3
+File size: 772296 bytes
+
+execveat with AT_EMPTY_PATH:
+**Running in execve
+
+execveat with fd path: /proc/self/fd/3
+**Running in execve
+
+rrex@debian:~/Downloads$ qemu-aarch64 ./test-aarch64 
+****Running to prepare execve
+fd=3
+File size: 706104 bytes
+
+execveat with AT_EMPTY_PATH:
+!!execveat a fd failed with errno: No such file or directory
+
+execveat with fd path: /proc/self/fd/3
+**Running in execve
+```
+Additional information:
+#