Bitdefender Hypervisor Memory Introspection
integrity.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #ifndef _INTEGRITY_H_
6 #define _INTEGRITY_H_
7 
8 #include "introtypes.h"
9 
19 typedef INTSTATUS
21  _In_ void *IntegrityRegion
22  );
23 
24 
28 typedef struct _INTEGRITY_REGION
29 {
41  void *Context;
49 
50 
51 //
52 // API
53 //
56  void
57  );
58 
61  _In_ QWORD VirtualAddress,
64  _In_opt_ void *Context,
66  _In_ BOOLEAN CopyContent,
67  _Out_ void **Descriptor
68  );
69 
72  _In_ INTEGRITY_REGION *IntegrityRegion
73  );
74 
77  _In_ void *Descriptor
78  );
79 
82  _In_ void *Descriptor
83  );
84 
85 void
87  void
88  );
89 
92  void
93  );
94 
95 #endif // _INTEGRITY_H_
#define _In_opt_
Definition: intro_sal.h:16
#define _Out_
Definition: intro_sal.h:22
_Bool BOOLEAN
Definition: intro_types.h:58
#define _In_
Definition: intro_sal.h:21
INTSTATUS IntIntegrityAddRegion(QWORD VirtualAddress, DWORD Length, INTRO_OBJECT_TYPE Type, void *Context, PFUNC_IntegrityViolationCallback Callback, BOOLEAN CopyContent, void **Descriptor)
Creates an INTEGRITY_REGION object and adds it to the gIntegrityRegions list.
Definition: integrity.c:91
void * Context
User supplied context, see IntIntegrityAddRegion for an example.
Definition: integrity.h:41
PFUNC_IntegrityViolationCallback Callback
The callback to be called when a violation occurs.
Definition: integrity.h:45
int INTSTATUS
The status data type.
Definition: introstatus.h:24
INTSTATUS(* PFUNC_IntegrityViolationCallback)(void *IntegrityRegion)
Integrity violation callback.
Definition: integrity.h:20
INTSTATUS IntIntegrityDeleteRegion(void *Descriptor)
Marks the given integrity region for deletion. It will be removed after calling all the integrity cal...
Definition: integrity.c:348
LIST_ENTRY Link
Link to the next integrity region.
Definition: integrity.h:30
DWORD ViolationCount
The number of detected modifications on the given region.
Definition: integrity.h:37
struct _INTEGRITY_REGION * PINTEGRITY_REGION
INTRO_OBJECT_TYPE Type
The associated INTRO_OBJECT_TYPE with the protected region.
Definition: integrity.h:39
enum _INTRO_OBJECT_TYPE INTRO_OBJECT_TYPE
The type of the object protected by an EPT hook.
INTSTATUS IntIntegrityRecalculate(INTEGRITY_REGION *IntegrityRegion)
Recalculates the hash and reads the original content again for a given region.
Definition: integrity.c:242
INTSTATUS IntIntegrityUninit(void)
Uninits the integrity mechanism by removing every integrity region from the list. ...
Definition: integrity.c:503
DWORD OriginalHash
Definition: integrity.h:33
BOOLEAN Deleted
Set TRUE for postpone deleting of integrity regions (e.g. deleting from callback) ...
Definition: integrity.h:47
unsigned long long QWORD
Definition: intro_types.h:53
DWORD ModifiedHash
The newly computed hash when a modification is detected.
Definition: integrity.h:35
QWORD Gva
The guest virtual address where the region starts.
Definition: integrity.h:31
uint32_t DWORD
Definition: intro_types.h:49
INTSTATUS IntIntegrityRemoveRegion(void *Descriptor)
Removes an integrity region from the gIntegrityRegions list.
Definition: integrity.c:313
void IntIntegrityDump(void)
Dumps all the INTEGRITY_REGION structures from gIntegrityRegions. Used mainly for debugging...
Definition: integrity.c:486
void * OriginalContent
A buffer containing the original bytes of the associated region.
Definition: integrity.h:43
struct _INTEGRITY_REGION INTEGRITY_REGION
DWORD Length
The length of the current region, in bytes.
Definition: integrity.h:32
INTSTATUS IntIntegrityCheckAll(void)
The function which is called once every second and checks all the integrity regions.
Definition: integrity.c:377