Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/sys_process.c
Show First 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve) | ||||
error = 0; | error = 0; | ||||
obj = NULL; | obj = NULL; | ||||
vm = vmspace_acquire_ref(p); | vm = vmspace_acquire_ref(p); | ||||
map = &vm->vm_map; | map = &vm->vm_map; | ||||
vm_map_lock_read(map); | vm_map_lock_read(map); | ||||
do { | do { | ||||
entry = map->header.next; | KASSERT((map->header.eflags & MAP_ENTRY_IS_SUB_MAP) == 0, | ||||
("Submap in map header")); | |||||
index = 0; | index = 0; | ||||
while (index < pve->pve_entry && entry != &map->header) { | VM_MAP_ENTRY_FOREACH(entry, map) { | ||||
entry = entry->next; | if (index >= pve->pve_entry && | ||||
(entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) | |||||
alc: I'm not sure that I see the point of checking the header repeatedly for an erroneous submap… | |||||
Done Inline ActionsThe origin of the KASSERT is https://reviews.freebsd.org/D14005 dougm: The origin of the KASSERT is https://reviews.freebsd.org/D14005
| |||||
Done Inline ActionsI'll change the "repeated" checking to make it one-time. dougm: I'll change the "repeated" checking to make it one-time. | |||||
break; | |||||
index++; | index++; | ||||
} | } | ||||
if (index != pve->pve_entry) { | if (index < pve->pve_entry) { | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | |||||
KASSERT((map->header.eflags & MAP_ENTRY_IS_SUB_MAP) == 0, | |||||
("Submap in map header")); | |||||
while ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) { | |||||
entry = entry->next; | |||||
index++; | |||||
} | } | ||||
if (entry == &map->header) { | if (entry == &map->header) { | ||||
error = ENOENT; | error = ENOENT; | ||||
break; | break; | ||||
} | } | ||||
/* We got an entry. */ | /* We got an entry. */ | ||||
pve->pve_entry = index + 1; | pve->pve_entry = index + 1; | ||||
▲ Show 20 Lines • Show All 1,146 Lines • Show Last 20 Lines |
I'm not sure that I see the point of checking the header repeatedly for an erroneous submap flag. But more generally, I can't make any sense out of the submap handling. Has this changed in the last year or so?