git: a097a58543dc - stable/13 - fork: Copy the vm_stacktop field into the new vmspace

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 16 Feb 2022 17:59:16 UTC
The branch stable/13 has been updated by markj:

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

commit a097a58543dc86354f8979a276093e90000a4bbd
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-01-18 15:42:21 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-02-16 16:55:11 +0000

    fork: Copy the vm_stacktop field into the new vmspace
    
    Fixes:  1811c1e957ee ("exec: Reimplement stack address randomization")
    Reported by:    pho
    Reported by:    syzbot+0446312a51bc13ead834@syzkaller.appspotmail.com
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 46d35d415aa9664b0ddc98a76e453eec20af0016)
---
 sys/vm/vm_map.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index cf2c96f9ab73..4c3448c358da 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -4265,6 +4265,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_charge)
 	vm2->vm_taddr = vm1->vm_taddr;
 	vm2->vm_daddr = vm1->vm_daddr;
 	vm2->vm_maxsaddr = vm1->vm_maxsaddr;
+	vm2->vm_stacktop = vm1->vm_stacktop;
 	vm_map_lock(old_map);
 	if (old_map->busy)
 		vm_map_wait_busy(old_map);