From d7278d1176391dc717293111042c3fcb56e6ca85 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 4 Jan 2021 01:53:01 +0100 Subject: vm_map: Avoid linking gaps for vm_copy_t This does not make sense, and produces incorrect results (since vme_end is 0, etc.) * vm/vm_map.h (_vm_map_clip_start, _vm_map_clip_end): Add link_gap parameter. * vm/vm_map.c (_vm_map_entry_link): Add link_gap parameter, do not call vm_map_gap_insert if it is 0. (vm_map_entry_link): Set link_gap to 1 in _vm_map_entry_link call. (_vm_map_clip_start): Add link_gap parameter, pass it to _vm_map_entry_link call.. (vm_map_clip_start): Set link_gap_to 1 in _vm_map_clip_start call. (vm_map_copy_entry_link): Set link_gap to 0 in _vm_map_entry_link call. (vm_map_copy_clip_start): Set link_gap_to 0 in _vm_map_clip_start call. (_vm_map_entry_unlink): Add unlink_gap parameter, do not call vm_map_gap_remove if it is 0. (vm_map_entry_unlink): Set unlink_gap to 1 in _vm_map_entry_unlink call. (_vm_map_clip_end): Add link_gap parameter, pass it to _vm_map_entry_link call.. (vm_map_clip_end): Set link_gap_to 1 in _vm_map_clip_end call. (vm_map_copy_entry_unlink): Set unlink_gap to 0 in _vm_map_entry_unlink call. (vm_map_copy_clip_end): Set link_gap_to 0 in _vm_map_clip_end call. * vm/vm_kern.c (projected_buffer_deallocate): set link_gap to 1 in _vm_map_clip_start and _vm_map_clip_end calls. --- vm/vm_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vm/vm_kern.c') diff --git a/vm/vm_kern.c b/vm/vm_kern.c index 8ecd2ed9..705b0acb 100644 --- a/vm/vm_kern.c +++ b/vm/vm_kern.c @@ -271,9 +271,9 @@ projected_buffer_deallocate( /*Prepare for deallocation*/ if (entry->vme_start < start) - _vm_map_clip_start(&map->hdr, entry, start); + _vm_map_clip_start(&map->hdr, entry, start, 1); if (entry->vme_end > end) - _vm_map_clip_end(&map->hdr, entry, end); + _vm_map_clip_end(&map->hdr, entry, end, 1); if (map->first_free == entry) /*Adjust first_free hint*/ map->first_free = entry->vme_prev; entry->projected_on = 0; /*Needed to allow deletion*/ -- cgit v1.2.3