Bitdefender Hypervisor Memory Introspection
hook_gva.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _HOOK_GVA_H_
6 #define _HOOK_GVA_H_
7 
8 #include "hook_gpa.h"
9 #include "hook_pts.h"
10 
11 typedef struct _HOOK_HEADER HOOK_HEADER;
12 
13 
18 typedef struct _HOOK_GVA
19 {
22  union
23  {
27  } Callback;
28 
35  DWORD Hash;
42 
43 
47 typedef struct _HOOK_GVA_STATE
48 {
51  BOOLEAN HooksRemoved;
54 
55 
56 
57 //
58 // API
59 //
62  _In_ QWORD Cr3,
63  _In_ QWORD Gva,
65  _In_ BYTE Type,
66  _In_ void *Callback,
67  _In_opt_ void *Context,
68  _In_opt_ void *ParentHook,
69  _In_opt_ DWORD Flags,
70  _Out_opt_ HOOK_GVA **GvaHook
71  );
72 
75  _Inout_ HOOK_GVA **Hook,
76  _In_ DWORD Flags
77  );
78 
81  _Inout_ HOOK_GVA **Hook,
82  _In_ DWORD Flags
83  );
84 
87  void
88  );
89 
92  void
93  );
94 
95 #endif // _HOOK_GVA_H_
#define _In_opt_
Definition: intro_sal.h:16
struct _HOOK_GVA_STATE * PHOOK_GVA_STATE
_Bool BOOLEAN
Definition: intro_types.h:58
WORD Length
Definition: hook_gva.h:34
BOOLEAN IsPageWritable
True if the page is writable, false otherwise.
Definition: hook_gva.h:40
uint8_t BYTE
Definition: intro_types.h:47
#define _In_
Definition: intro_sal.h:21
LIST_ENTRY Link
List entry element.
Definition: hook_gva.h:21
uint16_t WORD
Definition: intro_types.h:48
INTSTATUS IntHookGvaDeleteHook(HOOK_GVA **Hook, DWORD Flags)
Completely delete a GVA hook.
Definition: hook_gva.c:612
BOOLEAN IsIntegrityOn
True if integrity checks are enabled for this page. Integrity checks are enabled if the this is a wri...
Definition: hook_gva.h:39
WORD Offset
Offset inside the 4K page, interval [0, 4095].
Definition: hook_gva.h:33
LIST_HEAD RemovedHooksList
IntHookGvaCommitHooks function is called.
Definition: hook_gva.h:50
struct _HOOK_GVA HOOK_GVA
int INTSTATUS
The status data type.
Definition: introstatus.h:24
QWORD GvaPage
Guest virtual page base address, aligned to 4K.
Definition: hook_gva.h:32
struct _HOOK_GVA * PHOOK_GVA
union _HOOK_GVA::@85 Callback
INTSTATUS IntHookGvaSetHook(QWORD Cr3, QWORD Gva, DWORD Length, BYTE Type, void *Callback, void *Context, void *ParentHook, DWORD Flags, HOOK_GVA **GvaHook)
Set a read, write, execute or swap hook on a guest virtual address.
Definition: hook_gva.c:345
#define _Inout_
Definition: intro_sal.h:20
#define _Out_opt_
Definition: intro_sal.h:30
unsigned long long QWORD
Definition: intro_types.h:53
HOOK_HEADER Header
The hook header.
Definition: hook_gva.h:20
struct _HOOK_GVA_STATE HOOK_GVA_STATE
INTSTATUS(* PFUNC_SwapCallback)(void *Context, QWORD VirtualAddress, QWORD OldEntry, QWORD NewEntry, QWORD OldPageSize, QWORD NewPageSize)
Callback invoked on translation modifications.
Definition: hook_pts.h:41
LIST_HEAD GvaHooks
The list of GVA hooks.
Definition: hook_gva.h:49
INTSTATUS IntHookGvaRemoveHook(HOOK_GVA **Hook, DWORD Flags)
Remove a GVA hook.
Definition: hook_gva.c:507
PHOOK_GPA GpaHook
The actual guest physical page hook. Valid as long as the page is mapped.
Definition: hook_gva.h:30
uint32_t DWORD
Definition: intro_types.h:49
INTSTATUS IntHookGvaCommitHooks(void)
Commit all the modified GVA hooks.
Definition: hook_gva.c:657
DWORD Hash
Hash computed on the content of the page. Valid only if IsIntegrityOn is true.
Definition: hook_gva.h:36
INTSTATUS(* PFUNC_EptViolationCallback)(void *Context, void *Hook, QWORD Address, INTRO_ACTION *Action)
EPT callback handler.
Definition: hook_gpa.h:30
PFUNC_EptViolationCallback Access
The read/write/execute access callback. Valid if Type != IG_EPT_HOOK_NONE.
Definition: hook_gva.h:25
PHOOK_PTS PtsHook
The page tables hook.
Definition: hook_gva.h:31
INTSTATUS IntHookGvaInit(void)
Initialize the GVA hooks system.
Definition: hook_gva.c:714
PFUNC_SwapCallback Swap
The swap callback. Valid if Type == IG_EPT_HOOK_NONE.
Definition: hook_gva.h:26