Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5969)

Issue 302710043: TBR: i#95 Linux detach: detaching via dr_app_stop_and_cleanup()

Can't Edit
Can't Publish+Mail
Start Review
Created:
7 years, 8 months ago by bruening
Modified:
7 years, 8 months ago
Reviewers:
zhaoqin
CC:
dynamorio-devs_googlegroups.com
Visibility:
Public.

Description

Commit log for first patchset: --------------- i#95 Linux detach: detaching via dr_app_stop_and_cleanup() Modeled on Peter Goodman's code at https://codereview.appspot.com/13314047 but with many changes, including: + not including any of the re-takeover changes: global var resets, etc. + using a futex instead of sleeping and checking a volatile bool. This does retain the duplication of Windows detach code from the patch. That will be addressed in an upcoming CL. Adds a new app API routine dr_app_stop_and_cleanup() which triggers a detach that can assume it's on an app thread and app stack. Implements detach cleanup for Linux by splitting the portions that must be executed by each thread (mainly segment restoration) from the rest of the cleanup that the detaching thread can perform. The final go-native step is accomplished via sigreturn using a generalized dynamorio_futex_wake_and_exit/dynamorio_semaphore_signal_all routine, renamed to dynamorio_condvar_wake_and_jmp and taking in a target routine to jump to after the wake. This target is dynamorio_sigreturn for detach. Adds two app-detach tests. ---------------

Patch Set 1 #

Patch Set 2 : Committed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+589 lines, -256 lines) Patch
M core/arch/aarchxx/aarchxx.asm View 2 chunks +7 lines, -7 lines 0 comments Download
M core/arch/arch_exports.h View 1 chunk +2 lines, -6 lines 0 comments Download
M core/arch/x86/x86.asm View 4 chunks +33 lines, -31 lines 0 comments Download
M core/dispatch.c View 2 chunks +10 lines, -4 lines 0 comments Download
M core/dynamo.c View 6 chunks +25 lines, -9 lines 0 comments Download
M core/globals.h View 2 chunks +6 lines, -2 lines 0 comments Download
M core/heap.c View 2 chunks +2 lines, -3 lines 0 comments Download
M core/lib/dr_app.h View 2 chunks +11 lines, -0 lines 0 comments Download
M core/optionsx.h View 1 chunk +2 lines, -2 lines 0 comments Download
M core/rct.c View 2 chunks +2 lines, -1 line 0 comments Download
M core/synch.h View 1 chunk +3 lines, -0 lines 0 comments Download
M core/synch.c View 5 chunks +189 lines, -8 lines 0 comments Download
M core/unix/os.c View 6 chunks +55 lines, -25 lines 0 comments Download
M core/unix/os_exports.h View 1 chunk +1 line, -0 lines 0 comments Download
M core/unix/os_private.h View 4 chunks +11 lines, -0 lines 0 comments Download
M core/unix/signal.c View 8 chunks +180 lines, -81 lines 0 comments Download
M core/win32/os.c View 2 chunks +1 line, -3 lines 0 comments Download
M core/win32/os_exports.h View 1 chunk +0 lines, -1 line 0 comments Download
M suite/tests/CMakeLists.txt View 4 chunks +15 lines, -1 line 0 comments Download
A + suite/tests/api/detach.c View 4 chunks +25 lines, -68 lines 0 comments Download
A suite/tests/api/detach.expect View 1 chunk +1 line, -0 lines 0 comments Download
A + suite/tests/api/static_detach.c View 1 chunk +6 lines, -3 lines 0 comments Download
A + suite/tests/api/static_detach.expect View 1 chunk +1 line, -1 line 0 comments Download
M suite/tests/api/static_startstop.c View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 2
bruening
7 years, 8 months ago (2016-09-13 22:31:18 UTC) #1
bruening
7 years, 8 months ago (2016-09-13 22:31:22 UTC) #2
Committed as
https://github.com/DynamoRIO/dynamorio/commit/959211659d07f35e356dc9aac0f451f...

Final commit log: 
---------------
i#95 Linux detach: detaching via dr_app_stop_and_cleanup()

Modeled on Peter Goodman's code at https://codereview.appspot.com/13314047
but with many changes, including:
+ not including any of the re-takeover changes: global var resets, etc.
+ using a futex instead of sleeping and checking a volatile bool.

This does retain the duplication of Windows detach code from the patch.
That will be addressed in an upcoming CL.

Adds a new app API routine dr_app_stop_and_cleanup() which triggers a
detach that can assume it's on an app thread and app stack.

Implements detach cleanup for Linux by splitting the portions that must be
executed by each thread (mainly segment restoration) from the rest of the
cleanup that the detaching thread can perform.

The final go-native step is accomplished via sigreturn using a generalized
dynamorio_futex_wake_and_exit/dynamorio_semaphore_signal_all routine,
renamed to dynamorio_condvar_wake_and_jmp and taking in a target routine to
jump to after the wake.  This target is dynamorio_sigreturn for detach.

Adds two app-detach tests.

Review-URL: https://codereview.appspot.com/302710043
---------------
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b