Hello,

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.

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.  The test case is
perverse, but same would happen if one would try to compile say gcc
under strace with considerable number of paraller jobs for long
enough.

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622863
[2] 
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=9b84cca2564b9a5b2d064fb44d2a55a5b44473a0

-- 
Pozdrawiam,
Łukasz P. Michalik
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <list>
#include <iostream>
#include <thread>
#include <sys/sysinfo.h>
#include <sys/wait.h>
#include <unistd.h>

void worker()
{
  while (true)
    {
      pid_t p(fork());
      if (-1 == p)
        {
          std::cout << "Failed to fork: " << std::strerror(errno) << std::endl;
          _exit(EXIT_FAILURE);
        }

      if (0 == p)
        {
          _exit(EXIT_SUCCESS);
        }
      else 
        {
          int stat_loc;
          int s(waitpid(p, &stat_loc, 0));
          if (-1 == s)
            {
              std::cout << "Failed to wait: " << std::strerror(errno) << 
std::endl;
              _exit(EXIT_FAILURE);
            }
        }
    }
}

int main()
{
  const int pool_size(get_nprocs() * 4);
  std::cout << "Poolsize: " << pool_size << std::endl;

  std::list<std::thread> pool;

  for (int i(0); i != pool_size; ++i)
    pool.push_back(std::thread(&worker));

  pool.front().join();
}

Attachment: pgpEkerQZopVd.pgp
Description: PGP signature

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to