DynamoRIO version of PIN_Raise_Exception

47 views
Skip to first unread message

carlo cannarsa

unread,
Jul 28, 2022, 4:02:16 AM7/28/22
to DynamoRIO Users
Hi,
I want to know if there exists a DynamoRIO version of PIN_Raise_Exception. And if it not exists, how I can raise one?

Carlo

Derek Bruening

unread,
Aug 1, 2022, 6:46:51 PM8/1/22
to carlo cannarsa, DynamoRIO Users
I don't think an API exists today.  It is open-source though: you could add one and send a pull request.  os_forge_exception() comes to mind as the closest internal function which could be leveraged.  Please file a feature request in the tracker as well.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/02728955-5942-4a05-91fe-96a031f2a106n%40googlegroups.com.

carlo cannarsa

unread,
Sep 6, 2022, 1:02:30 PM9/6/22
to DynamoRIO Users

Hi,
I didn't understand how can I create a DR API using os_forge_exception(), and in general how to add features. Anyway, I tried to add the code: I created a DR_API function in a .h file and then the definition of the function in a .c file of DynamoRIO source project, but I have "unresolved external symbol error" when compiling. In particular, the symbol is _os_forge_exception. Could you suggest me what could be the source of the problem? And why it doesn't find the symbol related to the internal function?

Carlo

Derek Bruening

unread,
Sep 7, 2022, 12:25:12 PM9/7/22
to carlo cannarsa, DynamoRIO Users
It is hard to say without seeing error report details showing what target is failing on what toolchain and seeing the source code changes to know where the new code was added.

On Tue, Sep 6, 2022 at 1:02 PM 'carlo cannarsa' via DynamoRIO Users <dynamor...@googlegroups.com> wrote:

Hi,
I didn't understand how can I create a DR API using os_forge_exception(), and in general how to add features. Anyway, I tried to add the code: I created a DR_API function in a .h file and then the definition of the function in a .c file of DynamoRIO source project, but I have "unresolved external symbol error" when compiling. In particular, the symbol is _os_forge_exception. Could you suggest me what could be the source of the problem? And why it doesn't find the symbol related to the internal function?

Carlo
Il giorno martedì 2 agosto 2022 alle 00:46:51 UTC+2 Derek Bruening ha scritto:
I don't think an API exists today.  It is open-source though: you could add one and send a pull request.  os_forge_exception() comes to mind as the closest internal function which could be leveraged.  Please file a feature request in the tracker as well.

On Thu, Jul 28, 2022 at 4:02 AM 'carlo cannarsa' via DynamoRIO Users <dynamor...@googlegroups.com> wrote:
Hi,
I want to know if there exists a DynamoRIO version of PIN_Raise_Exception. And if it not exists, how I can raise one?

Carlo

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/02728955-5942-4a05-91fe-96a031f2a106n%40googlegroups.com.

--
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.

carlo cannarsa

unread,
Sep 12, 2022, 9:09:39 AM9/12/22
to DynamoRIO Users
This is the code added:
core\ir\instrlist.c:

    return true;
}

+ void
+ my_exception_creation(instr_t *instr)
+ {
+     os_forge_exception(instr_get_app_pc(instr), STATUS_GUARD_PAGE_VIOLATION);
+ }

app_pc
instrlist_get_return_target(instrlist_t *bb)
{


core\ir\instrlist_api.h:
bool
instrlist_set_return_target(instrlist_t *bb, app_pc tgt);

+ DR_API
+ void
+ my_exception_creation(instr_t *instr);

#endif /* _DR_IR_INSTRLIST_H_ */


Then I build with Visual Studio and it shows me these errors:
err.png

Carlo

Derek Bruening

unread,
Sep 12, 2022, 12:57:20 PM9/12/22
to carlo cannarsa, DynamoRIO Users
The missing symbol is in the drdecode library which is pure IR and does not link in os_forge_exception().  The new API routine should not be inside the IR code as it has nothing to do with the IR: instrument.c is a better home.

carlo cannarsa

unread,
Sep 13, 2022, 2:53:23 AM9/13/22
to DynamoRIO Users
Thanks! That solved my problem when compiling DR source code. By the way, I now have the same error in my DR tool when I call the new API, even if dumpbin /EXPORTS shows me that the symbol is in dynamorio.lib. Should I change the home for the header file too? I don't know how to make my DR tool link with the new API somehow.

Carlo
Reply all
Reply to author
Forward
0 new messages