git: 596c93a96ec8 - stable/13 - vmspace_fork(): do not override offset for the guard entries

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 25 Aug 2023 01:08:27 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=596c93a96ec82f7d1132030f9c86a7de27584458

commit 596c93a96ec82f7d1132030f9c86a7de27584458
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-07-20 17:45:01 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-08-25 01:06:43 +0000

    vmspace_fork(): do not override offset for the guard entries
    
    (cherry picked from commit db6c7c7f8d870f377fcd1cc98e4832681bb5bdf0)
---
 sys/vm/vm_map.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index c8f3c72302fc..18763ad2f2bf 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -4178,7 +4178,8 @@ vm_map_copy_entry(
 			    src_entry->start);
 		} else {
 			dst_entry->object.vm_object = NULL;
-			dst_entry->offset = 0;
+			if ((dst_entry->eflags & MAP_ENTRY_GUARD) == 0)
+				dst_entry->offset = 0;
 			if (src_entry->cred != NULL) {
 				dst_entry->cred = curthread->td_ucred;
 				crhold(dst_entry->cred);