MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_map_check_protection

Function vm_map_check_protection

freebsd/vm/vm_map.c:4050–4077  ·  view source on GitHub ↗

* vm_map_check_protection: * * Assert that the target map allows the specified privilege on the * entire address region given. The entire region must be allocated. * * WARNING! This code does not and should not check whether the * contents of the region is accessible. For example a smaller file * might be mapped into a larger address space. * * NOTE! This code is also called by munmap

Source from the content-addressed store, hash-verified

4048 * The map must be locked. A read lock is sufficient.
4049 */
4050boolean_t
4051vm_map_check_protection(vm_map_t map, vm_offset_t start, vm_offset_t end,
4052 vm_prot_t protection)
4053{
4054 vm_map_entry_t entry;
4055 vm_map_entry_t tmp_entry;
4056
4057 if (!vm_map_lookup_entry(map, start, &tmp_entry))
4058 return (FALSE);
4059 entry = tmp_entry;
4060
4061 while (start < end) {
4062 /*
4063 * No holes allowed!
4064 */
4065 if (start < entry->start)
4066 return (FALSE);
4067 /*
4068 * Check protection associated with entry.
4069 */
4070 if ((entry->protection & protection) != protection)
4071 return (FALSE);
4072 /* go to next entry */
4073 start = entry->end;
4074 entry = vm_map_entry_succ(entry);
4075 }
4076 return (TRUE);
4077}
4078
4079/*
4080 *

Callers 4

proc_rwmemFunction · 0.85
kernaccFunction · 0.85
useraccFunction · 0.85
kern_munmapFunction · 0.85

Calls 2

vm_map_lookup_entryFunction · 0.85
vm_map_entry_succFunction · 0.85

Tested by

no test coverage detected