From d3ce64c2b2e36abd2a5c3e835ea84469aa44c080 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Fri, 3 Apr 2020 14:08:03 +0000 Subject: [PATCH] [LibOS] Be more precise in reporting clone parameters Additional clone parameters only matter if certain CLONE flags are set and otherwise may contain useless/invalid values. So, be more precise in reporting them in debug output. --- LibOS/shim/src/sys/shim_clone.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/LibOS/shim/src/sys/shim_clone.c b/LibOS/shim/src/sys/shim_clone.c index 8de8718f..91284c33 100644 --- a/LibOS/shim/src/sys/shim_clone.c +++ b/LibOS/shim/src/sys/shim_clone.c @@ -211,15 +211,16 @@ int shim_do_clone (int flags, void * user_stack_addr, int * parent_tidptr, /* FIXME: we ignore parent_tidptr, child_tidptr and tls; no application seems to use a * combination of clone(CLONE_VFORK) and these parameters */ - if (parent_tidptr || child_tidptr || tls) { - debug("Emulation of clone(CLONE_VFORK) ignores"); - if (parent_tidptr) - debug(" parent_tidptr = %p,", parent_tidptr); - if (child_tidptr) - debug(" child_tidptr = %p,", child_tidptr); - if (tls) - debug(" tls = %p,", tls); - debug(" taking into account only user_stack_addr = %p\n", user_stack_addr); + if (flags & (CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|CLONE_SETTLS)) { + debug("Emulation of clone(CLONE_VFORK) takes into account only user_stack_addr = %p. " + "Additional parameters are ignored:", user_stack_addr); + if (flags & CLONE_PARENT_SETTID) + debug(" parent_tidptr = %p", parent_tidptr); + if (flags & (CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID)) + debug(" child_tidptr = %p", child_tidptr); + if (flags & CLONE_SETTLS) + debug(" tls = %p", tls); + debug("\n"); } ret = shim_do_vfork();