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

Issue 1168543002: Use report_fatal_error before destroying input object on error. (Closed)

Created:
5 years, 6 months ago by jvoung (off chromium)
Modified:
5 years, 6 months ago
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Use report_fatal_error before destroying input object on error. The input object may be a QueueStreamer, which the compile server will still have a reference to (even though downstream the memory object API and parser API thinks it has a unique_ptr). Terminate the thread quickly on error, instead of free'ing and causing a use-after-free. Also set up a report_fatal_error handler which has access to the server's state. This allows the server to record the error and stop pushing bytes to the QueueStreamer. Otherwise the QueueStreamer can get full without a consumer still active to unblock. Unfortunately the fatal error handler only terminates the current thread, and not all worker threads. NaCl doesn't have support for signals or pthread_kill. E.g., with pthread_kill(std_thread.native_handle(), SIGABRT). So, other worker/emitter threads will have to hang waiting on more input or something. Random clang-format edits from 3.7. BUG= https://code.google.com/p/nativeclient/issues/detail?id=4163 TEST= tbd: I manually ran the translator a dummy text file (invalid bitcode header), and observed that this no longer crashes. Instead the SRPC calls finish and I see: 3> [17812,4147750656:14:23:02.025382] Streaming file at 100000 bps [17812,4147750656:14:23:12.511574] RPC call failed: Rpc application returned an error. [17812,4147750656:14:23:12.511625] StreamChunk failed [17812,4147750656:14:23:12.511655] stream_file: SendDataChunk failed, but returning without failing. Expect call to StreamEnd.4> rpc call initiated StreamEnd::isss [17812,4147750656:14:23:12.511931] RPC call failed: Rpc application returned an error. rpc call complete StreamEnd::isss output 0: i(0) output 1: s("") output 2: s("") output 3: s("Invalid PNaCl bitcode header") [17812,4147750656:14:23:12.512102] Command [rpc] failed. R=kschimpf@google.com, stichnot@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=2f7f2b7e17a1ec338df337c806af657c4ed2cd8e

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -44 lines) Patch
M src/IceBrowserCompileServer.h View 5 chunks +9 lines, -2 lines 0 comments Download
M src/IceBrowserCompileServer.cpp View 5 chunks +40 lines, -5 lines 2 comments Download
M src/IceCfgNode.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M src/IceCompileServer.h View 1 chunk +1 line, -1 line 0 comments Download
M src/IceELFObjectWriter.cpp View 1 chunk +3 lines, -2 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 chunk +3 lines, -3 lines 0 comments Download
M src/IceTargetLoweringX8632.cpp View 2 chunks +14 lines, -13 lines 0 comments Download
M src/PNaClTranslator.cpp View 2 chunks +18 lines, -16 lines 0 comments Download

Messages

Total messages: 6 (1 generated)
jvoung (off chromium)
5 years, 6 months ago (2015-06-02 21:39:59 UTC) #2
Jim Stichnoth
lgtm https://codereview.chromium.org/1168543002/diff/1/src/IceBrowserCompileServer.cpp File src/IceBrowserCompileServer.cpp (right): https://codereview.chromium.org/1168543002/diff/1/src/IceBrowserCompileServer.cpp#newcode157 src/IceBrowserCompileServer.cpp:157: Ctx->getStrError() << Reason; I was wondering about using ...
5 years, 6 months ago (2015-06-03 16:16:01 UTC) #3
Karl
lgtm
5 years, 6 months ago (2015-06-03 16:27:16 UTC) #4
jvoung (off chromium)
https://codereview.chromium.org/1168543002/diff/1/src/IceBrowserCompileServer.cpp File src/IceBrowserCompileServer.cpp (right): https://codereview.chromium.org/1168543002/diff/1/src/IceBrowserCompileServer.cpp#newcode157 src/IceBrowserCompileServer.cpp:157: Ctx->getStrError() << Reason; On 2015/06/03 16:16:01, stichnot wrote: > ...
5 years, 6 months ago (2015-06-04 00:33:16 UTC) #5
jvoung (off chromium)
5 years, 6 months ago (2015-06-04 00:50:27 UTC) #6
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
2f7f2b7e17a1ec338df337c806af657c4ed2cd8e (tree was closed).

Powered by Google App Engine
This is Rietveld 408576698