Inserting a thread in dynamorio application

216 views
Skip to first unread message

Henrique Noronha Facioli

unread,
Mar 22, 2018, 5:34:26 AM3/22/18
to DynamoRIO Users
Hi!,

I've been working on a dynamorio client and i'm using drwrap to insert some code on a function call. Now, I'd like to create a thread inside application (especifically, I want to create a thread when a function is called to make some computation). I tried to include pthread lib and call it on a wrap but I get the process killed with a "ERROR: master_signal_handler with no siginfo (i#26?): tid=21930, sig=11"
I'd like to know if anybody ever tried doing something like this, can help me achieve it or even if could explain to me why this will not work and led me to a "probably will work" path.
Also, I've been studyng the implementation of Dynamorio and the documentation to understand how Dynamorio really works: does it create a thread inside the process to run the the application and one to run the dynamorio? Or does the dynamorio do the computation ant the beginning and insert something on application process or what? Can someone point where can i find this information and more about the it?

Derek Bruening

unread,
Mar 22, 2018, 12:52:49 PM3/22/18
to dynamor...@googlegroups.com
On Thu, Mar 22, 2018 at 5:34 AM Henrique Noronha Facioli <henrique...@gmail.com> wrote:
Hi!,

I've been working on a dynamorio client and i'm using drwrap to insert some code on a function call. Now, I'd like to create a thread inside application (especifically, I want to create a thread when a function is called to make some computation). I tried to include pthread lib

Pthreads use by clients is not supported.  Consider using dr_create_client_thread() instead.

Xref https://groups.google.com/forum/#!topic/dynamorio-users/ED8nbG2tIdU

Xref http://dynamorio.org/docs/release_notes.html: "On Linux, the private loader will fail to load libpthread.so. Therefore clients and the libraries they use cannot link against libpthread.so."

Xref http://dynamorio.org/docs/using.html: "native threading libraries such as libpthread.so on Linux are known to cause problems."

Xref http://code.google.com/p/dynamorio/issues/detail?id=956#c5 for further details if you'd like to try to make it work (and hopefully contribute that back).
 
and call it on a wrap but I get the process killed with a "ERROR: master_signal_handler with no siginfo (i#26?): tid=21930, sig=11"
I'd like to know if anybody ever tried doing something like this, can help me achieve it or even if could explain to me why this will not work and led me to a "probably will work" path.
Also, I've been studyng the implementation of Dynamorio and the documentation to understand how Dynamorio really works: does it create a thread inside the process to run the the application and one to run the dynamorio?

No, no new threads are created: just the same threads the app uses natively.  See the tutorial slides at http://dynamorio.org/tutorial-cgo17.html slide 52.
 
Or does the dynamorio do the computation ant the beginning and insert something on application process or what? Can someone point where can i find this information and more about the it?

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To post to this group, send email to dynamor...@googlegroups.com.
Visit this group at https://groups.google.com/group/dynamorio-users.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

juj...@gmail.com

unread,
Mar 22, 2018, 3:14:07 PM3/22/18
to DynamoRIO Users
Hi Derek,

Henrique is trying to create application threads using drwrap. For example:

...
drwrap_wrap
(towrap, wrap_pre, NULL);
...

static void wrap_pre (void *wrapcxt, OUT void **user_data) {
   ...
   pthread_create(...);
   ...
}


Is it possible using drwrap? or should we follow another approach (like this https://groups.google.com/forum/#!searchin/dynamorio-users/%22application$20thread%22%7Csort:date/dynamorio-users/yr8NM1295s0/QNYmGQWn4VgJ) ?

Derek Bruening

unread,
Mar 22, 2018, 4:00:27 PM3/22/18
to dynamor...@googlegroups.com
On Thu, Mar 22, 2018 at 3:14 PM <juj...@gmail.com> wrote:
Hi Derek,

Henrique is trying to create application threads using drwrap. For example:

...
drwrap_wrap
(towrap, wrap_pre, NULL);
...

static void wrap_pre (void *wrapcxt, OUT void **user_data) {
   ...
   pthread_create(...);
   ...
}



The drwrap_wrap() pre- and post- callbacks are running as the client, not the app.
Right you would want something like in that thread or https://github.com/DynamoRIO/dynamorio/issues/497.
 


On Thursday, March 22, 2018 at 6:34:26 AM UTC-3, Henrique Noronha Facioli wrote:
Hi!,

I've been working on a dynamorio client and i'm using drwrap to insert some code on a function call. Now, I'd like to create a thread inside application (especifically, I want to create a thread when a function is called to make some computation). I tried to include pthread lib and call it on a wrap but I get the process killed with a "ERROR: master_signal_handler with no siginfo (i#26?): tid=21930, sig=11"
I'd like to know if anybody ever tried doing something like this, can help me achieve it or even if could explain to me why this will not work and led me to a "probably will work" path.
Also, I've been studyng the implementation of Dynamorio and the documentation to understand how Dynamorio really works: does it create a thread inside the process to run the the application and one to run the dynamorio? Or does the dynamorio do the computation ant the beginning and insert something on application process or what? Can someone point where can i find this information and more about the it?

--
Message has been deleted
Message has been deleted

juj...@gmail.com

unread,
Mar 22, 2018, 4:42:40 PM3/22/18
to DynamoRIO Users
Thanks!

I have another question: is  dr_create_client_thread()  implemented for ARM?


On Thursday, March 22, 2018 at 6:34:26 AM UTC-3, Henrique Noronha Facioli wrote:

Derek Bruening

unread,
Mar 23, 2018, 11:17:59 AM3/23/18
to dynamor...@googlegroups.com
On Fri, Mar 23, 2018 at 11:00 AM <juj...@gmail.com> wrote:
Thanks Derek!

Another question: Is  dr_create_client_thread()  implemented for ARM?

Did you hit a failure there?  You're asking because the client.thread and client.signal tests are not yet ported to ARM?  That's because they have some inline assembly which has not been ported over (contributions welcome if you want to take that on).
Reply all
Reply to author
Forward
0 new messages