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

Issue 1304005: fix races in CrashGenerator::CreateChildCrash (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 7 months ago by vapier
Modified:
10 years, 7 months ago
Reviewers:
Ben Chan, vapier1
CC:
google-breakpad-dev_googlegroups.com
Base URL:
http://google-breakpad.googlecode.com/svn/trunk/
Visibility:
Public.

Description

fix races in CrashGenerator::CreateChildCrash

The current CreateChildCrash logic is racy when it comes to creating a
crash dump for two reasons:

The main thread that calls kill() on a different thread is guaranteed
the signal will be *queued* when it returns, but not *delivered*.  If
the kernel doesn't automatically schedule the receiving thread, but
instead lets the main thread run to the exit() call, then the signal
never triggers a coredump and the whole process simply exits.

The main thread is using kill() to try to deliver a signal to a
specific thread, but that function is for sending signals to a
process.  That means the kernel is free to deliver the signal to
any thread in the process and not just the one requested.  This
manifests itself as the pr_pid in the coredump not being the one
expected.  Instead, we must use tkill() with the tid (which we
already took care of gathering) to deliver to a specific thread.

These are a lot easier to see on a UMP system as contention is heavier.

BUG=chromium:207918
TEST=`dumper_unittest` still passes, and doesn't flake out in a UMP system
TEST=`linux_client_unittest` still passes
R=benchan@chromium.org

Committed: https://code.google.com/p/google-breakpad/source/detail?r=1299

Patch Set 1 #

Patch Set 2 : #

Total comments: 10

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats Patch
M src/client/linux/minidump_writer/linux_core_dumper_unittest.cc View 1 chunk +2 lines, -8 lines 0 comments Download
M src/common/linux/elf_core_dump_unittest.cc View 1 chunk +2 lines, -8 lines 0 comments Download
M src/common/linux/tests/crash_generator.cc View 1 2 4 chunks +35 lines, -6 lines 0 comments Download

Messages

Total messages: 9
vapier
10 years, 7 months ago #1
vapier
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode87 src/common/linux/tests/crash_generator.cc:87: perror("Failed to wait for sync barrier"); i also took ...
10 years, 7 months ago #2
Ben Chan
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode68 src/common/linux/tests/crash_generator.cc:68: int gettid(void) { I guess the void is not ...
10 years, 7 months ago #3
Ben Chan
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode209 src/common/linux/tests/crash_generator.cc:209: sleep(10 * 60); actually I wanted to say that ...
10 years, 7 months ago #4
vapier
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode68 src/common/linux/tests/crash_generator.cc:68: int gettid(void) { in C++ it is not needed, ...
10 years, 7 months ago #5
Ben Chan
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode68 src/common/linux/tests/crash_generator.cc:68: int gettid(void) { On 2014/04/02 18:55:43, vapier wrote: > ...
10 years, 7 months ago #6
vapier1
https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc File src/common/linux/tests/crash_generator.cc (right): https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode68 src/common/linux/tests/crash_generator.cc:68: int gettid(void) { Done. https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode209 src/common/linux/tests/crash_generator.cc:209: sleep(10 * 60); ...
10 years, 7 months ago #7
Ben Chan
On 2014/04/02 20:01:27, vapier1 wrote: > https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc > File src/common/linux/tests/crash_generator.cc (right): > > https://breakpad.appspot.com/1304005/diff/10004/src/common/linux/tests/crash_generator.cc#newcode68 > ...
10 years, 7 months ago #8
vapier
10 years, 7 months ago #9
Message was sent while issue was closed.
Committed patchset #3 manually as r1299 (presubmit successful).
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted