2011/12/27 Dmitry V. Levin <[email protected]>:
> On Thu, Nov 17, 2011 at 10:25:26AM +0100, Łukasz Michalik wrote:
>> I'm currently debugging an issue in sydbox wrt recent linux kernels.
>> I initially thought strace wasn't affected by it, but then debian bug
>> #622863 [1] made me investigate further, althought it's impossible to
>> say what version was that user using.  It seems that unreleased code
>> clean up in HEAD exposes the bug, namely the 19cdada5b commit.
>>
>> The bug only happens on recent linux.  I've bisected the kernel and
>> found that it was introduced by 9b84cca2564b9 [2] in linux.git, so
>> pretty much everything since 3.0-rc2 is affected.
>
> Łukasz, thanks for letting us aware of the issue.  I had a hope that
> Denys as the author of that cleanup series would comment it, but
> I haven't heard from him yet.

I can confirm that bug triggers with current git and kernel 3.1.6;
sometime later I will try reverting kernel commit 9b84cca2564b9.

>> I'm attaching a testcase that makes strace -f fail within seconds
>> (compile with g++ -std=c++0x -pthread); it just fires whole bunch of
>> threads that fork and wait for exiting children.

Please find modified testcase attached. Modifications make it
compilable with only plain C, not C++, compiler; also,
I changed exit codes so it's a bit more easy to see under strace
who's exiting.

Attached LOG.bz2 is an example of a full strace -f session
which caught a bug.

-- 
vda
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/sysinfo.h>
#include <sys/wait.h>
#include <stdio.h>
#include <pthread.h>

void* worker(void *arg)
{
	while (1) {
		pid_t p = fork();
		if (-1 == p) { /* error */
			perror("fork");
			_exit(EXIT_FAILURE);
		}
		if (0 == p) { /* child */
			_exit(42);
		}
		/* parent */
		int stat_loc;
		int s = waitpid(p, &stat_loc, 0);
		if (-1 == s) {
			perror("waitpid");
			_exit(EXIT_FAILURE);
		}
	}
}

int main(int argc, char **argv)
{
	const int pool_size = get_nprocs() * 4;
	printf("Poolsize: %d\n", pool_size);

	pthread_t thread_id;
	int i;
	for (i = 0; i != pool_size; ++i) {
		if (pthread_create(&thread_id, NULL, worker, NULL) != 0) {
			perror("pthread_create");
			_exit(EXIT_FAILURE);
		}
	}

	/* Prevent exiting: wait for last thread (forever) */
	void *retval;
	pthread_join(thread_id, &retval);

	return 43;
}

Attachment: LOG.bz2
Description: BZip2 compressed data

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to