]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/vfscore: Handle CLONE_VM
authorMichalis Pappas <michalis@unikraft.io>
Wed, 15 Nov 2023 15:24:52 +0000 (16:24 +0100)
committerUnikraft Bot <monkey@unikraft.io>
Fri, 17 Jan 2025 14:59:21 +0000 (14:59 +0000)
vfork() sets the CLONE_VM and CLONE_VFORK flags. This triggers an
error in the clone handlers of vfscore as CLONE_FS is not set. Update
the handlers to additionally check against CLONE_VM, as that also
implies that the parent and child share filesystem state.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1386

lib/vfscore/fd.c
lib/vfscore/syscalls.c

index eb2c667e54784b529557ff561a35931ad6505268..52e8c3110b71ad3d125492e8f487cae9ff93e56d 100644 (file)
@@ -79,7 +79,8 @@ static int uk_posix_clone_files(const struct clone_args *cl_args,
                                struct uk_thread *child __unused,
                                struct uk_thread *parent __unused)
 {
-       if (unlikely(!(cl_args->flags & CLONE_FILES))) {
+       if (unlikely(!(cl_args->flags & CLONE_FILES) &&
+                    !(cl_args->flags & CLONE_VM))) {
                uk_pr_warn("CLONE_FILES not set");
                return -ENOTSUP;
        }
index ab7eaeab67d1bfd1f010377ad559050fd3388b40..40d379838edb865b4013dcadc8f6819b3c1cbc9a 100644 (file)
@@ -1237,7 +1237,8 @@ static int uk_posix_clone_fs(const struct clone_args *cl_args,
                             struct uk_thread *child __unused,
                             struct uk_thread *parent __unused)
 {
-       if (unlikely(!(cl_args->flags & CLONE_FS))) {
+       if (unlikely(!(cl_args->flags & CLONE_FS) &&
+                    !(cl_args->flags & CLONE_VM))) {
                uk_pr_warn("Separate filesystem information for children are not supported (CLONE_FS absent)\n");
                return -ENOTSUP;
        }