lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140623091243.GN19860@laptop.programming.kicks-ass.net>
Date:	Mon, 23 Jun 2014 11:12:43 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Tony Lu <zlu@...era.com>
Cc:	Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...hat.com>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Chris Metcalf <cmetcalf@...era.com>
Subject: Re: [BUG] perf: can not resolve symbols for forked threads

On Thu, Jun 19, 2014 at 07:39:42AM +0000, Tony Lu wrote:
> Hi
> 
> I got the below output that shows perf can not resolve symbols for
> forked threads. I did a system-wide collection from all CPUs after the
> application hello run.

There's no fork() in... :-)

> #include <pthread.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #define NUM_THREADS     5
> 
> void foo(void)
> {
>   long i = 1000000000;
>   while (i--) {
>     ;
>   }
> }
> 
> void *PrintHello(void *threadid)
> {
>    long tid;
>    tid = (long)threadid;
>    printf("Hello World! It's me, thread #%ld!\n", tid);
>    foo();
>    pthread_exit(NULL);
> }
> 
> int main(int argc, char *argv[])
> {
>    pthread_t threads[NUM_THREADS];
>    int rc;
>    long t;
>    for(t=0;t<NUM_THREADS;t++){
>      printf("In main: creating thread %ld\n", t);
>      rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
>      if (rc){
>        printf("ERROR; return code from pthread_create() is %d\n", rc);
>        exit(-1);
>        }
>      }
> 
>    /* Last thing that main() should do */
>    pthread_exit(NULL);
> }

That pthread_exit() is the problem; this results in:

29456 pts/23   Zl     0:00          |               \_ [hello] <defunct>

You want to wait for the threads to complete using pthread_join().

I suspect the defunct state hides the process.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ