/* * 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 /* 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; }