git: 32b3b01083ce - stable/14 - ptrace(PT_VM_ENTRY): report max protection

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 15 Oct 2024 15:05:30 UTC
The branch stable/14 has been updated by kib:

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

commit 32b3b01083ce4e7d8df4200ecb2ef21e4a2763b7
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-07 07:53:18 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-15 14:50:16 +0000

    ptrace(PT_VM_ENTRY): report max protection
    
    (cherry picked from commit e90b2b7d6c173e27dccdb894bb4e34ad30273e22)
---
 sys/kern/sys_process.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 647487f86b02..a45d5b065382 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -37,6 +37,7 @@
 #include <sys/ktr.h>
 #include <sys/limits.h>
 #include <sys/lock.h>
+#include <sys/mman.h>
 #include <sys/mutex.h>
 #include <sys/reg.h>
 #include <sys/syscallsubr.h>
@@ -517,7 +518,8 @@ ptrace_vm_entry(struct thread *td, struct proc *p, struct ptrace_vm_entry *pve)
 		pve->pve_start = entry->start;
 		pve->pve_end = entry->end - 1;
 		pve->pve_offset = entry->offset;
-		pve->pve_prot = entry->protection;
+		pve->pve_prot = entry->protection |
+		    PROT_MAX(entry->max_protection);
 
 		/* Backing object's path needed? */
 		if (pve->pve_pathlen == 0)