Bug 462825 - Utrace patch prevents clone()d thread from exiting.
Summary: Utrace patch prevents clone()d thread from exiting.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-09-19 07:33 UTC by Tetsuo Handa
Modified: 2008-10-24 02:36 UTC (History)
2 users (show)

Fixed In Version: 2.6.26.6-79.fc9
Clone Of:
Environment:
Last Closed: 2008-10-24 02:36:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Tetsuo Handa 2008-09-19 07:33:40 UTC
Description of problem:

I noticed that clone()d thread sleeps forever on exit.
The clone()d thread's state becomes zombie, but it is not notified to
the process calling waitpid().

Not applying the three patches listed below solves this problem.
I think this problem is introduced by one of these patches.

  # Roland's utrace ptrace replacement.
  ApplyPatch linux-2.6-ptrace-cleanup.patch
  ApplyPatch linux-2.6-tracehook.patch
  ApplyPatch linux-2.6-utrace.patch

Version-Release number of selected component (if applicable):

Fedora 8's 2.6.26.3-14.fc8 and Fedora 9's 2.6.26.3-29.fc9 are affected.

How reproducible:
100%

Steps to Reproduce:
1. Compile the following program and run.

----------
#define _GNU_SOURCE
#include <sched.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>

static int child(void *arg) {
	return 0;
}

int main(int argc, char *argv[]) {
	int error;
	char *stack = malloc(8192);
	printf("Calling clone() ");
	{
		const pid_t pid = clone(child, stack + (8192 / 2), CLONE_NEWNS, NULL);
		printf("(pid=%d)\n", pid);
		fflush(stdout);
		while (waitpid(pid, &error, __WALL) == EOF && errno == EINTR);
	}
	printf("waitpid() returned %d\n", WIFEXITED(error) ? WEXITSTATUS(error) : -1);
	return 0;
}
----------
2.
3.
  
Actual results:
It sleeps forever until terminated by Ctrl-C.

Expected results:
It sould return immediately.

Additional info:

Comment 1 Roland McGrath 2008-09-30 05:40:58 UTC
This is fixed in the rawhide kernel.

Comment 2 Tetsuo Handa 2008-10-11 11:11:14 UTC
Hello.

> This is fixed in the rawhide kernel.
I see. Thanks.

But I haven't seen the fixed kernel for Fedora 8 and Fedora 9 yet.
Are Fedora 8 and Fedora 9 planning to jump to 2.6.27 without fixing this bug? :-)

Comment 3 Tetsuo Handa 2008-10-21 12:03:14 UTC
I found kernel-2.6.26.6-49.fc8.src.rpm and kernel-2.6.26.6-79.fc9.src.rpm in updates/testing/ repository.

Please close this topic. Thank you.


Note You need to log in before you can comment on or make changes to this bug.