Skip to content

Commit d7477f4

Browse files
authored
Grab the bugcheck code as part of crash detection and fix rdrand opcode detection (#115)
1 parent 4824dda commit d7477f4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/wtf/fuzzer_hevd.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ bool Init(const Options_t &Opts, const CpuState_t &) {
9494
// kd> ub fffff805`3b8287c4 l1
9595
// nt!ExGenRandom+0xe0:
9696
// fffff805`3b8287c0 480fc7f2 rdrand rdx
97-
const Gva_t ExGenRandom = Gva_t(g_Dbg.GetSymbol("nt!ExGenRandom") + 0xe4);
98-
if (g_Backend->VirtRead4(ExGenRandom) != 0x480fc7f2) {
97+
const Gva_t ExGenRandom = Gva_t(g_Dbg.GetSymbol("nt!ExGenRandom") + 0xe0 + 4);
98+
if (g_Backend->VirtRead4(ExGenRandom - Gva_t(4)) != 0xf2c70f48) {
9999
fmt::print("It seems that nt!ExGenRandom's code has changed, update the "
100100
"offset!\n");
101101
return false;
@@ -113,13 +113,15 @@ bool Init(const Options_t &Opts, const CpuState_t &) {
113113
//
114114

115115
if (!g_Backend->SetBreakpoint("nt!KeBugCheck2", [](Backend_t *Backend) {
116-
const uint64_t B0 = g_Backend->GetArg(1);
117-
const uint64_t B1 = g_Backend->GetArg(2);
118-
const uint64_t B2 = g_Backend->GetArg(3);
119-
const uint64_t B3 = g_Backend->GetArg(4);
120-
const uint64_t B4 = g_Backend->GetArg(5);
121-
const std::string Filename = fmt::format(
122-
"crash-{:#x}-{:#x}-{:#x}-{:#x}-{:#x}", B0, B1, B2, B3, B4);
116+
const uint64_t BCode = Backend->GetArg(0);
117+
const uint64_t B0 = Backend->GetArg(1);
118+
const uint64_t B1 = Backend->GetArg(2);
119+
const uint64_t B2 = Backend->GetArg(3);
120+
const uint64_t B3 = Backend->GetArg(4);
121+
const uint64_t B4 = Backend->GetArg(5);
122+
const std::string Filename =
123+
fmt::format("crash-{:#x}-{:#x}-{:#x}-{:#x}-{:#x}-{:#x}", BCode, B0,
124+
B1, B2, B3, B4);
123125
DebugPrint("KeBugCheck2: {}\n", Filename);
124126
Backend->Stop(Crash_t(Filename));
125127
})) {

0 commit comments

Comments
 (0)