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

Issue 261980043: i#1734 Create Dr. Fuzz: save/restore shadow memory

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: save/restore shadow memory Integrates the fuzzer with full Dr. Memory by saving and restoring shadow memory during the fuzzing cycle. Adds 2 tests that read an uninitialized array during each fuzz iteration. ---------------

Patch Set 1 #

Total comments: 29

Patch Set 2 : bruening, PTAL #

Total comments: 14

Patch Set 3 : PTAL #

Total comments: 23

Patch Set 4 : Committed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+819 lines, -213 lines) Patch
M drfuzz/drfuzz.h View 1 2 4 chunks +18 lines, -38 lines 0 comments Download
M drfuzz/drfuzz.c View 1 2 12 chunks +25 lines, -19 lines 0 comments Download
M drmemory/docs/release.dox View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M drmemory/drmemory.c View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M drmemory/fuzzer.h View 1 2 3 3 chunks +8 lines, -4 lines 0 comments Download
M drmemory/fuzzer.c View 1 2 3 12 chunks +407 lines, -16 lines 0 comments Download
M drmemory/shadow.h View 1 2 3 2 chunks +16 lines, -0 lines 0 comments Download
M drmemory/shadow.c View 1 2 3 2 chunks +66 lines, -0 lines 0 comments Download
M tests/CMakeLists.txt View 1 2 3 2 chunks +52 lines, -12 lines 0 comments Download
M tests/framework/drfuzz_client_repeat.c View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M tests/framework/drfuzz_client_segfault.c View 1 2 4 chunks +4 lines, -3 lines 0 comments Download
M tests/fuzz_buffer.c View 1 2 chunks +62 lines, -5 lines 0 comments Download
M tests/fuzz_buffer.cpp View 1 2 chunks +79 lines, -7 lines 0 comments Download
M tests/fuzz_buffer.out View 1 chunk +2 lines, -3 lines 0 comments Download
M tests/fuzz_buffer.cpp.out View 1 chunk +2 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.cpp.demangled.out View 1 chunk +2 lines, -3 lines 0 comments Download
D tests/fuzz_buffer.cpp.mangled.out View 1 chunk +0 lines, -38 lines 0 comments Download
A + tests/fuzz_buffer.leak.out View 1 1 chunk +4 lines, -4 lines 0 comments Download
A + tests/fuzz_buffer.leak.cpp.out View 1 1 chunk +4 lines, -4 lines 0 comments Download
M tests/fuzz_buffer.module_name.out View 1 chunk +2 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.overread.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.overread.cpp.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.overwrite.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.overwrite.cpp.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.underread.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.underread.cpp.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.underwrite.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.underwrite.cpp.out View 1 1 chunk +3 lines, -3 lines 0 comments Download
A + tests/fuzz_buffer.uninitialized.out View 1 2 2 chunks +17 lines, -7 lines 0 comments Download
A + tests/fuzz_buffer.uninitialized.cpp.out View 1 2 1 chunk +17 lines, -16 lines 0 comments Download

Messages

Total messages: 16
Byron
8 years, 8 months ago (2015-08-21 15:59:44 UTC) #1
zhaoqin
LGTM with comment. Some nit comment for improvement, but nothing critical, so LGTM. https://codereview.appspot.com/261980043/diff/1/drfuzz/drfuzz.h File ...
8 years, 8 months ago (2015-08-21 19:42:52 UTC) #2
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: save/restore shadow memory Integrates the ...
8 years, 8 months ago (2015-08-23 04:51:11 UTC) #3
Byron
bruening's turn to review. https://codereview.appspot.com/261980043/diff/1/drfuzz/drfuzz.h File drfuzz/drfuzz.h (right): https://codereview.appspot.com/261980043/diff/1/drfuzz/drfuzz.h#newcode258 drfuzz/drfuzz.h:258: * memory must be applied ...
8 years, 8 months ago (2015-08-23 04:51:41 UTC) #4
bruening
On 2015/08/23 04:51:41, Byron wrote: > bruening's turn to review. My first impression is that ...
8 years, 8 months ago (2015-08-23 17:18:26 UTC) #5
Byron
On 2015/08/23 17:18:26, bruening wrote: > On 2015/08/23 04:51:41, Byron wrote: > > bruening's turn ...
8 years, 8 months ago (2015-08-23 20:33:25 UTC) #6
bruening
Let's discuss the shadow code: IMHO the shadow impl-specific details should all be behind the ...
8 years, 8 months ago (2015-08-24 14:12:50 UTC) #7
bruening
On 2015/08/24 14:12:50, bruening wrote: > Let's discuss the shadow code: IMHO the shadow impl-specific ...
8 years, 8 months ago (2015-08-24 15:23:57 UTC) #8
Byron
Commit log for latest patchset: --------------- i#1734 Create Dr. Fuzz: save/restore shadow memory Integrates the ...
8 years, 8 months ago (2015-08-26 21:45:10 UTC) #9
Byron
https://codereview.appspot.com/261980043/diff/20001/drfuzz/drfuzz.c File drfuzz/drfuzz.c (right): https://codereview.appspot.com/261980043/diff/20001/drfuzz/drfuzz.c#newcode487 drfuzz/drfuzz.c:487: { /* XXX i#1734: might prefer to return an ...
8 years, 8 months ago (2015-08-26 21:45:42 UTC) #10
Byron
https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c File drmemory/shadow.c (right): https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode550 drmemory/shadow.c:550: The implementation here doesn't consider the MAP_4B_TO_1B case. It ...
8 years, 8 months ago (2015-08-26 22:10:20 UTC) #11
bruening
> Updates the internal DynamoRIO instance to > version 5.0.16673, and sets the minimum required ...
8 years, 8 months ago (2015-08-27 03:24:51 UTC) #12
Byron
On 2015/08/27 03:24:51, bruening wrote: > > Updates the internal DynamoRIO instance to > > ...
8 years, 8 months ago (2015-08-27 03:46:53 UTC) #13
bruening
LGTM w/ comments https://codereview.appspot.com/261980043/diff/20001/drfuzz/drfuzz.h File drfuzz/drfuzz.h (right): https://codereview.appspot.com/261980043/diff/20001/drfuzz/drfuzz.h#newcode173 drfuzz/drfuzz.h:173: typedef enum _drfuzz_flags_t { Removing this ...
8 years, 8 months ago (2015-08-27 04:36:02 UTC) #14
Byron
Committed as https://github.com/DynamoRIO/drmemory/commit/f23c52a34aacbfb0681db73a9d5034d95f31db6c Final commit log: --------------- i#1734 Create Dr. Fuzz: save/restore shadow memory Integrates ...
8 years, 8 months ago (2015-08-27 17:34:59 UTC) #15
Byron
8 years, 8 months ago (2015-08-27 19:10:15 UTC) #16
https://codereview.appspot.com/261980043/diff/40001/CMakeLists.txt
File CMakeLists.txt (right):

https://codereview.appspot.com/261980043/diff/40001/CMakeLists.txt#newcode729
CMakeLists.txt:729: set(DynamoRIO_VERSION_REQUIRED "5.0.16672")
On 2015/08/27 04:36:02, bruening wrote:
> I think this is already past this -- just be careful when updating/merging
here
> and in the submodule

Yes, there are more commits, but they are not required, per se. This version has
the added calling conventions.

https://codereview.appspot.com/261980043/diff/40001/drmemory/fuzzer.c
File drmemory/fuzzer.c (right):

https://codereview.appspot.com/261980043/diff/40001/drmemory/fuzzer.c#newcode261
drmemory/fuzzer.c:261: #  define ARG_STACK_OFFSET 1 /* retaddr */
On 2015/08/27 04:36:02, bruening wrote:
> It seems like much of this should not be hardcoded in ifdefs and should
instead
> come from the calling convention of the target function.  Think about
> mixed-mode: a 64-bit build (thus X64 is set) will want to target a 32-bit
cdecl
> function.

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/fuzzer.c#newcode323
drmemory/fuzzer.c:323: #if PLATFORM_REGISTER_ARGS
On 2015/08/27 04:36:02, bruening wrote:
> I would suggest removing all these #if's: they make the code harder to read,
and
> we'd prefer to act on the specified calling convention, not hardcode to a
single
> bitwidth.

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/optionsx.h
File drmemory/optionsx.h (right):

https://codereview.appspot.com/261980043/diff/40001/drmemory/optionsx.h#newco...
drmemory/optionsx.h:604: /* XXX i#1734: May want to consider an option to not
reset red zone shadow state.  */
On 2015/08/27 04:36:02, bruening wrote:
> I would think this comment would be in the fuzz file by the code that does the
> reset, not here

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c
File drmemory/shadow.c (right):

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode160
drmemory/shadow.c:160: #define VARSIZE_FIELD(type, name) type
name[VARSIZE_FIELD_PLACEHOLDER_SIZE]
On 2015/08/27 04:36:02, bruening wrote:
> Neither of these are used

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode169
drmemory/shadow.c:169: #define SIZEOF_SAVED_BUFFER_SHADOW(buffer_size) \
On 2015/08/27 04:36:02, bruening wrote:
> Please rename: this is not "buffer_size" but app region size

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode173
drmemory/shadow.c:173: #define SIZEOF_SAVED_BUFFER(buffer_size) \
On 2015/08/27 04:36:02, bruening wrote:
> Ditto

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode524
drmemory/shadow.c:524: bitmapx2_set(saved->shadow, i, shadow_value);
On 2015/08/27 04:36:02, bruening wrote:
> This should check MAP_4B_TO_1B and have ASSERT_NOT_IMPLEMENTED, right?

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.c#newcode550
drmemory/shadow.c:550: 
On 2015/08/27 04:36:02, bruening wrote:
> On 2015/08/26 22:10:20, Byron wrote:
> > The implementation here doesn't consider the MAP_4B_TO_1B case. It works for
> > now--just stores more shadow information than really necessary (per byte
> instead
> > of per dword). But if the MAP_4B_TO_1B implementation changes later, that
> might
> > not be true anymore--and it may not be evident that anything needs to be
done
> > here b/c MAP_4B_TO_1B isn't mentioned here. Should I add an XXX comment or
> > something? I'm not sure if this is really important.
> 
> There should be an ASSERT_NOT_IMPLEMENTED at line 524

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.h
File drmemory/shadow.h (right):

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.h#newcode196
drmemory/shadow.h:196: /* Saves the shadow values for the supplied buffer into a
newly allocated shadow buffer.
On 2015/08/27 04:36:02, bruening wrote:
> Please rename: it is not a "supplied buffer", it is an app address range and
not
> a "buffer" at all.

Done.

https://codereview.appspot.com/261980043/diff/40001/drmemory/shadow.h#newcode200
drmemory/shadow.h:200: shadow_save_buffer(app_pc buffer, size_t buffer_size);
On 2015/08/27 04:36:02, bruening wrote:
> IMHO these names are very confusing: I thought the buffer_size was the size of
> the resulting buffer and was wondering how the user knew it.  Please remove
the
> word "buffer" from both of these param names.  This is *not* the buffer, but
the
> app region start and the app region size.

Done.
Sign in to reply to this message.

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