Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(957)

Issue 553403002: [Android] libheap_profiler/heap_dump: use ptrace instead of SIGSTOP. (Closed)

Created:
6 years, 3 months ago by Primiano Tucci (use gerrit)
Modified:
6 years, 3 months ago
Reviewers:
pasko, eugenis
CC:
chromium-reviews, klundberg+watch_chromium.org, yfriedman+watch_chromium.org, Dai Mikurube (NOT FULLTIME), bccheng1, eugenis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

[Android] libheap_profiler/heap_dump: use ptrace instead of SIGSTOP. This change changes heap_dump to use ptrace rather than SIGSTOP to freeze the target process. Recent kernels (Android L) forbid to attach to /proc/PID/mem if the process is not ptrace-d. This has also two advantageous side effects: 1. PTRACE_ATTACH is independent of the process state (if it was STOPped it will stay stopped after the detach). 2. If heap_dump crashes or is killed, the process is automatically detached by the kernel (so we can get rid of the SIGPIPE/INT logic). Furthermore this CL makes the consistency checks optional (adding a -n switch to disable them). BUG=382489 Committed: https://crrev.com/e229b8263c7ee6a82ae90af54c32a1ce5705da98 Cr-Commit-Position: refs/heads/master@{#294222}

Patch Set 1 #

Total comments: 9

Patch Set 2 : handle signal interrupts #

Total comments: 3

Patch Set 3 : paranoid read #

Total comments: 2

Patch Set 4 : Fix read #

Unified diffs Side-by-side diffs Delta from patch set Stats (+49 lines, -39 lines) Patch
M tools/android/heap_profiler/heap_dump.c View 1 2 3 15 chunks +49 lines, -39 lines 0 comments Download

Messages

Total messages: 20 (3 generated)
Primiano Tucci (use gerrit)
Egor, would you mind taking a look to this small change? I'm making some fixes ...
6 years, 3 months ago (2014-09-10 10:16:40 UTC) #2
pasko
I did not review heap_dump.c, and I forgot a few details about the heap_profiler, so ...
6 years, 3 months ago (2014-09-10 12:09:18 UTC) #3
pasko
https://codereview.chromium.org/553403002/diff/1/tools/android/heap_profiler/heap_dump.c File tools/android/heap_profiler/heap_dump.c (right): https://codereview.chromium.org/553403002/diff/1/tools/android/heap_profiler/heap_dump.c#newcode321 tools/android/heap_profiler/heap_dump.c:321: ptrace(PTRACE_DETACH, pid, NULL, NULL); On 2014/09/10 12:09:18, pasko wrote: ...
6 years, 3 months ago (2014-09-10 12:45:53 UTC) #4
Primiano Tucci (use gerrit)
>In particular, what happens if we sigsnop/attach/whatever to >the process while >heap_profiler is maintaining the ...
6 years, 3 months ago (2014-09-10 13:17:35 UTC) #5
pasko
On 2014/09/10 13:17:35, Primiano Tucci wrote: > >In particular, what happens if we sigsnop/attach/whatever to ...
6 years, 3 months ago (2014-09-10 13:30:58 UTC) #6
Primiano Tucci (use gerrit)
> Why are you saying that only one entry can be inconsistent? Do we > ...
6 years, 3 months ago (2014-09-10 14:17:20 UTC) #7
Primiano Tucci (use gerrit)
+eugenis@ if you have a spare minute can you please TAL to Egor's questions on ...
6 years, 3 months ago (2014-09-10 15:02:50 UTC) #8
pasko
On 2014/09/10 14:17:20, Primiano Tucci wrote: > > Why are you saying that only one ...
6 years, 3 months ago (2014-09-10 15:04:36 UTC) #9
pasko
very close, but reading needs more love .. https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c File tools/android/heap_profiler/heap_dump.c (right): https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c#newcode238 tools/android/heap_profiler/heap_dump.c:238: } ...
6 years, 3 months ago (2014-09-10 15:25:23 UTC) #10
Primiano Tucci (use gerrit)
https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c File tools/android/heap_profiler/heap_dump.c (right): https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c#newcode238 tools/android/heap_profiler/heap_dump.c:238: } while(res == 1 && errno == EINTR); On ...
6 years, 3 months ago (2014-09-10 15:42:17 UTC) #12
Evgeniy Stepanov
On 2014/09/10 15:42:17, Primiano Tucci wrote: > https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c > File tools/android/heap_profiler/heap_dump.c (right): > > https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c#newcode238 ...
6 years, 3 months ago (2014-09-10 15:50:37 UTC) #13
pasko
https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c File tools/android/heap_profiler/heap_dump.c (right): https://codereview.chromium.org/553403002/diff/20001/tools/android/heap_profiler/heap_dump.c#newcode238 tools/android/heap_profiler/heap_dump.c:238: } while(res == 1 && errno == EINTR); On ...
6 years, 3 months ago (2014-09-10 16:09:28 UTC) #14
Primiano Tucci (use gerrit)
https://codereview.chromium.org/553403002/diff/40001/tools/android/heap_profiler/heap_dump.c File tools/android/heap_profiler/heap_dump.c (right): https://codereview.chromium.org/553403002/diff/40001/tools/android/heap_profiler/heap_dump.c#newcode245 tools/android/heap_profiler/heap_dump.c:245: bytes_read += res; Yeah, Apparently I am not able ...
6 years, 3 months ago (2014-09-10 16:36:46 UTC) #15
pasko
lgtm
6 years, 3 months ago (2014-09-10 16:42:03 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/primiano@chromium.org/553403002/60001
6 years, 3 months ago (2014-09-10 19:12:46 UTC) #18
commit-bot: I haz the power
Committed patchset #4 (id:60001) as a8972be9ebe291007b8a44403922ba64dbcec625
6 years, 3 months ago (2014-09-10 20:45:46 UTC) #19
commit-bot: I haz the power
6 years, 3 months ago (2014-09-10 20:47:59 UTC) #20
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/e229b8263c7ee6a82ae90af54c32a1ce5705da98
Cr-Commit-Position: refs/heads/master@{#294222}

Powered by Google App Engine
This is Rietveld 408576698