git: b96ca29b6248 - stable/13 - vm_map.c: plug several more places which might modify entry->offset
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Aug 2023 01:08:39 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b96ca29b62488f50c468b964ee684e6d0245b2ee commit b96ca29b62488f50c468b964ee684e6d0245b2ee Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2023-08-15 19:05:33 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2023-08-25 01:06:44 +0000 vm_map.c: plug several more places which might modify entry->offset (cherry picked from commit c718009884b3d65528deaff24712cbf98e3be656) --- sys/vm/vm_map.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 029605eb272a..d046cd34afea 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -1413,7 +1413,9 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) KASSERT(entry->end < root->end, ("%s: clip_start not within entry", __func__)); vm_map_splay_findprev(root, &llist); - root->offset += entry->end - root->start; + if ((root->eflags & (MAP_ENTRY_STACK_GAP_DN | + MAP_ENTRY_STACK_GAP_UP)) == 0) + root->offset += entry->end - root->start; root->start = entry->end; max_free_left = vm_map_splay_merge_pred(header, entry, llist); max_free_right = root->max_free = vm_size_max( @@ -1429,7 +1431,9 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) KASSERT(entry->end == root->end, ("%s: clip_start not within entry", __func__)); vm_map_splay_findnext(root, &rlist); - entry->offset += entry->start - root->start; + if ((entry->eflags & (MAP_ENTRY_STACK_GAP_DN | + MAP_ENTRY_STACK_GAP_UP)) == 0) + entry->offset += entry->start - root->start; root->end = entry->start; max_free_left = root->max_free = vm_size_max( vm_map_splay_merge_left(header, root, llist), @@ -1463,6 +1467,8 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry, vm_map_splay_findnext(root, &rlist); if (op == UNLINK_MERGE_NEXT) { rlist->start = root->start; + MPASS((rlist->eflags & (MAP_ENTRY_STACK_GAP_DN | + MAP_ENTRY_STACK_GAP_UP) == 0); rlist->offset = root->offset; } if (llist != header) { @@ -3100,7 +3106,8 @@ vm_map_madvise( entry = vm_map_entry_succ(entry)) { vm_offset_t useEnd, useStart; - if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0) + if ((entry->eflags & (MAP_ENTRY_IS_SUB_MAP | + MAP_ENTRY_GUARD)) != 0) continue; /*