I've got an old problem with clamd, which creates a bunch of threads.
Every so often the logs will show e.g.,

  Jul 31 06:01:41 mx1 clamd[24070]: pthread_create failed
  Jul 31 06:01:41 mx1 clamd[24070]: pthread_create failed
  Jul 31 06:01:41 mx1 clamd[24070]: pthread_create failed
  Jul 31 06:01:41 mx1 clamd[24070]: pthread_create failed

It doesn't cause any noticeable problems, so I've sort of left it alone
but tonight I dug in a little. The problem seems (somehow) related to
that box's hardening.

I'm using a test program that creates a bunch of threads and then just
kills them. On the box in question,

  # uname -a
  Linux mx1 3.4.2-hardened #1 SMP Wed Jul 11 13:41:57 EDT 2012 i686
  Intel(R) Xeon(TM) CPU 3.06GHz GenuineIntel GNU/Linux
  # ./pthread_test 25
  Creating 25 threads
  Created thread #0...
  Created thread #1...
  Created thread #2...
  Created thread #3...
  pthread_create failed: Resource temporarily unavailable

Disabling all paxctl protections helps, but doesn't allow me to get all
the way to 25. I tried doing the protections one-at-a-time; it doesn't
really help:

  # paxctl -pemrxs pthread_test
  # ./pthread_test 25
  Creating 25 threads
  Created thread #0...
  Created thread #1...
  Created thread #2...
  Created thread #3...
  Created thread #4...
  Created thread #5...
  Created thread #6...
  Created thread #7...
  Created thread #8...
  Created thread #9...
  pthread_create failed: Resource temporarily unavailable

I get nothing in my dmesg, which otherwise records most limit-based denials.

Is there some way I can troubleshoot this? It works on amd64 with the
same kernel hardening options.

Reply via email to