[Devel] [PATCH VZ10 8/8] selftests/ve: regression test for CLONE_NEWVE owner correctness

Konstantin Khorenko khorenko at virtuozzo.com
Thu May 14 18:44:08 MSK 2026


On 5/14/26 17:35, Konstantin Khorenko wrote:
>     1. Double-close of file descriptors: In both tests the parent closes two pipe ends manually, then
> calls sync_pipes_close() which closes all four. This results in a double-close on two fds:

...

   --- a/tools/testing/selftests/ve/ve_ns_owner_test.c
   +++ b/tools/testing/selftests/ve/ve_ns_owner_test.c
   @@ -155,13 +155,6 @@ static int sync_pipes_init(struct sync_pipes *s)
       return 0;
    }

   -static void sync_pipes_close(struct sync_pipes *s)
   -{
   -   close(s->child_to_parent[0]);
   -   close(s->child_to_parent[1]);
   -   close(s->parent_to_child[0]);
   -   close(s->parent_to_child[1]);
   -}
   -
    /*
     * Per-test context shared between parent and child.
     */
   @@ -344,7 +337,8 @@ TEST_F(ve_ns_owner, clone_newve_newnet_newns)
       ASSERT_TRUE(WIFEXITED(status));
       ASSERT_EQ(WEXITSTATUS(status), 0);

   -   sync_pipes_close(&ctx.sync);
   +   close(ctx.sync.child_to_parent[0]);
   +   close(ctx.sync.parent_to_child[1]);
    }

    /*
   @@ -419,7 +413,8 @@ TEST_F(ve_ns_owner, unshare_newve_newnet_newns)
       ASSERT_TRUE(WIFEXITED(status));
       ASSERT_EQ(WEXITSTATUS(status), 0);

   -   sync_pipes_close(&ctx.sync);
   +   close(ctx.sync.child_to_parent[0]);
   +   close(ctx.sync.parent_to_child[1]);
    }

?




More information about the Devel mailing list