Validates the memory access rights for a given address range.
More...
#include <KittyPtrValidator.hpp>
|
| | KittyPtrValidator (pid_t pid, bool use_cache) |
| | Constructs a KittyPtrValidator object with the specified process ID and whether to use a cache.
|
| void | setUseCache (bool use_cache) |
| | Sets whether to use cached region information.
|
| void | setPID (pid_t pid) |
| | Sets the process ID to query memory regions.
|
| bool | isPtrReadable (uintptr_t ptr, size_t len=sizeof(void *)) |
| | Checks if a pointer is readable.
|
| bool | isPtrWritable (uintptr_t ptr, size_t len=sizeof(void *)) |
| | Checks if a pointer is writable.
|
| bool | isPtrExecutable (uintptr_t ptr, size_t len=sizeof(void *)) |
| | Checks if a pointer is executable.
|
| bool | isPtrInAddressSpace (uintptr_t ptr) |
| | Checks if a pointer is within the address space of the current process.
|
|
bool | isPtrReadable (const void *ptr, size_t len=sizeof(void *)) |
|
bool | isPtrWritable (const void *ptr, size_t len=sizeof(void *)) |
|
bool | isPtrExecutable (const void *ptr, size_t len=sizeof(void *)) |
|
bool | isPtrInAddressSpace (const void *ptr) |
|
void | clearCache () |
| | Clears the cached region information.
|
|
void | refreshRegionCache () |
| | Refreshes the cached region information.
|
| std::vector< RegionInfo > | cachedRegions () const |
| | Retrieves the cached region information.
|
Validates the memory access rights for a given address range.
This class uses process maps to determine the read, write, and execute permissions of a memory address.
◆ KittyPtrValidator()
| KittyPtrValidator::KittyPtrValidator |
( |
pid_t | pid, |
|
|
bool | use_cache ) |
|
inline |
Constructs a KittyPtrValidator object with the specified process ID and whether to use a cache.
- Parameters
-
| pid | The process ID. |
| use_cache | Determines if the cache should be used. |
◆ cachedRegions()
| std::vector< RegionInfo > KittyPtrValidator::cachedRegions |
( |
| ) |
const |
|
inline |
Retrieves the cached region information.
- Returns
- A vector of RegionInfo objects representing the cached regions.
◆ isPtrExecutable()
| bool KittyPtrValidator::isPtrExecutable |
( |
uintptr_t | ptr, |
|
|
size_t | len = sizeof(void *) ) |
Checks if a pointer is executable.
- Parameters
-
| ptr | The memory address to check. |
| len | The length of the memory range to check. |
- Returns
- true if the memory address is executable, false otherwise.
◆ isPtrInAddressSpace()
| bool KittyPtrValidator::isPtrInAddressSpace |
( |
uintptr_t | ptr | ) |
|
|
inline |
Checks if a pointer is within the address space of the current process.
- Parameters
-
| ptr | The memory address to check. |
- Returns
- true if the pointer is within the address space, false otherwise.
◆ isPtrReadable()
| bool KittyPtrValidator::isPtrReadable |
( |
uintptr_t | ptr, |
|
|
size_t | len = sizeof(void *) ) |
Checks if a pointer is readable.
- Parameters
-
| ptr | The memory address to check. |
| len | The length of the memory range to check. |
- Returns
- true if the memory address is readable, false otherwise.
◆ isPtrWritable()
| bool KittyPtrValidator::isPtrWritable |
( |
uintptr_t | ptr, |
|
|
size_t | len = sizeof(void *) ) |
Checks if a pointer is writable.
- Parameters
-
| ptr | The memory address to check. |
| len | The length of the memory range to check. |
- Returns
- true if the memory address is writable, false otherwise.
◆ setPID()
| void KittyPtrValidator::setPID |
( |
pid_t | pid | ) |
|
|
inline |
Sets the process ID to query memory regions.
- Parameters
-
| pid | The process ID to query. |
◆ setUseCache()
| void KittyPtrValidator::setUseCache |
( |
bool | use_cache | ) |
|
|
inline |
Sets whether to use cached region information.
- Parameters
-
| use_cache | True to use cached region information, false to clear the cache. |
The documentation for this class was generated from the following file: