Page MenuHomePhabricator

[asan Win64] Fix bug where interception writing address at wrong offset
AbandonedPublic

Authored by wang0109 on Jul 1 2016, 4:01 PM.

Details

Reviewers
rnk
Summary

[asan Win64] Fix bug where interception writing address at wrong offset

jmp [rip - 8] was intended to use the 8 previous bytes as jump address
before begin of current instruction. One subtle detail was missed,
the jump instruction takes 6 bytes, and the offset given should actually
be -6 - 8 = -14, because the "rip" starts at the begin of next instruction.

Due to pointer arithemetic, the difference in bytes between pointers should
use the type of char*. Bug was, an 8 bytes difference between addresses of
type uptr* gives the result of 1.

Diff Detail

Event Timeline

wang0109 updated this revision to Diff 62562.Jul 1 2016, 4:01 PM
wang0109 retitled this revision from to [asan Win64] Fix bug where interception writing address at wrong offset.
wang0109 updated this object.
wang0109 added a reviewer: rnk.
wang0109 added subscribers: etienneb, chrisha.

Thx for the patch.

I'm gonna think how we can validate this.
I believe there is lack of unittests in the interceptor folder.

wang0109 updated this revision to Diff 62603.Jul 1 2016, 10:02 PM
  • update diff: use s32 to ensure it is always 4 bytes

Unittests for this code in on-going.
see unittests

This CL is superceded and merged by:

http://reviews.llvm.org/D22111

wang0109 abandoned this revision.Jul 8 2016, 8:30 AM