]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/syscall_shim: Avoid nested syscalls within binary syscalls
authorSergiu Moga <sergiu@unikraft.io>
Fri, 7 Feb 2025 12:27:45 +0000 (14:27 +0200)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 14 Feb 2025 17:47:25 +0000 (17:47 +0000)
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 <sergiu@unikraft.io>
Approved-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
GitHub-Closes: #1277

lib/syscall_shim/uk_syscall_binary.c

index dab38c7e301cabd6fc8d7674d8ef034ec1b7b7fa..eeac93f13f49f1519361916872bafe942ff9c07a 100644 (file)
@@ -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,