Skip to content

Using the peculiar behaviour of the VPGATHER instructions to determine if an address will fault before it is truly accessed. All done in user-mode.

Notifications You must be signed in to change notification settings

Peribunt/VPGATHER

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

VPGATHER

Using the peculiar behaviour of the VPGATHER instructions to determine if an address will fault before it is truly accessed. All done in user-mode.

Usage Example

#include <Windows.h>
#include "Vpgather.h"

/**
 * @brief Program main subroutine
 * 
 * @param [in] Argc: The number of arguments supplied to the running program
 * @param [in] Argv: A pointer to a list of arguments supplied to the running program, including the name.
 */
LONG
main( 
	_In_ ULONG   Argc, 
	_In_ LPCSTR* Argv 
	)
{
	//
	// Add a vectored exception handler to handle VPGATHER related exceptions.
	//
	AddVectoredExceptionHandler( TRUE, VpgExceptionHandler );

	//
	// This address should never be accessible
	//
	if ( VpgIsAddressAccessible( ( LPVOID )0x1333333333333337 ) == FALSE )
	{
		printf( "0x1333333333333337 is not accessible!\n" );
	}

	//
	// This address should be accessible
	//
	if ( VpgIsAddressAccessible( main ) == TRUE )
	{
		printf( "%p is accessible!\n", main );
	}

	return 0l;
}

Credits

Full credit to @sixtyvividtails for bringing this behavior to people's attention, including mine.

About

Using the peculiar behaviour of the VPGATHER instructions to determine if an address will fault before it is truly accessed. All done in user-mode.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published