This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/21512] New: clone() ends up calling exit_group() through _exit() wrapper


https://sourceware.org/bugzilla/show_bug.cgi?id=21512

            Bug ID: 21512
           Summary: clone() ends up calling exit_group() through _exit()
                    wrapper
           Product: glibc
           Version: 2.25
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: attila at sty dot hu
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

At least on the x86_64 architecture (but maybe on all), after the user function
of the clone() wrapper returns, the _exit() glibc wrapper is called instead of
syscall(SYS_exit,...):

from sysdeps/unix/sysv/linux/x86_64/clone.S:
        /* Call exit with return value from function call. */
        movq    %rax, %rdi
        call    HIDDEN_JUMPTARGET (_exit)

This may end up in the exit_group() system call:

from sysdeps/unix/sysv/linux/_exit.c:
   #ifdef __NR_exit_group
         INLINE_SYSCALL (exit_group, 1, status);
   #endif
         INLINE_SYSCALL (exit, 1, status);

which is not the right thing to do (at least for the CLONE_THREAD clones, but
maybe for none of them) because the "man clone(2)" documentation states
explicitly:

"After all of the threads in a thread group terminate the parent process of the
 thread group is sent a SIGCHLD (or other termination) signal."

So a return from the user function should not kill the whole process (thread
group), just that one particular thread which we returned from.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]