Bitdefender Hypervisor Memory Introspection
update_exceptions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Bitdefender
3  * SPDX-License-Identifier: Apache-2.0
4  */
9 
10 #ifndef _UPDATE_EXCEPTIONS_H_
11 #define _UPDATE_EXCEPTIONS_H_
12 
13 #include "exceptions.h"
14 
15 //
16 // These will be shared between Linux & Windows
17 //
18 
19 #pragma pack(push)
20 #pragma pack(1)
21 
22 
26 typedef struct _UPDATE_FILE_HEADER
27 {
29 
30  struct
31  {
34  } Version;
35 
39 
41 
44 
47 
48 
52 typedef struct _UPDATE_HEADER
53 {
57 
58 
62 typedef struct _UPDATE_KM_EXCEPTION
63 {
64  struct
65  {
68  } Originator;
69 
71 
73 
77 
78  _Field_size_(SigCount)
79  DWORD SigIds[];
81 
82 
86 typedef struct _UPDATE_UM_EXCEPTION
87 {
89 
90  struct
91  {
94  } Victim;
95 
97 
101 
102  _Field_size_(SigCount)
103  DWORD SigIds[];
105 
106 
111 {
114 
120 
122  CHAR OriginatorNameGlob[EXCEPTION_UM_GLOB_LENGTH];
123 
124  struct
125  {
130  } Victim;
131 
132  _Field_size_(SigCount)
133  DWORD SigIds[];
135 
136 
140 typedef struct _UPDATE_KUM_EXCEPTION
141 {
142  union
143  {
147  } Originator;
148 
149  struct
150  {
151  DWORD NameHash;
152  DWORD ProcessHash;
153  } Victim;
154 
156 
160 
161  _Field_size_(SigCount)
162  DWORD SigIds[];
164 
165 
169 typedef struct _UPDATE_CB_HASH
170 {
172 
173  _Field_size_(Count)
174  DWORD Hashes[];
176 
177 
181 typedef struct _UPDATE_VALUE_HASH
182 {
185  BYTE _Reserved[4];
188 
189 
193 typedef struct _UPDATE_EXPORT_HASH
194 {
196  BYTE _Reserved[2];
199 
200 
204 typedef struct _UPDATE_CB_SIGNATURE
205 {
208 
211 
212  char HashesList[];
214 
215 
220 {
223 
225 
227  BYTE _Align[3];
228 
229  char HashesList[];
231 
232 
237 {
240 
243  BYTE _Align[2];
244 
245  char HashesList[];
247 
248 
252 typedef struct _UPDATE_IDT_SIGNATURE
253 {
256 
258  BYTE _Reserved[3];
260 
261 
266 {
269 
272 
273  WORD Pattern[];
275 
276 
281 {
284 
285  union
286  {
288  struct
289  {
294  BYTE _Reserved[2];
295  };
298  } Minimum;
299 
300  union
301  {
303  struct
304  {
305  BYTE Version;
306  BYTE Patch;
307  WORD Sublevel;
308  WORD Backport;
309  BYTE _Reserved[2];
310  };
312  QWORD Value;
313  } Maximum;
314 
316 
317 
322 {
325 
326  union
327  {
329  struct
330  {
335  };
336 
338  } Minimum;
339 
340  union
341  {
343  struct
344  {
345  WORD Major;
346  WORD Minor;
347  WORD Revision;
348  WORD Build;
349  };
350 
351  QWORD Raw;
352  } Maximum;
353 
355 
356 
361 {
364 
366 
367  DWORD _Reserved[3];
368 
370 
371 #pragma pack(pop)
372 
373 
374 #define UPDATE_MAGIC_WORD 'ANXE'
375 
376 #define UPDATE_TYPE_KM_EXCEPTION 1
377 #define UPDATE_TYPE_UM_EXCEPTION 2
378 #define UPDATE_TYPE_UM_EXCEPTION_GLOB_MATCH 6
379 #define UPDATE_TYPE_APC_UM_EXCEPTION 9
380 
381 #define UPDATE_TYPE_CB_SIGNATURE 3
382 #define UPDATE_TYPE_EXPORT_SIGNATURE 4
383 #define UPDATE_TYPE_VALUE_SIGNATURE 5
384 #define UPDATE_TYPE_RESERVED 7
385 #define UPDATE_TYPE_VALUE_CODE_SIGNATURE 8
386 #define UPDATE_TYPE_IDT_SIGNATURE 10
387 #define UPDATE_TYPE_VERSION_OS_SIGNATURE 11
388 #define UPDATE_TYPE_VERSION_INTRO_SIGNATURE 12
389 #define UPDATE_TYPE_PROCESS_CREATION_SIGNATURE 13
390 #define UPDATE_TYPE_KUM_EXCEPTION 14
391 
392 #define UPDATE_EXCEPTIONS_MIN_VER_MAJOR 2
393 #define UPDATE_EXCEPTIONS_MIN_VER_MINOR 2
394 
395 
396 INTSTATUS
398  _Out_ WORD *MajorVersion,
399  _Out_ WORD *MinorVersion,
401  );
402 
403 INTSTATUS
405  _In_ void *Buffer,
406  _In_ DWORD Length,
407  _In_ DWORD Flags
408  );
409 
410 INTSTATUS
412  _In_ const void *Event,
413  _In_ INTRO_EVENT_TYPE Type,
414  _In_ BOOLEAN Exception,
415  _In_ QWORD Context
416  );
417 
418 INTSTATUS
420  void
421  );
422 
423 INTSTATUS
425  _In_opt_ QWORD Context
426  );
427 
428 #endif // _UPDATE_EXCEPTIONS_H_
#define _In_opt_
Definition: intro_sal.h:16
BYTE _Reserved
Alignment purposes.
The header of an exception or a signature.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
_Bool BOOLEAN
Definition: intro_types.h:58
#define _Out_
Definition: intro_sal.h:22
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
BYTE Type
The type of the exception; any type from _UM_EXCEPTION_OBJECT.
DWORD DriverHash
Contains the originator driver name-hash.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
uint8_t BYTE
Definition: intro_types.h:47
struct _UPDATE_PROCESS_CREATION_SIGNATURE UPDATE_PROCESS_CREATION_SIGNATURE
Describe a process-creation signature in binary format.
#define _In_
Definition: intro_sal.h:21
struct _UPDATE_CB_SIGNATURE * PUPDATE_CB_SIGNATURE
uint16_t WORD
Definition: intro_types.h:48
Describe a code-blocks hash in binary format.
struct _UPDATE_EXPORT_SIGNATURE UPDATE_EXPORT_SIGNATURE
Describe an export signature in binary format.
Describe a kernel-mode exception in binary format.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
WORD SigCount
The number of the signatures.
struct _UPDATE_FILE_HEADER * PUPDATE_FILE_HEADER
Describe a export hash in binary format.
WORD SigCount
The number of the signatures.
Describe a version OS signature in binary format.
INTSTATUS IntUpdateLoadExceptions(void *Buffer, DWORD Length, DWORD Flags)
Handles the exceptions coming from the integrator.
Describe a process-creation signature in binary format.
INT16 Offset
The displacement from the beginning of the modified zone.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
struct _UPDATE_IDT_SIGNATURE * PUPDATE_IDT_SIGNATURE
struct _UPDATE_VALUE_HASH UPDATE_VALUE_HASH
Describe a value hash in binary format.
BYTE ListsCount
The number of the list of hashes.
struct _UPDATE_VALUE_SIGNATURE * PUPDATE_VALUE_SIGNATURE
int INTSTATUS
The status data type.
Definition: introstatus.h:24
WORD Minor
The minor version of the exceptions binary file.
DWORD OriginatorNameHash
The name-hash of the originator.
DWORD CreateMask
Contains the DPI mask.
BYTE _Reserved
Alignment purposes.
Describe a value hash in binary format.
Describe an IDT signature in binary format.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
DWORD NameHash
The name-hash of the originator.
struct _UPDATE_HEADER * PUPDATE_HEADER
Describe a value-code signature in binary format.
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
WORD Size
The size of the exception/signature.
DWORD BuildNumber
The build number of the exceptions binary file.
struct _UPDATE_VALUE_CODE_SIGNATURE * PUPDATE_VALUE_CODE_SIGNATURE
#define EXCEPTION_UM_GLOB_LENGTH
Definition: exceptions.h:36
#define _Field_size_(expr)
Definition: intro_sal.h:41
DWORD SignaturesCount
The number of the signatures.
struct _UPDATE_FILE_HEADER UPDATE_FILE_HEADER
The header of the exceptions binary file.
struct _UPDATE_VERSION_INTRO_SIGNATURE * PUPDATE_VERSION_INTRO_SIGNATURE
DWORD Hash
The hash of the modified zone.
unsigned long long QWORD
Definition: intro_types.h:53
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
BYTE ListsCount
The number of the list of hashes.
The header of the exceptions binary file.
DWORD VictimNameHash
The name-hash of the victim.
struct _UPDATE_PROCESS_CREATION_SIGNATURE * PUPDATE_PROCESS_CREATION_SIGNATURE
BYTE Type
The type of the exception/signature.
WORD Length
The length of the opcode pattern.
Describe a value signature in binary format.
Describe a kernel-user mode exception in binary format.
DWORD ProcessHash
Contains the originator process name-hash.
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
struct _UPDATE_FILE_HEADER::@141 Version
struct _UPDATE_EXPORT_HASH * PUPDATE_EXPORT_HASH
DWORD Magic
The magic value; must be UPDATE_MAGIC_WORD.
struct _UPDATE_HEADER UPDATE_HEADER
The header of an exception or a signature.
DWORD UserExceptionsCount
The number of the user-mode exceptions.
uint32_t DWORD
Definition: intro_types.h:49
int16_t INT16
Definition: intro_types.h:43
WORD SigCount
The number of the signatures.
BYTE Type
The type of the exception; any type from KUM_EXCEPTION_OBJECT.
BYTE Count
The number of hashes from the list.
struct _UPDATE_VALUE_SIGNATURE UPDATE_VALUE_SIGNATURE
Describe a value signature in binary format.
DWORD Flags
The flags of the exception; any flags from EXCEPTION_FLG.
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
struct _UPDATE_VERSION_OS_SIGNATURE UPDATE_VERSION_OS_SIGNATURE
Describe a version OS signature in binary format.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
struct _UPDATE_IDT_SIGNATURE UPDATE_IDT_SIGNATURE
Describe an IDT signature in binary format.
DWORD UserExceptionsGlobCount
The number of the user-mode exceptions that contains glob items.
struct _UPDATE_VERSION_INTRO_SIGNATURE UPDATE_VERSION_INTRO_SIGNATURE
Describe a version introspection signature in binary format.
Describe a version introspection signature in binary format.
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
Describe an export signature in binary format.
DWORD KernelExceptionsCount
The number of the kernel-mode exceptions.
WORD Offset
The displacement from the beginning of the modified zone.
DWORD ProcessHash
The name-hash of the process in which the modification takes place.
Describe a code-blocks signature in binary format.
DWORD NameHash
Contains the originator name-hash.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
struct _UPDATE_VALUE_HASH * PUPDATE_VALUE_HASH
INTSTATUS IntUpdateFlushAlertExceptions(void)
This function removes all exceptions that were added from alerts.
BYTE Type
The type of the exception; any type from _UM_EXCEPTION_OBJECT.
BYTE Score
The number of (minimum) hashes from a list that need to match.
Describe a user-mode-glob exception in binary format.
WORD SigCount
The number of the signatures.
WORD Major
The major version of the exceptions binary file.
enum _INTRO_EVENT_TYPE INTRO_EVENT_TYPE
Event classes.
BYTE ListsCount
The number of the list of hashes.
INTSTATUS IntUpdateGetVersion(WORD *MajorVersion, WORD *MinorVersion, DWORD *BuildNumber)
Get the version of the loaded exceptions binary file.
DWORD LibraryName
The name-hash of the modified library.
BYTE Entry
The number of the IDT entry.
DWORD Hash
The hash of the modified function name.
struct _UPDATE_EXPORT_HASH UPDATE_EXPORT_HASH
Describe a export hash in binary format.
BYTE Score
The number of (minimum) hashes from a list that need to match.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
struct _UPDATE_EXPORT_SIGNATURE * PUPDATE_EXPORT_SIGNATURE
char CHAR
Definition: intro_types.h:56
DWORD NameHash
The name-hash of the victim.
BYTE _Reserved
Alignment purposes.
WORD Size
The size of of the modified zone.
DWORD Id
An unique id (_EXCEPTION_SIGNATURE_ID)
INTSTATUS IntUpdateAddExceptionFromAlert(const void *Event, INTRO_EVENT_TYPE Type, BOOLEAN Exception, QWORD Context)
Handles all types of supported exceptions that can be added from alerts.
DWORD Flags
Contains any flags from _SIGNATURE_FLG.
DWORD KernelUserExceptionsCount
The number of the kernel-user mode exceptions.
Describe a user-mode exception in binary format.
struct _UPDATE_VALUE_CODE_SIGNATURE UPDATE_VALUE_CODE_SIGNATURE
Describe a value-code signature in binary format.
INTSTATUS IntUpdateRemoveException(QWORD Context)
This function removes an exception for a given context.
WORD Delta
The number of bytes that are modified.
BYTE Type
The type of the exception; any type from _KM_EXCEPTION_OBJECT.
DWORD Flags
The flags of the exception; any flags from _EXCEPTION_FLG.
struct _UPDATE_CB_SIGNATURE UPDATE_CB_SIGNATURE
Describe a code-blocks signature in binary format.
struct _UPDATE_VERSION_OS_SIGNATURE * PUPDATE_VERSION_OS_SIGNATURE