DynamoRIO / DynamoRIO/dynamorio

CRASH using libpthread in a client

Open
#956 8 comments 0 reactions 0 assignees View on GitHub
Migrated Priority-Medium
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 18h
Merged PRs (30d)
30

Description

_From [gokcehan...@gmail.com](https://code.google.com/u/104009812273311444127/) on October 19, 2012 06:16:31_

For the Summary, please follow the guidelines at https://code.google.com/p/dynamorio/wiki/BugReporting and use one of the CRASH, APP CRASH, HANG, or ASSERT keywords What version of DynamoRIO are you using? 3.2.0-3 What operating system version are you running on? 64 bit Ubuntu 12.04
Linux kernel 3.2.0-32-generic What application are you running? a simple systemc example:

```
\#include "systemc.h"

SC_MODULE(first) {
SC_CTOR(first) {
SC_THREAD(first_foo);
}
void first_foo() {
cout \<< "hello from first module\n";
}
};

SC_MODULE(second) {
SC_CTOR(second) {
SC_THREAD(second_foo);
}
void second_foo() {
cout \<< "hello from second module\n";
}
};

SC_MODULE(top) {
first *f;
second *s;
SC_CTOR(top) {
f = new first("1st");
s = new second("2nd");
}
};

int sc_main(int argc, char* argv[]) {
top("top");
sc_start();
return 0;
} Is your application 32-bit or 64-bit? 64-bit How are you running the application under DynamoRIO? drrun -client /PATH/TO/DR/bin/libwrapperpp.so 0 "" /PATH/TO/APP/a.out What happens when you run without any client? it gives me the regular application output in addition to the first two lines about basename such as:

basename: missing operand
Try `basename --help' for more information.

SystemC 2.3.0-ASI --- Sep 20 2012 23:24:20
Copyright (c) 1996-2012 by all Contributors,
ALL RIGHTS RESERVED

hello from first module
hello from second module
```

What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)? Same crash with/without `-debug` flag. This is the output when run with `-debug`:




Segmentation fault (core dumped) What steps will reproduce the problem? I have prepared a minimal example of the client where I observe the crash:

```
\#include "dr_api.h"
\#include "drwrap.h"
\#include "drsyms.h"

\#include \ // this is the header of my application library

static void event_exit(void);

DR_EXPORT void
dr_init(client_id_t id)
{
drwrap_init();
drsym_init(0);
dr_printf("tracing started..\n");
dr_register_exit_event(event_exit);
}

static void
event_exit()
{
drwrap_exit();
drsym_exit();
dr_printf("tracing finished..\n");
}
```

If I exclude `#include \` it works fine. If I include, I get a segmentation fault. What is the expected output? What do you see instead? Is this an application crash, a DynamoRIO crash, a DynamoRIO assert, or a hang (see https://code.google.com/p/dynamorio/wiki/BugReporting and set the title appropriately)? I would expect just the output of my systemc program since I haven't really done anything in my client. Please provide any additional information below. Just to clear it out, DynamoRIO works fine with SystemC applications, it just doesn't like it when I try to include systemc header in my client.

_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=956_

Contributor guide

Open the contributing guide

Research direction

Reproduce the crash with the minimal client shown in the issue, comparing builds with and without the include under drrun on 64-bit Ubuntu. Start at dr_init, especially drwrap_init() and drsym_init(), then check the event_exit cleanup path. Done means the client no longer segfaults when including the SystemC header while preserving the expected application output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.