* 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
| 4048 | * The map must be locked. A read lock is sufficient. |
| 4049 | */ |
| 4050 | boolean_t |
| 4051 | vm_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 | * |
no test coverage detected