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

Issue 257120043: i#1734 Create Dr. Fuzz: add exception API

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

Description

Commit log for first patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL adds the exception API, along with a general iterator for walking the set of fuzz targets currently live on the call stack. ---------------

Patch Set 1 #

Total comments: 22

Patch Set 2 : PTAL #

Total comments: 38

Patch Set 3 : PTAL #

Total comments: 13

Patch Set 4 : PTAL #

Total comments: 12

Patch Set 5 : PTAL #

Total comments: 31

Patch Set 6 : bruening, PTAL #

Total comments: 10

Patch Set 7 : PTAL #

Total comments: 39

Patch Set 8 : Committed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1186 lines, -140 lines) Patch
M common/utils.h View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M docs/CMakeLists.txt View 1 2 3 4 5 6 7 2 chunks +3 lines, -1 line 0 comments Download
M docs/CMake_doxyfile.cmake View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M docs/Doxyfile.in View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M drfuzz/CMakeLists.txt View 1 2 3 4 5 6 7 1 chunk +4 lines, -0 lines 0 comments Download
M drfuzz/drfuzz.h View 1 2 3 4 5 6 7 5 chunks +306 lines, -10 lines 0 comments Download
M drfuzz/drfuzz.c View 1 2 3 4 5 6 7 19 chunks +499 lines, -50 lines 0 comments Download
A + drfuzz/drfuzz.dox View 1 2 3 4 5 6 7 3 chunks +29 lines, -44 lines 0 comments Download
M drmemory/docs/release.dox View 1 2 3 4 5 6 7 1 chunk +6 lines, -6 lines 0 comments Download
M framework/drmf.dox View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M tests/framework/CMakeLists.txt View 1 2 3 4 5 6 7 3 chunks +27 lines, -7 lines 0 comments Download
A + tests/framework/drfuzz_app_segfault.c View 1 2 3 4 5 6 7 2 chunks +16 lines, -5 lines 0 comments Download
M tests/framework/drfuzz_client_repeat.c View 1 2 3 4 5 6 7 3 chunks +23 lines, -12 lines 0 comments Download
A tests/framework/drfuzz_client_segfault.c View 1 2 3 4 5 6 7 1 chunk +266 lines, -0 lines 0 comments Download
M umbra/umbra.dox View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 31
Byron
8 years, 8 months ago (2015-07-31 01:38:56 UTC) #1
Byron
This code has been tested in the current drfuzz test client. It correctly reports the ...
8 years, 8 months ago (2015-07-31 01:41:12 UTC) #2
zhaoqin
The main thing is I am not sure if the thread_crash callback should be registered ...
8 years, 8 months ago (2015-07-31 20:03:04 UTC) #3
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-04 17:04:40 UTC) #4
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-04 17:08:42 UTC) #5
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-04 17:17:29 UTC) #6
Byron
https://codereview.appspot.com/257120043/diff/1/drfuzz/drfuzz.c File drfuzz/drfuzz.c (right): https://codereview.appspot.com/257120043/diff/1/drfuzz/drfuzz.c#newcode529 drfuzz/drfuzz.c:529: e->crash_id = crash->sig; On 2015/07/31 20:03:03, zhaoqin wrote: > ...
8 years, 8 months ago (2015-08-04 17:18:55 UTC) #7
bruening
https://codereview.appspot.com/257120043/diff/60001/make/git/git_review.sh File make/git/git_review.sh (right): https://codereview.appspot.com/257120043/diff/60001/make/git/git_review.sh#newcode123 make/git/git_review.sh:123: -t "${subject}" -m "${msg}" ${email} HEAD^1) On 2015/08/04 17:18:55, ...
8 years, 8 months ago (2015-08-04 17:48:54 UTC) #8
zhaoqin
one of my concern is the exception callback. https://codereview.appspot.com/257120043/diff/60001/common/utils.h File common/utils.h (right): https://codereview.appspot.com/257120043/diff/60001/common/utils.h#newcode814 common/utils.h:814: * ...
8 years, 8 months ago (2015-08-04 20:14:14 UTC) #9
Byron
This new feature needs a test. Should I add one here or in a later ...
8 years, 8 months ago (2015-08-04 22:50:11 UTC) #10
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-04 22:50:45 UTC) #11
bruening
https://codereview.appspot.com/257120043/diff/60001/common/utils.h File common/utils.h (right): https://codereview.appspot.com/257120043/diff/60001/common/utils.h#newcode814 common/utils.h:814: * CALLBACK LIST On 2015/08/04 22:50:11, Byron wrote: > ...
8 years, 8 months ago (2015-08-05 00:10:02 UTC) #12
zhaoqin
As the API may affect the release, I want to have a more discussion about ...
8 years, 8 months ago (2015-08-05 16:21:49 UTC) #13
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-05 17:49:56 UTC) #14
Byron
https://codereview.appspot.com/257120043/diff/80001/drfuzz/drfuzz.h File drfuzz/drfuzz.h (right): https://codereview.appspot.com/257120043/diff/80001/drfuzz/drfuzz.h#newcode70 drfuzz/drfuzz.h:70: } drfuzz_target_frame_t; On 2015/08/05 16:21:49, zhaoqin wrote: > ok, ...
8 years, 8 months ago (2015-08-05 17:50:05 UTC) #15
zhaoqin
continue discussion on the API. https://codereview.appspot.com/257120043/diff/80001/drfuzz/drfuzz.h File drfuzz/drfuzz.h (right): https://codereview.appspot.com/257120043/diff/80001/drfuzz/drfuzz.h#newcode70 drfuzz/drfuzz.h:70: } drfuzz_target_frame_t; On 2015/08/05 ...
8 years, 8 months ago (2015-08-05 20:29:15 UTC) #16
Byron
https://codereview.appspot.com/257120043/diff/100001/drfuzz/drfuzz.c File drfuzz/drfuzz.c (right): https://codereview.appspot.com/257120043/diff/100001/drfuzz/drfuzz.c#newcode302 drfuzz/drfuzz.c:302: fuzz_pass_context_t *fp = (fuzz_pass_context_t *) drmgr_get_tls_field(dcontext, On 2015/08/05 20:29:15, ...
8 years, 8 months ago (2015-08-07 04:46:35 UTC) #17
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-07 04:47:29 UTC) #18
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-07 21:43:46 UTC) #19
Byron
Uploaded a new version with better handling of callback priorities, and a better unit test ...
8 years, 8 months ago (2015-08-07 21:46:34 UTC) #20
zhaoqin
LGTM with some comment The biggest one is the priority struct and utils.h, but should ...
8 years, 8 months ago (2015-08-10 03:17:56 UTC) #21
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-10 11:49:24 UTC) #22
Byron
bruening's turn to review https://codereview.appspot.com/257120043/diff/140001/common/utils.h File common/utils.h (right): https://codereview.appspot.com/257120043/diff/140001/common/utils.h#newcode962 common/utils.h:962: callback_list_create(heapstat_t type, void *lock); On ...
8 years, 8 months ago (2015-08-10 11:49:45 UTC) #23
Byron
https://codereview.appspot.com/257120043/diff/160001/drfuzz/drfuzz.c File drfuzz/drfuzz.c (right): https://codereview.appspot.com/257120043/diff/160001/drfuzz/drfuzz.c#newcode793 drfuzz/drfuzz.c:793: notify_exception(fuzz_pass_context_t *fp, drfuzz_crash_info_t *info, These callback iterators would benefit ...
8 years, 8 months ago (2015-08-10 11:53:38 UTC) #24
bruening
https://codereview.appspot.com/257120043/diff/160001/framework/public.h File framework/public.h (right): https://codereview.appspot.com/257120043/diff/160001/framework/public.h#newcode109 framework/public.h:109: } callback_priority_t; drfuzz uses drmgr already. Can we use ...
8 years, 8 months ago (2015-08-10 15:45:45 UTC) #25
bruening
https://codereview.appspot.com/257120043/diff/160001/common/utils_shared.c File common/utils_shared.c (right): https://codereview.appspot.com/257120043/diff/160001/common/utils_shared.c#newcode170 common/utils_shared.c:170: * by the named priorities, such that the edges ...
8 years, 8 months ago (2015-08-11 01:46:31 UTC) #26
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: add exception API This CL ...
8 years, 8 months ago (2015-08-12 00:00:50 UTC) #27
Byron
I made some major changes, so I'm not sure if Derek or Qin wants to ...
8 years, 8 months ago (2015-08-12 00:06:09 UTC) #28
bruening
LGTM w/ comments https://codereview.appspot.com/257120043/diff/180001/common/utils.h File common/utils.h (right): https://codereview.appspot.com/257120043/diff/180001/common/utils.h#newcode942 common/utils.h:942: /* note: Guarantees that even if ...
8 years, 8 months ago (2015-08-12 03:59:25 UTC) #29
Byron
Committed as https://github.com/DynamoRIO/drmemory/commit/32827fa8d17e476faa4b11b7d6bafe0ef779a07a Final commit log: --------------- i#1734 Create Dr. Fuzz: add exception API This ...
8 years, 8 months ago (2015-08-12 22:02:44 UTC) #30
Byron
8 years, 8 months ago (2015-08-12 22:04:40 UTC) #31
https://codereview.appspot.com/257120043/diff/180001/common/utils.h
File common/utils.h (right):

https://codereview.appspot.com/257120043/diff/180001/common/utils.h#newcode942
common/utils.h:942: /* note: Guarantees that even if src overflows n, the
allocated buffer will be
On 2015/08/12 03:59:24, bruening wrote:
> s/n/max/

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c
File drfuzz/drfuzz.c (right):

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c#newcode103
drfuzz/drfuzz.c:103: #define MAX_CHAINED_FAULTS 2
On 2015/08/12 03:59:24, bruening wrote:
> Please add comments.  This is the max size of the faults array?  Why does it
say
> "CHAINED"?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c#newcode105
drfuzz/drfuzz.c:105: #define LAST_FAULT(fp) ((fp)->thread_state->faults[1])
On 2015/08/12 03:59:24, bruening wrote:
> This seems to assume a max of 2 -- yet it makes no use of MAX_CHAINED_FAULTS
nor
> does it have a comment saying to update it when the max is updated.

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c#newcode106
drfuzz/drfuzz.c:106: #define SIZEOF_FAULTS (2 * sizeof(drfuzz_fault_t))
On 2015/08/12 03:59:24, bruening wrote:
> What is this hardcoded 2?  Shouldn't this be MAX_CHAINED_FAULTS?
> 
> Comments and maybe better names would help: how about ARRAY in the name or
sthg,
> and how about having similar names for the max and this sizeof?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c#newcode308
drfuzz/drfuzz.c:308: /* crash is indicated either by unhandled fault, or by
terminated fuzz targets */
On 2015/08/12 03:59:24, bruening wrote:
> What you want is DR i#966, right?  Perhaps a xref here.  Also, you want the
app
> exit code to help diagnose a crash: xref i#1260.

Changed to report crash anytime a thread exits with live fuzz targets,
regardless of faults. This assumes an actual crash will abort fuzz targets on
all other threads, so we don't have to make that happen. Could add a separate
test for it.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.c#newcode841
drfuzz/drfuzz.c:841: * critical, and extend the default set to include e.g.
SIGBUS, SIGABRT, etc.
On 2015/08/12 03:59:24, bruening wrote:
> We have to include SIGBUS as on Linux it is a not-insignificant source of
> crashes that fuzzers will hit: if you just de-ref random memory you'll hit it
> enough that you want to include it.  Less likely when fuzzing but still direct
> crashes from the app are SIGILL and STATUS_ILLEGAL_INSTRUCTION (along w/ some
> other rarer exception codes on Windows).

Added SIGBUS for now. Can extend later.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h
File drfuzz/drfuzz.h (right):

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode80
drfuzz/drfuzz.h:80: /**
On 2015/08/12 03:59:24, bruening wrote:
> Check the generated docs: on Windows does doxygen put this on the typedef or
> not?

It works.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode81
drfuzz/drfuzz.h:81: * Provides context information about a critical fault. On
Unix cast to dr_siginfo_t,
On 2015/08/12 03:59:24, bruening wrote:
> # for link

The link is not possible because dr_siginfo_t is defined in the submodule, which
has a separate doxygen tree.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode82
drfuzz/drfuzz.h:82: * or on Windows cast to dr_exception_t. See documentation on
those structs for details.
On 2015/08/12 03:59:24, bruening wrote:
> # for link

Can't link to DR from Dr. Memory.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode91
drfuzz/drfuzz.h:91: * Provides details about a single occurrence of a critical
fault (i.e., a UNIX signal or
On 2015/08/12 03:59:24, bruening wrote:
> What is a "critical fault"?  It says "a UNIX signal or a Windows exception" --
> but many signals are unrelated to any kind of "fault" (e.g., SIGUSR1,
real-time
> signals, and would you call a timer alarm a "fault"?)  This could be described
> more precisely.  In isolation, if I header "critical fault", I would think it
> meant a hardware-generated fault (x86 uses the term "fault" to mean something
> precise: it is a hardware exception whose return point is the start of the
> faulting instruction, as opposed to a trap or abort) that was not caught and
led
> to process termination.  But you don't know whether it will be caught up
front,
> right?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode92
drfuzz/drfuzz.h:92: * or a Windows exception). See comments on
drfuzz_register_fault_event(). In the case of
On 2015/08/12 03:59:24, bruening wrote:
> or or

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode95
drfuzz/drfuzz.h:95: * the app continue to run.
On 2015/08/12 03:59:24, bruening wrote:
> continued

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode97
drfuzz/drfuzz.h:97: typedef struct _drfuzz_fault_t {
On 2015/08/12 03:59:24, bruening wrote:
> These names are very similar: "drfuzz_fault_info_t" and "drfuzz_fault_t". 
It's
> not clear what their relationship is.  Maybe one or both could be renamed --
> drfuzz_fault_arch_info_t and drfuzz_fault_base_info_t?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode97
drfuzz/drfuzz.h:97: typedef struct _drfuzz_fault_t {
On 2015/08/12 03:59:24, bruening wrote:
> These names are very similar: "drfuzz_fault_info_t" and "drfuzz_fault_t". 
It's
> not clear what their relationship is.  Maybe one or both could be renamed --
> drfuzz_fault_arch_info_t and drfuzz_fault_base_info_t?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode99
drfuzz/drfuzz.h:99: * Signal number (Unix) or exception code (Windows).
On 2015/08/12 03:59:24, bruening wrote:
> This duplicates info in drfuzz_fault_info_t?  I'm confused about this struct
vs
> that one.  Please try to clarify in the comments.

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode260
drfuzz/drfuzz.h:260: * fuzz target encounters a critical fault. The \p fault
gives basic information about
On 2015/08/12 03:59:24, bruening wrote:
> So is the idea that drfuzz records info on each fault when it happens and
> doesn't know if the app will catch it, and then at process termination due to
an
> unhandled fault it tells the user about all the faults it saw?  Maybe this
could
> explain it like that.

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode261
drfuzz/drfuzz.h:261: * the kind and location of the fault, and may be retained
by the callee. More detailed
On 2015/08/12 03:59:24, bruening wrote:
> Until when?  Until drfuzz_register_fault_delete_callback() is called?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode288
drfuzz/drfuzz.h:288: * free any custom data attached to the fault's user_data
field.
On 2015/08/12 03:59:24, bruening wrote:
> Doesn't this also tell the user when it is no longer safe to refer to a
> drfuzz_fault_t?

Done.

https://codereview.appspot.com/257120043/diff/180001/drfuzz/drfuzz.h#newcode308
drfuzz/drfuzz.h:308: * time of the fault. If the crash was not caused by this
thread, the state may contain
On 2015/08/12 03:59:24, bruening wrote:
> So you're going to go suspend all the other threads, it sounds like, and
iterate
> over them, calling this for each

I'm assuming that a crash will abort all threads. So each thread will report its
exceptions and/or live fuzz targets at thread exit. If the threads are not
aborted, then as far as drfuzz is concerned, it wasn't a crash.

https://codereview.appspot.com/257120043/diff/180001/tests/framework/drfuzz_a...
File tests/framework/drfuzz_app_segfault.c (right):

https://codereview.appspot.com/257120043/diff/180001/tests/framework/drfuzz_a...
tests/framework/drfuzz_app_segfault.c:45: /* A crash prone function. Segfaults
with index out of range. */
On 2015/08/12 03:59:24, bruening wrote:
> This does not seem overly likely to actually segfault: the index has to be
quite
> large to reach an unreadable page.  Dr. Memory will report non-crashing errors
> for us, though.

The test fuzzes the index arg with value 10000000, which I think will crash in
any scenario for this tiny test app.
Sign in to reply to this message.

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