BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / c38b2e574ec03c555fe7e03a31d9ebaa3d5b894b / memory / user.c

// Related

Nucleus

Barry Page functions + User memory functions 73145c0 (3 years, 3 months ago)
/*
 * This file handles safely getting data from userspace for the kernel.  This is
 * for security reasons to prevent the user from tricking a syscall into
 * manipulating/leaking kernel data structures.  User memory is defined as any
 * address range that completely sits in a Virtual Memory Region.
 */

#include <nucleus/memory.h>

/* Check if user has access to a region of memory */
int
verify_access(const void *addr, size_t len, int prot)
{
	/*
	 * This should iterate all memory regions to check if the address range
	 * fits inside one, if not then access should be denied.  If a matching
	 * region is found, the prot parameter should be checked against the
	 * protection value for that region.  If this function is called from
	 * the kernel directly, or the user did not pass an address or a length
	 * (NULL and 0, respectively), then it should just grant access
	 * immediately.  This can be implemented when userspace is implemented.
	 */
	return 1;
}