Bitdefender Hypervisor Memory Introspection
exceptions_krnusr.c File Reference
#include "exceptions.h"
#include "codeblocks.h"
#include "crc32.h"
#include "decoder.h"
#include "hook.h"
#include "winpe.h"

Go to the source code of this file.

Functions

static void IntExceptKernelUserLogWindowsInformation (EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_KM_ORIGINATOR *Originator, INTRO_ACTION Action, INTRO_ACTION_REASON Reason)
 Print the information about a kernel-user mode violation (windows guest). More...
 
void IntExceptKernelUserLogInformation (EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_KM_ORIGINATOR *Originator, INTRO_ACTION Action, INTRO_ACTION_REASON Reason)
 Print the information about a kernel-user mode violation and dumps the code-blocks. More...
 
static __inline BOOLEAN IntExceptKernelUserMatchZoneFlags (EXCEPTION_VICTIM_ZONE *Victim, KUM_EXCEPTION *Exception)
 Checks if the zone-flags of the current exception match the zone flags of the victim. More...
 
static __inline BOOLEAN IntExceptKernelUserMatchArch (KUM_EXCEPTION *Exception)
 Checks if the architecture-flags of the current exception match the architecture-flags of the originator. More...
 
static __inline BOOLEAN IntExceptKernelUserMatchNameHash (EXCEPTION_VICTIM_ZONE *Victim, KUM_EXCEPTION *Exception)
 Checks if the exception name-hash of the current exception matches the name-hash of the victim. More...
 
static __inline BOOLEAN IntExceptKernelUserMatchProcessHash (EXCEPTION_VICTIM_ZONE *Victim, KUM_EXCEPTION *Exception)
 Checks if the exception process name-hash of the current exception matches the process name-hash of the victim. More...
 
static __inline BOOLEAN IntExceptKernelUserMatchObjectType (EXCEPTION_VICTIM_ZONE *Victim, KUM_EXCEPTION *Exception)
 Checks if the zone-type of the current exception matches the object-type of the victim. More...
 
INTSTATUS IntExceptKernelUserMatchVictim (EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_KM_ORIGINATOR *Originator, KUM_EXCEPTION *Exception)
 This function checks if the exception matches the originator and the modified zone. More...
 
INTSTATUS IntExceptKernelUser (EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_KM_ORIGINATOR *Originator, INTRO_ACTION *Action, INTRO_ACTION_REASON *Reason)
 This function iterates through exception lists and tries to find an exception that matches the originator and the victim. More...
 
INTSTATUS IntExceptKernelUserVerifyExtra (EXCEPTION_VICTIM_ZONE *Victim, EXCEPTION_UM_ORIGINATOR *Originator, UM_EXCEPTION *Exception)
 This function is used as an extra step in exception mechanism. More...
 

Variables

char gExcLogLine [2 *ONE_KILOBYTE]
 The exception log line. More...
 

Function Documentation

◆ IntExceptKernelUser()

INTSTATUS IntExceptKernelUser ( EXCEPTION_VICTIM_ZONE Victim,
EXCEPTION_KM_ORIGINATOR Originator,
INTRO_ACTION Action,
INTRO_ACTION_REASON Reason 
)

This function iterates through exception lists and tries to find an exception that matches the originator and the victim.

Parameters
[in]VictimThe victim object.
[in]OriginatorThe originator object.
[out]ActionThe action that was taken.
[out]ReasonThe reason for which Action was taken.
Return values
INT_STATUS_INVALID_PARAMETER_1If the victim object is invalid.
INT_STATUS_INVALID_PARAMETER_2If the originator object is invalid.
INT_STATUS_INVALID_PARAMETER_3If the action is invalid.
INT_STATUS_INVALID_PARAMETER_4If the reason is invalid.
INT_STATUS_EXCEPTION_ALLOWIf the violation is allowed.
INT_STATUS_EXCEPTION_NOT_MATCHEDIf the violation is not allowed.

Definition at line 776 of file exceptions_krnusr.c.

Referenced by IntExcept().

◆ IntExceptKernelUserLogInformation()

void IntExceptKernelUserLogInformation ( EXCEPTION_VICTIM_ZONE Victim,
EXCEPTION_KM_ORIGINATOR Originator,
INTRO_ACTION  Action,
INTRO_ACTION_REASON  Reason 
)

Print the information about a kernel-user mode violation and dumps the code-blocks.

Parameters
[in]VictimThe victim object.
[in]OriginatorThe originator object.
[in]ActionThe action that was taken.
[in]ReasonThe reason for which Action was taken.

Definition at line 414 of file exceptions_krnusr.c.

Referenced by IntExcept(), and IntWinModHandleKernelWrite().

◆ IntExceptKernelUserLogWindowsInformation()

static void IntExceptKernelUserLogWindowsInformation ( EXCEPTION_VICTIM_ZONE Victim,
EXCEPTION_KM_ORIGINATOR Originator,
INTRO_ACTION  Action,
INTRO_ACTION_REASON  Reason 
)
static

Print the information about a kernel-user mode violation (windows guest).

Parameters
[in]VictimThe victim object.
[in]OriginatorThe originator object.
[in]ActionThe action that was taken.
[in]ReasonThe reason for which Action was taken.

Definition at line 22 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserLogInformation().

◆ IntExceptKernelUserMatchArch()

static __inline BOOLEAN IntExceptKernelUserMatchArch ( KUM_EXCEPTION Exception)
static

Checks if the architecture-flags of the current exception match the architecture-flags of the originator.

Parameters
[in]ExceptionThe exception object.
Return values
Trueif the arch match, otherwise false.

Definition at line 491 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserMatchVictim().

◆ IntExceptKernelUserMatchNameHash()

static __inline BOOLEAN IntExceptKernelUserMatchNameHash ( EXCEPTION_VICTIM_ZONE Victim,
KUM_EXCEPTION Exception 
)
static

Checks if the exception name-hash of the current exception matches the name-hash of the victim.

Parameters
[in]VictimThe victim object.
[in]ExceptionThe exception object.
Return values
Trueif the name-hash matches, otherwise false.

Definition at line 525 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserMatchVictim().

◆ IntExceptKernelUserMatchObjectType()

static __inline BOOLEAN IntExceptKernelUserMatchObjectType ( EXCEPTION_VICTIM_ZONE Victim,
KUM_EXCEPTION Exception 
)
static

Checks if the zone-type of the current exception matches the object-type of the victim.

Parameters
[in]VictimThe victim object.
[in]ExceptionThe exception object.
Return values
Trueif the object-type matches, otherwise false.

Definition at line 584 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserMatchVictim().

◆ IntExceptKernelUserMatchProcessHash()

static __inline BOOLEAN IntExceptKernelUserMatchProcessHash ( EXCEPTION_VICTIM_ZONE Victim,
KUM_EXCEPTION Exception 
)
static

Checks if the exception process name-hash of the current exception matches the process name-hash of the victim.

Parameters
[in]VictimThe victim object.
[in]ExceptionThe exception object.
Return values
Trueif the process name-hash matches, otherwise false.

Definition at line 549 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserMatchVictim().

◆ IntExceptKernelUserMatchVictim()

INTSTATUS IntExceptKernelUserMatchVictim ( EXCEPTION_VICTIM_ZONE Victim,
EXCEPTION_KM_ORIGINATOR Originator,
KUM_EXCEPTION Exception 
)

This function checks if the exception matches the originator and the modified zone.

The following are verified:

  • the zone flags
  • the zone type
  • the exception flags
  • the modified name-hash
  • the process name-hash
  • the architecture flags
  • the initialization type
  • the return driver
Parameters
[in]VictimThe victim object.
[in]OriginatorThe originator object.
[in]ExceptionThe current exception object.
Return values
INT_STATUS_EXCEPTION_NOT_MATCHEDIf any check fails.
INT_STATUS_EXCEPTION_ALLOWIf all checks have passed.

Definition at line 635 of file exceptions_krnusr.c.

Referenced by IntExceptMatchException().

◆ IntExceptKernelUserMatchZoneFlags()

static __inline BOOLEAN IntExceptKernelUserMatchZoneFlags ( EXCEPTION_VICTIM_ZONE Victim,
KUM_EXCEPTION Exception 
)
static

Checks if the zone-flags of the current exception match the zone flags of the victim.

Parameters
[in]VictimThe victim object.
[in]ExceptionThe exception object.
Return values
Trueif the zone-flags match, otherwise false.

Definition at line 453 of file exceptions_krnusr.c.

Referenced by IntExceptKernelUserMatchVictim().

◆ IntExceptKernelUserVerifyExtra()

INTSTATUS IntExceptKernelUserVerifyExtra ( EXCEPTION_VICTIM_ZONE Victim,
EXCEPTION_UM_ORIGINATOR Originator,
UM_EXCEPTION Exception 
)

This function is used as an extra step in exception mechanism.

Parameters
[in]VictimThe victim object.
[in]OriginatorThe originator object.
[in]ExceptionThe current exception object.
Return values
INT_STATUS_EXCEPTION_CHECKS_OKOn success.

Definition at line 1100 of file exceptions_krnusr.c.

Referenced by IntExceptMatchException().

Variable Documentation

◆ gExcLogLine

char gExcLogLine[2 *ONE_KILOBYTE]

The exception log line.

Definition at line 40 of file exceptions.c.

Referenced by IntExceptKernelUserLogWindowsInformation().