[PATCH] D66979: [InstrProf] Tighten a check for malformed data records in raw profiles

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 08:56:00 PDT 2019


vsk planned changes to this revision.
vsk added a comment.

Thanks for your feedback. I will address review comments and continue investigating on Tuesday.



================
Comment at: llvm/lib/ProfileData/InstrProfReader.cpp:419
 
-  // Check bounds.
-  if (RawCounts.data() < CountersStart ||
-      RawCounts.data() + RawCounts.size() > NamesStartAsCounter)
+  // Check bounds. Note that the counter pointer embedded in the data record
+  // may itself be corrupt.
----------------
davidxl wrote:
> how does the corruption happen?
Not yet sure, this needs more investigation.

The corruption happens on the WIP lldb code coverage bot [1]. The binary is debugserver. The failure reason is that a CounterPtr field within a InstrProfData record is incorrect. I am not sure how a merge failure could cause this, because the on-line profile merging does not mutate the CounterPtr field. It's possible that debugserver was miscompiled.

My debugging notes:

- Symtab contains _ZN17DNBBreakpointList31FindBreakpointsThatOverlapRange, must be debugserver
- std::__1::allocator<char>::allocator() has the bad counter pointer
- (lldb) p RawCounts.data()
- (const unsigned long long *) $1 = 0x00000001022b14e8
- (lldb) p NumCounters
- (uint32_t) $2 = 1
- (lldb) p NamesStartAsCounter
- (const unsigned long long *) $3 = 0x0000000100e693d0
- TestLldbGdbServer.py times out, then the test harness kills debugserver. Possible cause?

[1] http://lab.llvm.org:8080/green/view/Experimental/job/coverage/20/consoleText


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66979/new/

https://reviews.llvm.org/D66979





More information about the llvm-commits mailing list