[Bug 273956] KERN_PROC_VMMAP does not read all mapped files

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 20 Sep 2023 21:20:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273956

--- Comment #10 from Ed Maste <emaste@freebsd.org> ---
Interesting - I made a little program that uses KERN_PROC_VMMAP and dumps its
own map. When I run it normally I see the 4th PT_LOAD as swap:

$ ./a.out
 1 0x0000000000200000 - 0x0000000000201000 (0x00001000) r-- vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 2 0x0000000000201000 - 0x0000000000202000 (0x00001000) r-x vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 3 0x0000000000202000 - 0x0000000000203000 (0x00001000) r-- vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 4 0x0000000000203000 - 0x0000000000204000 (0x00001000) rw- swap
 5 0x0000000800dca000 - 0x0000000820daa000 (0x1ffe0000) --- guard
 6 0x0000000820daa000 - 0x0000000820dca000 (0x00020000) rw- swap

If I use rtld's exec mode the PT_LOAD is vnode:

$ /libexec/ld-elf.so.1 ./a.out 
 1 0x0000000000200000 - 0x0000000000201000 (0x00001000) r-- vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 2 0x0000000000201000 - 0x0000000000202000 (0x00001000) r-x vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 3 0x0000000000202000 - 0x0000000000203000 (0x00001000) r-- vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 4 0x0000000000203000 - 0x0000000000204000 (0x00001000) rw- vnode
  File:  /usr/home/emaste/src/freebsd-git/main/a.out
 5 0x000039b4b379c000 - 0x000039b4b37a2000 (0x00006000) r-- vnode
  File:  /libexec/ld-elf.so.1
 6 0x000039b4b37a2000 - 0x000039b4b37ba000 (0x00018000) r-x vnode
  File:  /libexec/ld-elf.so.1
...

-- 
You are receiving this mail because:
You are the assignee for the bug.