Bitdefender Hypervisor Memory Introspection
winbugcheck.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #include "winbugcheck.h"
6 #include "alerts.h"
7 #include "decoder.h"
8 #include "guests.h"
9 #include "memcloak.h"
10 #include "winprocesshp.h"
11 
12 static char const *
14  _In_ QWORD Reason
15  )
25 {
27 #define BUGCHECK_NAME(x) case(x): return &(#x[9])
28 
29  switch (Reason)
30  {
47  default:
48  return "Unknown";
49  }
50 
51 #undef BUGCHECK_NAME
52 }
53 
54 static char const *
56  _In_ QWORD Reason
57  )
67 {
68  switch (Reason)
69  {
71  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0xa--irql-not-less-or-equal";
73  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x19--bad-pool-header";
75  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x1a--memory-management";
77  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x1e--kmode-exception-not-handled";
79  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x3b--system-service-exception";
81  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x4e--pfn-list-corrupt";
83  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x50--page-fault-in-nonpaged-area";
85  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x60--process-initialization-failed";
87  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x77--kernel-stack-inpage-error";
89  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7a--kernel-data-inpage-error";
91  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7b--inaccessible-boot-device";
93  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7e--system-thread-exception-not-handled";
95  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x7f--unexpected-kernel-mode-trap";
97  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x8e--kernel-mode-exception-not-handled";
99  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0xef--critical-process-died";
101  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x109---critical-structure-corruption";
102  default:
103  return "https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-code-reference2";
104  }
105 }
106 
107 
108 __forceinline static void
110  _In_ QWORD Reason,
111  _In_ QWORD Param1,
112  _In_ QWORD Param2,
113  _In_ QWORD Param3,
114  _In_ QWORD Param4
115  )
127 {
128  CHAR const *name = IntGetBugCheckName(Reason);
129  CHAR const *link = IntGetBugCheckLink(Reason);
130 
131  NLOG("Bugcheck 0x%llx - %s\n"
132  "Parameter 1: 0x%016llx\n"
133  "Parameter 2: 0x%016llx\n"
134  "Parameter 3: 0x%016llx\n"
135  "Parameter 4: 0x%016llx\n"
136  "See the online documentation at %s for details\n",
137  Reason, name, Param1, Param2, Param3, Param4, link);
138 }
139 
140 
141 static void
143  _In_ QWORD Rip,
144  _In_opt_ CHAR const *Message
145  )
155 {
156  INTSTATUS status;
157  INSTRUX instrux;
158  KERNEL_DRIVER const *pDriver;
159 
161  if (!INT_SUCCESS(status))
162  {
163  ERROR("[ERROR] IntDecDecodeInstruction failed for instruction at 0x%016llx: 0x%08x\n", Rip, status);
164  return;
165  }
166 
167  pDriver = IntDriverFindByAddress(Rip);
168  if (NULL == pDriver)
169  {
170  ERROR("[ERROR] IntDriverFindByAddress failed: 0x%016llx", Rip);
171  return;
172  }
173 
174  if (Message)
175  {
176  NLOG("\n%s:\n", Message);
177  }
178 
179  NLOG("%s+0x%llx\n0x%016llx\n", utf16_for_log(pDriver->Name), Rip - pDriver->BaseVa, Rip);
180 
181  IntDumpInstruction(&instrux, Rip);
182 }
183 
184 
185 static void
187  void
188  )
195 {
196  IG_ARCH_REGS const *pRegs = &gVcpu->Regs;
197  IG_SEG_REGS segs = {0};
198 
199  NLOG("\nGuest registers on the CPU that caused the bugcheck (%d):\n", gVcpu->Index);
200 
201  IntDumpArchRegs(pRegs);
202 
203  LOG("CR0 = 0x%016llx CR2 = 0x%016llx CR3 = 0x%016llx CR4 = 0x%016llx CR8 = 0x%016llx\n",
204  pRegs->Cr0, pRegs->Cr2, pRegs->Cr3, pRegs->Cr4, pRegs->Cr8);
205  LOG("FLG = 0x%016llx DR7 = 0x%016llx\n", pRegs->Flags, pRegs->Dr7);
206 
207  LOG("IDT Base = 0x%016llx Limit = 0x%016llx\n", pRegs->IdtBase, pRegs->IdtLimit);
208  LOG("GDT Base = 0x%016llx Limit = 0x%016llx\n", pRegs->GdtBase, pRegs->GdtLimit);
209 
210  IntGetSegs(gVcpu->Index, &segs);
211  LOG("CS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
212  segs.CsSelector, segs.CsBase, segs.CsLimit, segs.CsAr);
213  LOG("SS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
214  segs.SsSelector, segs.SsBase, segs.SsLimit, segs.SsAr);
215  LOG("DS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
216  segs.DsSelector, segs.DsBase, segs.DsLimit, segs.DsAr);
217  LOG("ES = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
218  segs.EsSelector, segs.EsBase, segs.EsLimit, segs.EsAr);
219  LOG("FS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
220  segs.FsSelector, segs.FsBase, segs.FsLimit, segs.FsAr);
221  LOG("GS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
222  segs.GsSelector, segs.GsBase, segs.GsLimit, segs.GsAr);
223 
224  for (DWORD i = 0; i < gGuest.CpuCount; i++)
225  {
226  VCPU_STATE const *v = &gGuest.VcpuArray[i];
227  IG_ARCH_REGS regs = {0};
228 
229  if (v->Index == gVcpu->Index)
230  {
231  continue;
232  }
233 
234  IntGetGprs(v->Index, &regs);
235  pRegs = &regs;
236 
237  NLOG("\nGuest registers on the CPU %d:\n", v->Index);
238 
239  IntDumpArchRegs(pRegs);
240 
241  LOG("CR0 = 0x%016llx CR2 = 0x%016llx CR3 = 0x%016llx CR4 = 0x%016llx CR8 = 0x%016llx\n",
242  pRegs->Cr0, pRegs->Cr2, pRegs->Cr3, pRegs->Cr4, pRegs->Cr8);
243  LOG("FLG = 0x%016llx DR7 = 0x%016llx\n", pRegs->Flags, pRegs->Dr7);
244 
245  LOG("IDT Base = 0x%016llx Limit = 0x%016llx\n", pRegs->IdtBase, pRegs->IdtLimit);
246  LOG("GDT Base = 0x%016llx Limit = 0x%016llx\n", pRegs->GdtBase, pRegs->GdtLimit);
247 
248  IntGetSegs(v->Index, &segs);
249  LOG("CS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
250  segs.CsSelector, segs.CsBase, segs.CsLimit, segs.CsAr);
251  LOG("SS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
252  segs.SsSelector, segs.SsBase, segs.SsLimit, segs.SsAr);
253  LOG("DS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
254  segs.DsSelector, segs.DsBase, segs.DsLimit, segs.DsAr);
255  LOG("ES = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
256  segs.EsSelector, segs.EsBase, segs.EsLimit, segs.EsAr);
257  LOG("FS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
258  segs.FsSelector, segs.FsBase, segs.FsLimit, segs.FsAr);
259  LOG("GS = 0x%02llx Base = 0x%016llx Limit = 0x%016llx Ar = 0x%08llx\n",
260  segs.GsSelector, segs.GsBase, segs.GsLimit, segs.GsAr);
261  }
262 }
263 
264 
265 static void
267  void
268  )
272 {
273  IG_ARCH_REGS const *regs = &gVcpu->Regs;
274  WIN_PROCESS_OBJECT const *process = IntWinProcFindObjectByCr3(regs->Cr3);
275 
276  if (NULL != process)
277  {
278  NLOG("\nPROCESS INFORMATION\n"
279  "Process name: %s\n"
280  "Process path: %s\n"
281  "Eprocess: 0x%016llx\n"
282  "Parent: 0x%016llx\n"
283  "Real parent: 0x%016llx\n"
284  "Creation time: 0x%016llx\n"
285  "Cr3/User Cr3: 0x%016llx/0x%016llx\n"
286  "Pid: %d\n"
287  "Token: 0x%016llx\n",
288  process->Name,
289  process->Path ? utf16_for_log(process->Path->Path) : "<invalid>",
290  process->EprocessAddress,
291  process->ParentEprocess,
292  process->RealParentEprocess,
293  process->CreationTime,
294  process->Cr3, process->UserCr3,
295  process->Pid,
296  process->OriginalTokenPtr);
297 
298  if (gGuest.Guest64)
299  {
300  NLOG("PEB32 address: 0x%016llx\nPEB64 address: 0x%016llx\n", process->Peb32Address, process->Peb64Address);
301  }
302  else
303  {
304  NLOG("PEB32 address: 0x%016llx\n", process->Peb32Address);
305  }
306 
307  NLOG("Flags: 0x%08x Exit Status: 0x%08x\n", process->Flags, process->ExitStatus);
308  }
309 }
310 
311 
312 static void
314  _In_ QWORD Va
315  )
321 {
322  INTSTATUS status;
323  VA_TRANSLATION vaTrans = {0};
324  IG_ARCH_REGS const *registers = &gVcpu->Regs;
325 
326  status = IntTranslateVirtualAddressEx(Va, registers->Cr3, TRFLG_NONE, &vaTrans);
327  if (!INT_SUCCESS(status))
328  {
329  return;
330  }
331 
332  NLOG("\nVA TRANSLATION\n");
333  NLOG("Virtual Address: 0x%016llx\nPhysical Address: 0x%016llx\nEntries mappings:\n",
334  vaTrans.VirtualAddress, vaTrans.PhysicalAddress);
335 
336  for (DWORD index = 0; index < vaTrans.MappingsCount; index++)
337  {
338  NLOG(" EntryMapping[%d]: 0x%016llx\n", index, vaTrans.MappingsEntries[index]);
339  }
340 }
341 
342 
343 static void
345  _In_ DWORD Eflags
346  )
352 {
353  EFLAGS efl;
354 
355  efl.Raw = Eflags;
356  NLOG("%s %s %s %s %s %s %s %s %s\n",
357  (efl.IOPL ? "iopl=1 " : "iopl=0 "),
358  (efl.OF ? "ov" : "nv"),
359  (efl.DF ? "dn" : "up"),
360  (efl.IF ? "ei" : "di"),
361  (efl.SF ? "ng" : "pl"),
362  (efl.ZF ? "zr" : "nr"),
363  (efl.AF ? "ac" : "na"),
364  (efl.PF ? "pe" : "po"),
365  (efl.CF ? "cy" : "nc"));
366 }
367 
368 
369 static void
371  _In_ QWORD Address,
372  _In_opt_ CHAR const *Message
373  )
381 {
382 #define MODULE_NAMES_TO_PRINT 64
383 #define TRACE_LIMIT_X64 0x2000
384 #define TRACE_LIMIT_X86 0x2000
385  INTSTATUS status;
386  PIG_ARCH_REGS pRegs;
387  QWORD rsp;
388  QWORD rspValue = 0;
389  QWORD limit;
390  QWORD writtenModules = 0;
391 
392  if (Message)
393  {
394  NLOG("\n%s\n", Message);
395  }
396 
397  pRegs = &gVcpu->Regs;
398 
399  if (Address)
400  {
401  rsp = Address;
402  }
403  else
404  {
405  rsp = pRegs->Rsp;
406  }
407 
409 
410  for (size_t i = 1; i < limit; i++)
411  {
412  if (gGuest.Guest64)
413  {
414  status = IntKernVirtMemFetchQword(rsp + 8 * i, &rspValue);
415  }
416  else
417  {
418  status = IntKernVirtMemFetchDword(rsp + 4 * i, (DWORD *)&rspValue);
419  }
420 
421  if (!INT_SUCCESS(status))
422  {
423  break;
424  }
425 
426  KERNEL_DRIVER *pDriver = IntDriverFindByAddress(rspValue);
427  if (pDriver)
428  {
429  if (gGuest.Guest64)
430  {
431  NLOG("0x%016llx %s+0x%llx\n", rsp + 8ull * i, utf16_for_log(pDriver->Name), rspValue - pDriver->BaseVa);
432  }
433  else
434  {
435  NLOG("%08llx %s+0x%llx\n", rsp + 4ull * i, utf16_for_log(pDriver->Name), rspValue - pDriver->BaseVa);
436  }
437 
438  writtenModules++;
439  }
440 
441  if (writtenModules > MODULE_NAMES_TO_PRINT)
442  {
443  break;
444  }
445  }
446 #undef MODULE_NAMES_TO_PRINT
447 #undef TRACE_LIMIT_X64
448 #undef TRACE_LIMIT_X86
449 }
450 
451 
452 static void
454  _In_ QWORD TrapFrame
455  )
461 {
462  if (gGuest.Guest64)
463  {
464  INTSTATUS status;
465  KTRAP_FRAME64 trapStructure = {0};
466 
467  NLOG("\nTrap Frame at 0x%016llx:\n", TrapFrame);
468  status = IntKernVirtMemRead(TrapFrame, sizeof(trapStructure), &trapStructure, NULL);
469  if (!INT_SUCCESS(status))
470  {
471  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", TrapFrame, status);
472  return;
473  }
474 
475  NLOG("rax = %016llx rbx = %016llx rcx = %016llx\n"
476  "rdx = %016llx rsi = %016llx rdi = %016llx\n"
477  "rip = %016llx rsp = %016llx rbp = %016llx\n"
478  " r8 = %016llx r9 = %016llx r10 = %016llx\n"
479  "r11 = %016llx r12 = %016llx r13 = %016llx\n"
480  "r14 = %016llx r15 = %016llx\n"
481  "eflags = %08x\n",
482  trapStructure.Rax, trapStructure.Rbx, trapStructure.Rcx,
483  trapStructure.Rdx, trapStructure.Rsi, trapStructure.Rdi,
484  trapStructure.Rip, trapStructure.Rsp, trapStructure.Rbp,
485  trapStructure.R8, trapStructure.R9, trapStructure.R10,
486  trapStructure.R11, 0ull, 0ull, 0ull, 0ull,
487  trapStructure.EFlags);
488 
489  IntWinDumpEflags(trapStructure.EFlags);
490  IntLogCurrentIP(trapStructure.Rip, NULL);
491  IntLogStackTrace(trapStructure.Rsp, "Stack trace:");
492  IntLogStackTrace(0, NULL);
493  }
494  else
495  {
496  INTSTATUS status;
497  KTSS ktssStructure = {0};
498 
499  NLOG("\nKTSS at %08llx:\n", TrapFrame);
500 
501  status = IntKernVirtMemRead(TrapFrame, sizeof(ktssStructure), &ktssStructure, NULL);
502  if (!INT_SUCCESS(status))
503  {
504  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", TrapFrame, status);
505  return;
506  }
507 
508  NLOG("eax = 0x%08x ebx = 0x%08x ecx = 0x%08x\n"
509  "edx = 0x%08x esi = 0x%08x edi = 0x%08x\n"
510  "eip = 0x%08x esp = 0x%08x ebp = 0x%08x\n"
511  "cs = %04x ss = %04x ds = %04x es = %04x fs = %04x gs = %04x efl=0x%08x\n",
512  ktssStructure.Eax, ktssStructure.Ebx, ktssStructure.Ecx, ktssStructure.Edx, ktssStructure.Esi,
513  ktssStructure.Edi, ktssStructure.Eip, ktssStructure.Esp, ktssStructure.Ebp, ktssStructure.Cs,
514  ktssStructure.Ss, ktssStructure.Ds, ktssStructure.Es, ktssStructure.Fs, ktssStructure.Gs,
515  ktssStructure.EFlags);
516 
517  IntWinDumpEflags(ktssStructure.EFlags);
518  IntLogCurrentIP(ktssStructure.Eip, NULL);
519  IntLogStackTrace(ktssStructure.Esp, "Stack trace:");
520  IntLogStackTrace(0, NULL);
521  }
522 }
523 
524 
525 static void
527  _In_ QWORD ContextRecord
528  )
534 {
535  if (gGuest.Guest64)
536  {
537  INTSTATUS status;
538  CONTEXT64 contextStructure = {0};
539 
540  NLOG("\nContext Record at 0x%016llx:\n", ContextRecord);
541 
542  status = IntKernVirtMemRead(ContextRecord, sizeof(contextStructure), &contextStructure, NULL);
543  if (!INT_SUCCESS(status))
544  {
545  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", ContextRecord, status);
546  return;
547  }
548 
549  NLOG("rax = 0x%016llx rbx = 0x%016llx rcx = 0x%016llx\n"
550  "rdx = 0x%016llx rsi = 0x%016llx rdi = 0x%016llx\n"
551  "rip = 0x%016llx rsp = 0x%016llx rbp = 0x%016llx\n"
552  " r8 = 0x%016llx r9 = 0x%016llx r10 = 0x%016llx\n"
553  "r11 = 0x%016llx r12 = 0x%016llx r13 = 0x%016llx\n"
554  "r14 = 0x%016llx r15 = 0x%016llx\n"
555  "cs = 0x%04x ss = 0x%04x ds = 0x%04x es = 0x%04x fs = 0x%04x gs = 0x%04x efl = 0x%08x\n",
556  contextStructure.Rax, contextStructure.Rbx, contextStructure.Rcx,
557  contextStructure.Rdx, contextStructure.Rsi, contextStructure.Rdi,
558  contextStructure.Rip, contextStructure.Rsp, contextStructure.Rbp,
559  contextStructure.R8, contextStructure.R9, contextStructure.R10,
560  contextStructure.R11, contextStructure.R12, contextStructure.R13,
561  contextStructure.R14, contextStructure.R15, contextStructure.SegCs,
562  contextStructure.SegSs, contextStructure.SegDs, contextStructure.SegEs,
563  contextStructure.SegFs, contextStructure.SegGs, contextStructure.EFlags);
564 
565  IntWinDumpEflags(contextStructure.EFlags);
566  IntLogCurrentIP(contextStructure.Rip, NULL);
567  }
568  else
569  {
570  INTSTATUS status;
571  CONTEXT32 contextStructure = {0};
572 
573  NLOG("\nContext Record at %08llx:\n", ContextRecord);
574 
575  status = IntKernVirtMemRead(ContextRecord, sizeof(contextStructure), &contextStructure, NULL);
576  if (!INT_SUCCESS(status))
577  {
578  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", ContextRecord, status);
579  return;
580  }
581 
582  NLOG("eax = 0x%08x ebx = 0x%08x ecx = 0x%08x edx = 0x%08x esi = 0x%08x edi = 0x%08x\n"
583  "eip = 0x%08x esp = 0x%08x ebp = 0x%08x\n"
584  "cs = 0x%04x ss = 0x%04x ds = 0x%04x es = 0x%04x fs = 0x%04x gs = 0x%04x efl = %08x\n",
585  contextStructure.Eax, contextStructure.Ebx, contextStructure.Ecx,
586  contextStructure.Edx, contextStructure.Esi, contextStructure.Edi,
587  contextStructure.Eip, contextStructure.Esp, contextStructure.Ebp,
588  contextStructure.SegCs, contextStructure.SegSs, contextStructure.SegDs,
589  contextStructure.SegEs, contextStructure.SegFs,
590  contextStructure.SegGs, contextStructure.EFlags);
591 
592  IntWinDumpEflags(contextStructure.EFlags);
593  IntLogCurrentIP(contextStructure.Eip, NULL);
594  }
595 }
596 
597 
598 static void
600  _In_ QWORD ExceptionRecord
601  )
607 {
608  if (gGuest.Guest64)
609  {
610  INTSTATUS status;
611  EXCEPTION_RECORD64 excpStructure = {0};
612 
613  NLOG("\nException Record at 0x%016llx:\n", ExceptionRecord);
614 
615  status = IntKernVirtMemRead(ExceptionRecord, sizeof(excpStructure), &excpStructure, NULL);
616  if (!INT_SUCCESS(status))
617  {
618  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", ExceptionRecord, status);
619  return;
620  }
621 
622  NLOG("Exception address: 0x%016llx\n"
623  "Exception Code: 0x%08x\n"
624  "ExceptionFlags: 0x%08x\n"
625  "NumberParameters: 0x%x\n",
626  excpStructure.ExceptionAddress, excpStructure.ExceptionCode,
627  excpStructure.ExceptionFlags, excpStructure.NumberParameters);
628 
629  excpStructure.NumberParameters = MIN(excpStructure.NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS);
630 
631  for (DWORD excpParam = 0; excpParam < excpStructure.NumberParameters; excpParam++)
632  {
633  NLOG(" Parameter[%d]: 0x%016llx\n", excpParam, excpStructure.ExceptionInformation[excpParam]);
634  }
635  }
636  else
637  {
638  INTSTATUS status;
639  EXCEPTION_RECORD32 excpStructure = {0};
640 
641  NLOG("\nException Record at %08llx:\n", ExceptionRecord);
642 
643  status = IntKernVirtMemRead(ExceptionRecord, sizeof(excpStructure), &excpStructure, NULL);
644  if (!INT_SUCCESS(status))
645  {
646  ERROR("[ERROR] IntKernVirtMemRead failed at 0x%016llx: 0x%08x\n", ExceptionRecord, status);
647  return;
648  }
649 
650  NLOG("Exception address: %08x\n"
651  "Exception Code: 0x%08x\n"
652  "ExceptionFlags: 0x%08x\n"
653  "NumberParameters: 0x%x\n",
654  excpStructure.ExceptionAddress, excpStructure.ExceptionCode,
655  excpStructure.ExceptionFlags, excpStructure.NumberParameters);
656 
657  excpStructure.NumberParameters = MIN(excpStructure.NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS);
658 
659  for (DWORD excpParam = 0; excpParam < excpStructure.NumberParameters; excpParam++)
660  {
661  NLOG(" Parameter[%d]: 0x%08x\n", excpParam, excpStructure.ExceptionInformation[excpParam]);
662  }
663  }
664 }
665 
666 
667 static void
669  _In_ QWORD Param1,
670  _In_ QWORD Param2
671  )
678 {
680  const CHAR *objectType = "<unknown>";
681 
682  if (Param2 == 0)
683  {
684  objectType = "process";
685  }
686  else if (Param2 == 1)
687  {
688  objectType = "thread";
689  }
690 
691  LOG("A %s object has died!\n", objectType);
692  if (proc != NULL)
693  {
694  NLOG("\tProcess name: \"%s\" PID: %u Eprocess: 0x%016llx Cr3: 0x%016llx User Cr3: 0x%016llx Protected: %u\n",
695  proc->Name, proc->Pid, proc->EprocessAddress, proc->Cr3, proc->UserCr3, proc->Protected);
696  }
697  else
698  {
699  NLOG("\tNo process found for Eprocess 0x%016llx\n", Param1);
700  }
701 }
702 
703 
704 static void
706  _In_ QWORD Param3,
707  _In_ QWORD Param4
708  )
719 {
720  QWORD regionType = Param4;
721  const PCHAR regions[] =
722  {
723  /* 0 */ "A generic data region",
724  /* 1 */ "Modification of a function or .pdata",
725  /* 2 */ "A processor IDT",
726  /* 3 */ "A processor GDT",
727  /* 4 */ "Type 1 process list corruption",
728  /* 5 */ "Type 2 process list corruption",
729  /* 6 */ "Debug routine modification",
730  /* 7 */ "Critical MSR modification",
731  /* 8 */ "Object type",
732  /* 9 */ "A processor IVT",
733  /* a */ "Modification of a system service function",
734  /* b */ "A generic session data region",
735  /* c */ "Modification of a session function or .pdata",
736  /* d */ "Modification of an import table",
737  /* e */ "Modification of a session import table",
738  /* f */ "Ps Win32 callout modification",
739  /* 10 */ "Debug switch routine modification",
740  /* 11 */ "IRP allocator modification",
741  /* 12 */ "Driver call dispatcher modification",
742  /* 13 */ "IRP completion dispatcher modification",
743  /* 14 */ "IRP deallocator modification",
744  /* 15 */ "A processor control register",
745  /* 16 */ "Critical floating point control register modification",
746  /* 17 */ "Local APIC modification",
747  /* 18 */ "Kernel notification callout modification",
748  /* 19 */ "Loaded module list modification",
749  /* 1a */ "Type 3 process list corruption",
750  /* 1b */ "Type 4 process list corruption",
751  /* 1c */ "Driver object corruption",
752  /* 1d */ "Executive callback object modification",
753  /* 1e */ "Modification of module padding",
754  /* 1f */ "Modification of a protected process",
755  /* 20 */ "A generic data region",
756  /* 21 */ "A page hash mismatch",
757  /* 22 */ "A session page hash mismatch",
758  /* 23 */ "Load config directory modification",
759  /* 24 */ "Inverted function table modification",
760  /* 25 */ "Session configuration modification",
761  /* 26 */ "An extended processor control register",
762  /* 27 */ "Type 1 pool corruption",
763  /* 28 */ "Type 2 pool corruption",
764  /* 29 */ "Type 3 pool corruption",
765  /* 2a */ "Type 4 pool corruption",
766  /* 2b */ "Modification of a function or .pdata",
767  /* 2c */ "Image integrity corruption",
768  /* 2d */ "Processor misconfiguration",
769  /* 2e */ "Type 5 process list corruption",
770  /* 2f */ "Process shadow corruption",
771  };
772 
773  if (regionType < ARRAYSIZE(regions))
774  {
775  LOG("0x%04llx - %s\n", regionType, regions[regionType]);
776  }
777  else if (0x101 == regionType)
778  {
779  LOG("0x%04llx - %s\n", regionType, "General pool corruption");
780  }
781  else if (0x102 == regionType)
782  {
783  LOG("0x%04llx - %s\n", regionType, "Modification of win32k.sys");
784  }
785  else
786  {
787  LOG("0x%04llx - %s\n", regionType, "Undocumented");
788  }
789 
790  LOG("Dumping cloak regions\n");
791  IntMemClkDump();
792 
793  if (0x2b == regionType && IS_KERNEL_POINTER_WIN(gGuest.Guest64, Param3))
794  {
796  }
797 }
798 
799 
800 static void
802  _In_ QWORD Reason,
803  _In_ QWORD Param1,
804  _In_ QWORD Param2,
805  _In_ QWORD Param3,
806  _In_ QWORD Param4
807  )
820 {
821  KERNEL_DRIVER const *pKernel = gGuest.KernelDriver;
822 
823  NLOG("\n**********************************************************************\n"
824  "* *\n"
825  "* Bugcheck Analysis *\n"
826  "* *\n"
827  "**********************************************************************\n\n");
828 
829  IntLogBSODParams(Reason, Param1, Param2, Param3, Param4);
830 
831  switch (Reason)
832  {
834  IntLogCurrentIP(Param4, "Faulting IP");
835  IntWinLogVAInfo(Param1);
836  break;
837 
839  IntLogCurrentIP(Param2, "Faulting IP");
840  IntLogContextRecord(Param3);
841  break;
842 
844  IntLogExceptionRecord(Param3);
845  IntLogContextRecord(Param4);
846  break;
847 
850  IntLogTrapFrame(Param2);
851  break;
852 
854  IntLogCriticalProcessHasDied(Param1, Param2);
855  break;
856 
858  IntLogCriticalStructureCoruption(Param3, Param4);
859  break;
860 
861  default: // More can be added if it is needed
862  NLOG("Bug Check reason not known!\n");
863  break;
864  }
865 
866  if (NULL != pKernel)
867  {
868  LOG("Kernel loaded at 0x%016llx Version info: 0x%08x:0x%08llx\n",
869  pKernel->BaseVa, pKernel->Win.TimeDateStamp, pKernel->Size);
870  }
871 
873 
875 
876  IntLogStackTrace(0, "Stack Trace:");
877 }
878 
879 
880 static INTSTATUS
882  _In_ QWORD Reason,
883  _In_ QWORD Param1,
884  _In_ QWORD Param2,
885  _In_ QWORD Param3,
886  _In_ QWORD Param4
887  )
901 {
902  INTSTATUS status;
903  EVENT_CRASH_EVENT *pCrashEvent;
904 
906  {
908  }
909 
910  pCrashEvent = &gAlert.Crash;
911  memzero(pCrashEvent, sizeof(*pCrashEvent));
912 
913  pCrashEvent->Reason = Reason;
914  pCrashEvent->Param1 = Param1;
915  pCrashEvent->Param2 = Param2;
916  pCrashEvent->Param3 = Param3;
917  pCrashEvent->Param4 = Param4;
918 
920 
921  status = IntNotifyIntroEvent(introEventCrashEvent, pCrashEvent, sizeof(*pCrashEvent));
922  if (!INT_SUCCESS(status))
923  {
924  WARNING("[WARNING] IntNotifyIntroEvent failed: 0x%08x\n", status);
925  }
926 
927  return INT_STATUS_SUCCESS;
928 }
929 
930 
931 INTSTATUS
933  _In_ void const *Detour
934  )
948 
949 {
950  INTSTATUS status;
951  PIG_ARCH_REGS pRegs;
952  QWORD code, param1, param2, param3, param4;
953 
954  if (NULL == Detour)
955  {
957  }
958 
959  pRegs = &gVcpu->Regs;
960 
961  if (gGuest.Guest64)
962  {
963  code = pRegs->Rcx;
964  param1 = pRegs->Rdx;
965  param2 = pRegs->R8;
966  param3 = pRegs->R9;
967 
968  IntKernVirtMemFetchQword(pRegs->Rsp + 8 * 5, &param4);
969  }
970  else
971  {
972  // We have RET, Arg1, ... on the stack.
973  IntKernVirtMemFetchDword(pRegs->Rsp + 4 * 1, (DWORD *)&code);
974  IntKernVirtMemFetchDword(pRegs->Rsp + 4 * 2, (DWORD *)&param1);
975  IntKernVirtMemFetchDword(pRegs->Rsp + 4 * 3, (DWORD *)&param2);
976  IntKernVirtMemFetchDword(pRegs->Rsp + 4 * 4, (DWORD *)&param3);
977  IntKernVirtMemFetchDword(pRegs->Rsp + 4 * 5, (DWORD *)&param4);
978  }
979 
980  LOG("[INFO] The guest has generated a bugcheck on CPU %d: 0x%08x 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
981  gVcpu->Index, (DWORD)code, param1, param2, param3, param4);
982 
983  // Set the beta alerts, so we don't block the writes that will follow
985 
986  IntWinBcLogBsodEvent(code, param1, param2, param3, param4);
987 
988  status = IntWinBcSendBsodEvent(code, param1, param2, param3, param4);
989  if (!INT_SUCCESS(status))
990  {
991  ERROR("[ERROR] IntWinBcSendBsodEvent failed: 0x%08x\n", status);
992  }
993 
994  return INT_STATUS_SUCCESS;
995 }
DWORD NumberParameters
Definition: wddefs.h:1214
QWORD R9
Definition: wddefs.h:1626
QWORD Rcx
Definition: wddefs.h:1618
TIMER_FRIENDLY void IntDumpArchRegs(IG_ARCH_REGS const *Registers)
This function dumps the register values in a user friendly format.
Definition: dumper.c:20
#define _In_opt_
Definition: intro_sal.h:16
QWORD PhysicalAddress
The physical address to which VirtualAddress translates to.
Definition: introcore.h:107
DWORD Flags
Windows process flags (possible values for this bitmask are described below).
Definition: winprocess.h:121
#define BUGCHECK_KMODE_EXCEPTION_NOT_HANDLED
Definition: winbugcheck.h:25
#define TRACE_LIMIT_X86
QWORD Rdx
Definition: wddefs.h:1619
QWORD R12
Definition: wddefs.h:1629
static void IntLogTrapFrame(QWORD TrapFrame)
Logs information about a trap frame.
Definition: winbugcheck.c:453
QWORD CsBase
Definition: glueiface.h:66
DWORD Eax
Definition: wddefs.h:1698
QWORD DsBase
Definition: glueiface.h:74
DWORD EFlags
Definition: wddefs.h:905
IG_ARCH_REGS Regs
The current state of the guest registers.
Definition: guests.h:95
QWORD EsSelector
Definition: glueiface.h:80
DWORD Index
The VCPU number.
Definition: guests.h:172
#define _In_
Definition: intro_sal.h:21
static void IntLogCurrentIP(QWORD Rip, CHAR const *Message)
Logs information about the RIP at which the crash was triggered.
Definition: winbugcheck.c:142
DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: wddefs.h:1215
QWORD RealParentEprocess
The active EPROCESS at the moment of creation.
Definition: winprocess.h:92
QWORD SystemCr3
The Cr3 used to map the kernel.
Definition: guests.h:211
#define INT_STATUS_SUCCESS
Definition: introstatus.h:54
WORD Ss
Definition: wddefs.h:918
WIN_KERNEL_DRIVER Win
Valid only for Windows guests.
Definition: drivers.h:70
QWORD ExceptionAddress
The address at which the exception was generated.
Definition: wddefs.h:1195
DWORD ExceptionCode
The code generated by hardware, or the one used with RaiseException(), or DBG_CONTROL_C.
Definition: wddefs.h:1191
DWORD SF
Definition: winbugcheck.h:54
INTSTATUS IntGetGprs(DWORD CpuNumber, PIG_ARCH_REGS Regs)
Get the current guest GPR state.
Definition: introcpu.c:827
QWORD DsSelector
Definition: glueiface.h:76
#define BUGCHECK_KERNEL_MODE_EXCEPTION_NOT_HANDLED
Definition: winbugcheck.h:35
static char const * IntGetBugCheckLink(QWORD Reason)
Returns the bug check documentation page link for a bug check reason.
Definition: winbugcheck.c:55
static void IntLogStackTrace(QWORD Address, CHAR const *Message)
Attempts to log a guest stack trace.
Definition: winbugcheck.c:370
DWORD SegFs
Definition: wddefs.h:1689
QWORD BaseVa
The guest virtual address of the kernel module that owns this driver object.
Definition: drivers.h:41
QWORD Param3
Third parameter.
Definition: intro_types.h:1972
#define INT_SUCCESS(Status)
Definition: introstatus.h:42
DWORD Raw
Raw register value.
Definition: winbugcheck.h:44
Informational event sent when the guest crashes. See EVENT_CRASH_EVENT.
Definition: intro_types.h:109
#define ARRAYSIZE(A)
Definition: introdefs.h:101
BOOLEAN KernelBetaDetections
True if the kernel protection is in beta (log-only) mode.
Definition: guests.h:303
Holds segment register state.
Definition: glueiface.h:64
QWORD GsAr
Definition: glueiface.h:89
#define INT_STATUS_NOT_NEEDED_HINT
Definition: introstatus.h:317
QWORD Rdi
Definition: wddefs.h:1624
#define ERROR(fmt,...)
Definition: glue.h:62
#define BUGCHECK_MEMORY_MANAGEMENT
Definition: winbugcheck.h:24
WORD SegGs
Definition: wddefs.h:1606
WORD Ds
Definition: wddefs.h:920
int INTSTATUS
The status data type.
Definition: introstatus.h:24
QWORD Size
The size of the kernel module that owns this driver object.
Definition: drivers.h:43
#define BUGCHECK_SYSTEM_THREAD_EXCEPTION_NOT_HANDLED
Definition: winbugcheck.h:33
DWORD Ecx
Definition: wddefs.h:1697
QWORD Peb64Address
PEB 64 address (on x86 OSes, this will be 0).
Definition: winprocess.h:103
#define TRFLG_NONE
No special options.
Definition: introcore.h:82
QWORD SsBase
Definition: glueiface.h:70
QWORD Param1
First parameter.
Definition: intro_types.h:1970
QWORD GsSelector
Definition: glueiface.h:88
QWORD Flags
Definition: glueiface.h:49
PVCPU_STATE VcpuArray
Array of the VCPUs assigned to this guest. The index in this array matches the VCPU number...
Definition: guests.h:372
DWORD DF
Definition: winbugcheck.h:57
QWORD SsAr
Definition: glueiface.h:73
QWORD CsAr
Definition: glueiface.h:69
DWORD IF
Definition: winbugcheck.h:56
DWORD Esi
Definition: wddefs.h:912
DWORD OF
Definition: winbugcheck.h:58
QWORD FsLimit
Definition: glueiface.h:83
DWORD Ebx
Definition: wddefs.h:1695
EVENT_CRASH_EVENT Crash
Definition: alerts.h:27
#define MIN(a, b)
Definition: introdefs.h:146
#define BUGCHECK_PFN_LIST_CORRUPT
Definition: winbugcheck.h:27
Event structure for guest OS crashes.
Definition: intro_types.h:1967
QWORD ParentEprocess
The EPROCESS of the parent process.
Definition: winprocess.h:91
static char const * IntGetBugCheckName(QWORD Reason)
Returns a name for a bug check code.
Definition: winbugcheck.c:13
DWORD Protected
TRUE if this is a protected process. If this is FALSE, most of the above fields aren&#39;t used at all...
Definition: winprocess.h:130
DWORD EFlags
Definition: wddefs.h:1703
DWORD TimeDateStamp
The driver`s internal timestamp (from the _IMAGE_FILE_HEADER).
Definition: windriver.h:23
WORD SegFs
Definition: wddefs.h:1605
#define LOG(fmt,...)
Definition: glue.h:61
32-bit selector.
Definition: glueiface.h:187
#define BUGCHECK_SYSTEM_SERVICE_EXCEPTION
Definition: winbugcheck.h:26
Describes a kernel driver.
Definition: drivers.h:30
QWORD SsSelector
Definition: glueiface.h:72
DWORD IOPL
Definition: winbugcheck.h:59
static void IntWinDumpEflags(DWORD Eflags)
Logs the EFLAGS contents.
Definition: winbugcheck.c:344
WORD Es
Definition: wddefs.h:914
QWORD Rax
Definition: wddefs.h:1617
DWORD Ecx
Definition: wddefs.h:907
DWORD CF
Definition: winbugcheck.h:47
Context Frame for 32-bit guests.
Definition: wddefs.h:1675
QWORD Rbp
Definition: wddefs.h:1622
QWORD Cr3
Process PDBR. Includes PCID.
Definition: winprocess.h:98
DWORD MappingsCount
The number of entries inside the MappingsTrace and MappingsEntries arrays.
Definition: introcore.h:123
QWORD Rip
Definition: wddefs.h:1634
GENERIC_ALERT gAlert
Global alert buffer.
Definition: alerts.c:27
QWORD R11
Definition: wddefs.h:1628
static void IntWinBcLogBsodEvent(QWORD Reason, QWORD Param1, QWORD Param2, QWORD Param3, QWORD Param4)
Logs a bug check event and related information about the crash and the kernel.
Definition: winbugcheck.c:801
QWORD CreationTime
The creation time of the process, as stored inside the EPROCESS.
Definition: winprocess.h:95
QWORD DsAr
Definition: glueiface.h:77
TIMER_FRIENDLY void IntDumpInstruction(INSTRUX *Instruction, QWORD Rip)
This function dumps a given instruction (textual disassembly).
Definition: dumper.c:583
WINUM_PATH * Path
Will point inside the loaded modules list to the full process path.
Definition: winprocess.h:111
INTSTATUS IntKernVirtMemFetchDword(QWORD GuestVirtualAddress, DWORD *Data)
Reads 4 bytes from the guest kernel memory.
Definition: introcore.c:829
DWORD NumberParameters
The number of valid entries inside the ExceptionInformation array.
Definition: wddefs.h:1196
#define BUGCHECK_PROCESS_INITIALIZATION_FAILED
Definition: winbugcheck.h:29
static void IntLogBSODParams(QWORD Reason, QWORD Param1, QWORD Param2, QWORD Param3, QWORD Param4)
Logs the bug check parameters.
Definition: winbugcheck.c:109
INTSTATUS IntKernVirtMemFetchQword(QWORD GuestVirtualAddress, QWORD *Data)
Reads 8 bytes from the guest kernel memory.
Definition: introcore.c:811
static INTSTATUS IntWinBcSendBsodEvent(QWORD Reason, QWORD Param1, QWORD Param2, QWORD Param3, QWORD Param4)
Sends a introEventCrashEvent event.
Definition: winbugcheck.c:881
QWORD MappingsEntries[MAX_TRANSLATION_DEPTH]
Contains the entry in which paging table.
Definition: introcore.h:115
INTSTATUS IntNotifyIntroEvent(INTRO_EVENT_TYPE EventClass, void *Param, size_t EventSize)
Notifies the integrator about an introspection alert.
Definition: glue.c:1042
DWORD AF
Definition: winbugcheck.h:51
#define memzero(a, s)
Definition: introcrt.h:35
INTRO_PROCESS CurrentProcess
The currently active process.
Definition: intro_types.h:1975
QWORD Reason
The bugcheck reason.
Definition: intro_types.h:1969
DWORD Ebx
Definition: wddefs.h:909
Information about Windows kernel crashes.
BOOLEAN Guest64
True if this is a 64-bit guest, False if it is a 32-bit guest.
Definition: guests.h:290
unsigned long long QWORD
Definition: intro_types.h:53
CHAR Name[IMAGE_BASE_NAME_LEN]
Process base name.
Definition: winprocess.h:108
QWORD Current
The currently used options.
Definition: guests.h:236
The layout of the EFLAGS register.
Definition: winbugcheck.h:42
An _EXCEPTION_RECORD structure used by 64-bit guests.
Definition: wddefs.h:1208
QWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Exception-dependent parameters.
Definition: wddefs.h:1199
DWORD SegCs
Definition: wddefs.h:1702
QWORD UserCr3
Process user PDBR. Includes PCID.
Definition: winprocess.h:99
Structure encapsulating VCPU-specific information.
Definition: guests.h:83
DWORD Esi
Definition: wddefs.h:1694
QWORD R15
Definition: wddefs.h:1632
DWORD SegDs
Definition: wddefs.h:1691
QWORD Rsp
Definition: wddefs.h:1621
QWORD Rsi
Definition: wddefs.h:1623
WORD Fs
Definition: wddefs.h:922
DWORD Ebp
Definition: wddefs.h:1700
QWORD GdtBase
Definition: glueiface.h:58
#define TRUE
Definition: intro_types.h:30
#define IS_KERNEL_POINTER_WIN(is64, p)
Checks if a guest virtual address resides inside the Windows kernel address space.
Definition: wddefs.h:76
INTSTATUS IntWinBcHandleBugCheck(void const *Detour)
Handles a Windows OS crash.This is the detour handle for the KeBugCheck2 32-bit Windows kernel API an...
Definition: winbugcheck.c:932
DWORD SegSs
Definition: wddefs.h:1705
PWIN_PROCESS_OBJECT IntWinProcFindObjectByCr3(QWORD Cr3)
Finds a process by its kernel CR3.
Definition: winprocesshp.c:195
DWORD ExitStatus
The exit status of the process (used when sending the process terminated event).
Definition: winprocess.h:192
static void IntWinLogVAInfo(QWORD Va)
Logs information about a guest virtual address translation.
Definition: winbugcheck.c:313
QWORD FsBase
Definition: glueiface.h:82
void * Name
The name of the driver.
Definition: drivers.h:54
QWORD IdtLimit
Definition: glueiface.h:57
DWORD Edi
Definition: wddefs.h:913
void IntAlertFillWinProcessCurrent(INTRO_PROCESS *EventProcess)
Saves information about the current Windows process inside an alert.
Definition: alerts.c:781
QWORD GsLimit
Definition: glueiface.h:87
WORD SegSs
Definition: wddefs.h:1607
INTSTATUS IntTranslateVirtualAddressEx(QWORD Gva, QWORD Cr3, DWORD Flags, VA_TRANSLATION *Translation)
Translates a guest virtual address to a guest physical address.
Definition: introcore.c:1863
#define BUGCHECK_CRITICAL_PROCESS_DIED
Definition: winbugcheck.h:36
QWORD Rbx
Definition: wddefs.h:1620
char * PCHAR
Definition: intro_types.h:56
#define BUGCHECK_INACCESSIBLE_BOOT_DEVICE
Definition: winbugcheck.h:32
QWORD GdtLimit
Definition: glueiface.h:59
QWORD R8
Definition: wddefs.h:1625
#define WARNING(fmt,...)
Definition: glue.h:60
DWORD Pid
Process ID (the one used by Windows).
Definition: winprocess.h:100
QWORD R13
Definition: wddefs.h:1630
DWORD Edx
Definition: wddefs.h:1696
DWORD CpuCount
The number of logical CPUs.
Definition: guests.h:279
#define PAGE_SIZE
Definition: common.h:70
WORD SegEs
Definition: wddefs.h:1604
QWORD SsLimit
Definition: glueiface.h:71
QWORD EsAr
Definition: glueiface.h:81
DWORD SegEs
Definition: wddefs.h:1690
void IntMemClkDump(void)
Dumps all the active cloak regions.
Definition: memcloak.c:1218
#define __forceinline
Definition: introtypes.h:61
QWORD Peb32Address
PEB 32 address (on pure x64 processes, this will be 0).
Definition: winprocess.h:104
QWORD CsSelector
Definition: glueiface.h:68
#define BUGCHECK_KERNEL_STACK_INPAGE_ERROR
Definition: winbugcheck.h:30
uint32_t DWORD
Definition: intro_types.h:49
TIMER_FRIENDLY void IntDumpGvaEx(QWORD Gva, DWORD Length, QWORD Cr3, DWORD RowLength, DWORD ElementLength, BOOLEAN LogHeader, BOOLEAN DumpAscii)
This function dumps a given GVA in a user friendly format. This function uses IntDumpBuffer to perfor...
Definition: dumper.c:204
#define BUGCHECK_PAGE_FAULT_IN_NONPAGED_AREA
Definition: winbugcheck.h:28
QWORD OriginalTokenPtr
Original Token pointer inside EPROCESS (should never change).
Definition: winprocess.h:247
DWORD Edx
Definition: wddefs.h:908
static void IntLogExceptionRecord(QWORD ExceptionRecord)
Logs information about an exception record.
Definition: winbugcheck.c:599
DWORD PF
Definition: winbugcheck.h:49
QWORD GsBase
Definition: glueiface.h:86
WORD SegDs
Definition: wddefs.h:1603
QWORD CsLimit
Definition: glueiface.h:67
MM Mm
Guest memory information, such as paging mode, system Cr3 value, etc.
Definition: guests.h:374
QWORD EprocessAddress
This will be the address of the ActiveProcess field.
Definition: winprocess.h:90
Definition: wddefs.h:895
QWORD FsAr
Definition: glueiface.h:85
GUEST_STATE gGuest
The current guest state.
Definition: guests.c:50
QWORD FsSelector
Definition: glueiface.h:84
#define BUGCHECK_KERNEL_DATA_INPAGE_ERROR
Definition: winbugcheck.h:31
DWORD Eax
Definition: wddefs.h:906
WORD Cs
Definition: wddefs.h:916
DWORD ExceptionAddress
Definition: wddefs.h:1213
#define INTRO_OPT_EVENT_OS_CRASH
Enable OS crash events (generates introEventCrashEvent events).
Definition: intro_types.h:447
QWORD Param4
Fourth parameter.
Definition: intro_types.h:1973
DWORD Eip
Definition: wddefs.h:1701
PWIN_PROCESS_OBJECT IntWinProcFindObjectByEprocess(QWORD Eprocess)
Finds a process by the address of its _EPROCESS structure.
Definition: winprocesshp.c:96
DWORD Ebp
Definition: wddefs.h:911
QWORD VirtualAddress
The translated virtual address.
Definition: introcore.h:105
INTSTATUS IntKernVirtMemRead(QWORD KernelGva, DWORD Length, void *Buffer, DWORD *RetLength)
Reads data from a guest kernel virtual memory range.
Definition: introcore.c:674
KERNEL_DRIVER * IntDriverFindByAddress(QWORD Gva)
Returns the driver in which Gva resides.
Definition: drivers.c:164
DWORD EFlags
Definition: wddefs.h:1161
#define NLOG(fmt,...)
Definition: glue.h:43
WORD SegCs
Definition: wddefs.h:1602
#define BUGCHECK_UNEXPECTED_KERNEL_MODE_TRAP
Definition: winbugcheck.h:34
#define BUGCHEDCK_CRITICAL_STRUCTURE_CORRUPTION
Definition: winbugcheck.h:37
Encapsulates information about a virtual to physical memory translation.
Definition: introcore.h:102
KERNEL_DRIVER * KernelDriver
Points to the driver object that describes the kernel image.
Definition: guests.h:385
char * utf16_for_log(const WCHAR *WString)
Converts a UTF-16 to a UTF-8 string to be used inside logging macros.
Definition: introcore.c:2845
QWORD R14
Definition: wddefs.h:1631
#define INT_STATUS_INVALID_PARAMETER_1
Definition: introstatus.h:62
DWORD Edi
Definition: wddefs.h:1693
VCPU_STATE * gVcpu
The state of the current VCPU.
Definition: guests.c:59
DWORD Esp
Definition: wddefs.h:910
#define MODULE_NAMES_TO_PRINT
64-bit selector.
Definition: glueiface.h:188
static void IntLogGuestRegisters(void)
Logs the guest register state.
Definition: winbugcheck.c:186
WORD Gs
Definition: wddefs.h:924
DWORD ExceptionFlags
Definition: wddefs.h:1192
static void IntLogProcessInfo(void)
Logs information about the current process.
Definition: winbugcheck.c:266
static void IntLogCriticalProcessHasDied(QWORD Param1, QWORD Param2)
Handles a BUGCHECK_CRITICAL_PROCESS_DIED bug check.
Definition: winbugcheck.c:668
static void IntLogCriticalStructureCoruption(QWORD Param3, QWORD Param4)
Handles a BUGCHEDCK_CRITICAL_STRUCTURE_CORRUPTION bug check.
Definition: winbugcheck.c:705
QWORD R10
Definition: wddefs.h:1627
Holds register state.
Definition: glueiface.h:30
INTSTATUS IntGetSegs(DWORD CpuNumber, PIG_SEG_REGS Regs)
Read the guest segment registers.
Definition: introcpu.c:995
DWORD ZF
Definition: winbugcheck.h:53
DWORD ExceptionFlags
Definition: wddefs.h:1211
#define EXCEPTION_MAXIMUM_PARAMETERS
Definition: wddefs.h:1180
DWORD EFlags
Definition: wddefs.h:1608
#define TRACE_LIMIT_X64
char CHAR
Definition: intro_types.h:56
DWORD SegGs
Definition: wddefs.h:1688
Context Frame for 64-bit guests.
Definition: wddefs.h:1590
DWORD Esp
Definition: wddefs.h:1704
QWORD IdtBase
Definition: glueiface.h:56
#define PAGE_MASK
Definition: pgtable.h:35
QWORD Param2
Second parameter.
Definition: intro_types.h:1971
QWORD EsBase
Definition: glueiface.h:78
#define BUGCHECK_BAD_POOL_HEADER
Definition: winbugcheck.h:23
DWORD Eip
Definition: wddefs.h:904
INTRO_PROT_OPTIONS CoreOptions
The activation and protection options for this guest.
Definition: guests.h:271
INTSTATUS IntDecDecodeInstruction(IG_CS_TYPE CsType, QWORD Gva, void *Instrux)
Decode an instruction from the provided guest linear address.
Definition: decoder.c:180
#define BUGCHECK_NAME(x)
An _EXCEPTION_RECORD structure used by 64-bit guests.
Definition: wddefs.h:1188
#define BUGCHECK_IRQL_NOT_LESS_OR_EQUAL
Definition: winbugcheck.h:22
QWORD DsLimit
Definition: glueiface.h:75
This structure describes a running process inside the guest.
Definition: winprocess.h:83
WCHAR * Path
The string which represents the user-mode module path.
Definition: winumpath.h:17
QWORD EsLimit
Definition: glueiface.h:79
static void IntLogContextRecord(QWORD ContextRecord)
Logs information about a context record.
Definition: winbugcheck.c:526