From: Sergiu Moga Date: Fri, 7 Feb 2025 12:27:45 +0000 (+0200) Subject: lib/syscall_shim: Avoid nested syscalls within binary syscalls X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6997d1f3f2db70f791de5222c9fb296a26a824e7;p=unikraft%2Funikraft.git lib/syscall_shim: Avoid nested syscalls within binary syscalls The binary system call handler calls `uk_syscall6_r_e`, which ends up calling either the `uk_syscall_r_` or the `uk_syscall_r_e_` variant of the syscall wrappers, which also iterate through the system call enter/exit tables. However, the binary system call itself also runs through these tables already, therefore avoid this from happening twice by calling the `uk_syscall_do_` and `uk_syscall_do_e` variants of the system calls through `uk_syscall6_do_e`. Signed-off-by: Sergiu Moga Approved-by: Michalis Pappas Reviewed-by: Michalis Pappas GitHub-Closes: #1277 --- diff --git a/lib/syscall_shim/uk_syscall_binary.c b/lib/syscall_shim/uk_syscall_binary.c index dab38c7e3..eeac93f13 100644 --- a/lib/syscall_shim/uk_syscall_binary.c +++ b/lib/syscall_shim/uk_syscall_binary.c @@ -107,7 +107,7 @@ void ukplat_syscall_handler(struct uk_syscall_ctx *usc) UK_SYSCALL_ENTER_CTX_BINARY_SYSCALL); uk_syscall_entertab_run(&enter_ctx); - execenv->regs.__syscall_rret0 = uk_syscall6_r_e(execenv); + execenv->regs.__syscall_rret0 = uk_syscall6_do_e(execenv); uk_syscall_exit_ctx_init(&exit_ctx, execenv, uk_syscall_nested_depth,