From: deraadt Date: Fri, 7 Oct 2022 15:22:10 +0000 (+0000) Subject: Show the entry immutable bit in the various output formats. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e45a0bdddd6a729a29a3c310cbf49f2f08955afa;p=openbsd Show the entry immutable bit in the various output formats. --- diff --git a/usr.sbin/procmap/procmap.1 b/usr.sbin/procmap/procmap.1 index 03824a7bcef..8c72582101c 100644 --- a/usr.sbin/procmap/procmap.1 +++ b/usr.sbin/procmap/procmap.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: procmap.1,v 1.23 2018/03/31 17:26:13 otto Exp $ +.\" $OpenBSD: procmap.1,v 1.24 2022/10/07 15:22:10 deraadt Exp $ .\" $NetBSD: pmap.1,v 1.6 2003/01/19 21:25:43 atatat Exp $ .\" .\" Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: March 31 2018 $ +.Dd $Mdocdate: October 7 2022 $ .Dt PROCMAP 1 .Os .Sh NAME @@ -223,7 +223,7 @@ MAP 0xcf7cac84: [0x0-\*(Gt0xbfbfe000] #ent=8, sz=34041856, ref=1, version=20, flags=0x21 pmap=0xcf44cee0(resident=\*(Ltunknown\*(Gt) - 0xcfa3a358: 0x8048000-\*(Gt0x80b1000: obj=0xcf45a8e8/0x0, amap=0x0/0 - submap=F, cow=T, nc=T, prot(max)=5/7, inh=1, wc=0, adv=0 + submap=F, cow=T, nc=T, stack=F, syscall=F, immutable=F, prot(max)=5/7, inh=1, wc=0, adv=0 \&... .Ed .Pp @@ -274,17 +274,17 @@ file system appear as follows: .Bd -literal -offset indent $ procmap -m -0x8048000 0x80b1000 r-x rwx COW NC 1 0 0 -0x80b1000 0x80b3000 rw- rwx COW NC 1 0 0 -0x80b3000 0x80ba000 rw- rwx COW NNC 1 0 0 -0x80ba000 0x80be000 rwx rwx COW NNC 1 0 0 +0x8048000 0x80b1000 r-x--I rwx COW NC 1 0 0 +0xdecf000 0xd018000 r-x--I rwx COW NC 1 0 0 +0x80b1000 0x80b3000 rw---I rwx COW NC 1 0 0 +0x80b3000 0x80ba000 rw---I rwx COW NNC 1 0 0 +0x80ba000 0x80be000 rwx--I rwx COW NNC 1 0 0 \&... $ procmap -l -08048000-080b1000 r-xp 00000000 00:00 70173 /bin/sh -080b1000-080b3000 rw-p 00068000 00:00 70173 /bin/sh -080b3000-080ba000 rw-p 00000000 00:00 0 -080ba000-080be000 rwxp 00000000 00:00 0 +0x08048000 0x080b1000 r-x--Ip 00000000 00:00 70173 /bin/sh +0x080b1000 0x080b3000 rw---Ip 00068000 00:00 70173 /bin/sh +0x080b3000 0x080ba000 rw---Ip 00000000 00:00 0 \&... .Ed .Pp diff --git a/usr.sbin/procmap/procmap.c b/usr.sbin/procmap/procmap.c index 16a601eb073..e737990521e 100644 --- a/usr.sbin/procmap/procmap.c +++ b/usr.sbin/procmap/procmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procmap.c,v 1.69 2022/02/22 17:35:01 deraadt Exp $ */ +/* $OpenBSD: procmap.c,v 1.70 2022/10/07 15:22:10 deraadt Exp $ */ /* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */ /* @@ -497,7 +497,7 @@ process_map(kvm_t *kd, pid_t pid, struct kinfo_proc *proc, struct sum *sum) (int)sizeof(int) * 2 - 1, "Size "); #endif if (print_all) - printf("%-*s %-*s %*s %-*s rwxSepc RWX I/W/A Dev %*s - File\n", + printf("%-*s %-*s %*s %-*s rwxSeIpc RWX I/W/A Dev %*s - File\n", (int)sizeof(long) * 2, "Start", (int)sizeof(long) * 2, "End", (int)sizeof(int) * 2, "Size ", @@ -719,7 +719,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, name = findname(kd, vmspace, vme, vp, vfs, uvm_obj); if (print_map) { - printf("0x%-*lx 0x%-*lx %c%c%c%c%c %c%c%c %s %s %d %d %d", + printf("0x%-*lx 0x%-*lx %c%c%c%c%c%c %c%c%c %s %s %d %d %d", (int)sizeof(long) * 2 + 0, vme->start, (int)sizeof(long) * 2 + 0, vme->end, (vme->protection & PROT_READ) ? 'r' : '-', @@ -727,6 +727,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, (vme->protection & PROT_EXEC) ? 'x' : '-', (vme->etype & UVM_ET_STACK) ? 'S' : '-', (vme->etype & UVM_ET_SYSCALL) ? 'e' : '-', + (vme->etype & UVM_ET_IMMUTABLE) ? 'I' : '-', (vme->max_protection & PROT_READ) ? 'r' : '-', (vme->max_protection & PROT_WRITE) ? 'w' : '-', (vme->max_protection & PROT_EXEC) ? 'x' : '-', @@ -746,7 +747,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, } if (print_maps) - printf("0x%-*lx 0x%-*lx %c%c%c%c%c%c %0*lx %02x:%02x %llu %s\n", + printf("0x%-*lx 0x%-*lx %c%c%c%c%c%c%c %0*lx %02x:%02x %llu %s\n", (int)sizeof(void *) * 2, vme->start, (int)sizeof(void *) * 2, vme->end, (vme->protection & PROT_READ) ? 'r' : '-', @@ -754,6 +755,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, (vme->protection & PROT_EXEC) ? 'x' : '-', (vme->etype & UVM_ET_STACK) ? 'S' : '-', (vme->etype & UVM_ET_SYSCALL) ? 'e' : '-', + (vme->etype & UVM_ET_IMMUTABLE) ? 'I' : '-', (vme->etype & UVM_ET_COPYONWRITE) ? 'p' : 's', (int)sizeof(void *) * 2, (unsigned long)vme->offset, @@ -767,13 +769,14 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, vme->object.uvm_obj, (unsigned long)vme->offset, vme->aref.ar_amap, vme->aref.ar_pageoff); printf("\tsubmap=%c, cow=%c, nc=%c, stack=%c, " - "syscall=%c, prot(max)=%d/%d, inh=%d, " + "syscall=%c, immutable=%c, prot(max)=%d/%d, inh=%d, " "wc=%d, adv=%d\n", (vme->etype & UVM_ET_SUBMAP) ? 'T' : 'F', (vme->etype & UVM_ET_COPYONWRITE) ? 'T' : 'F', (vme->etype & UVM_ET_NEEDSCOPY) ? 'T' : 'F', (vme->etype & UVM_ET_STACK) ? 'T' : 'F', (vme->etype & UVM_ET_SYSCALL) ? 'T' : 'F', + (vme->etype & UVM_ET_IMMUTABLE) ? 'T' : 'F', vme->protection, vme->max_protection, vme->inheritance, vme->wired_count, vme->advice); if (inode && verbose) @@ -813,7 +816,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, } sz = (size_t)((vme->end - vme->start) / 1024); - printf("%0*lx-%0*lx %7luk %0*lx %c%c%c%c%c%c%c (%c%c%c) %d/%d/%d %02u:%02u %7llu - %s", + printf("%0*lx-%0*lx %7luk %0*lx %c%c%c%c%c%c%c%c (%c%c%c) %d/%d/%d %02u:%02u %7llu - %s", (int)sizeof(void *) * 2, vme->start, (int)sizeof(void *) * 2, vme->end - (vme->start != vme->end ? 1 : 0), (unsigned long)sz, (int)sizeof(void *) * 2, (unsigned long)vme->offset, @@ -822,6 +825,7 @@ dump_vm_map_entry(kvm_t *kd, struct kbit *vmspace, (vme->protection & PROT_EXEC) ? 'x' : '-', (vme->etype & UVM_ET_STACK) ? 'S' : '-', (vme->etype & UVM_ET_SYSCALL) ? 'e' : '-', + (vme->etype & UVM_ET_IMMUTABLE) ? 'I' : '-', (vme->etype & UVM_ET_COPYONWRITE) ? 'p' : 's', (vme->etype & UVM_ET_NEEDSCOPY) ? '+' : '-', (vme->max_protection & PROT_READ) ? 'r' : '-',