freebsd-dev/lib/libprocstat
Conrad Meyer e6b95927f3 Fix core corruption caused by race in note_procstat_vmmap
This fix is spiritually similar to r287442 and was discovered thanks to
the KASSERT added in that revision.

NT_PROCSTAT_VMMAP output length, when packing kinfo structs, is tied to
the length of filenames corresponding to vnodes in the process' vm map
via vn_fullpath.  As vnodes may move during coredump, this is racy.

We do not remove the race, only prevent it from causing coredump
corruption.

- Add a sysctl, kern.coredump_pack_vmmapinfo, to allow users to disable
  kinfo packing for PROCSTAT_VMMAP notes.  This avoids VMMAP corruption
  and truncation, even if names change, at the cost of up to PATH_MAX
  bytes per mapped object.  The new sysctl is documented in core.5.

- Fix note_procstat_vmmap to self-limit in the second pass.  This
  addresses corruption, at the cost of sometimes producing a truncated
  result.

- Fix PROCSTAT_VMMAP consumers libutil (and libprocstat, via copy-paste)
  to grok the new zero padding.

Reported by:	pho (https://people.freebsd.org/~pho/stress/log/datamove4-2.txt)
Relnotes:	yes
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3824
2015-10-06 18:07:00 +00:00
..
zfs Add META_MODE support. 2015-06-13 19:20:56 +00:00
cd9660.c Don't cast inode number or file size down to long or unsigned. 2012-05-18 10:15:46 +00:00
common_kvm.c Don't cast inode number or file size down to long or unsigned. 2012-05-18 10:15:46 +00:00
common_kvm.h - Trim an unused and bogus Makefile for mount_smbfs. 2013-06-28 21:00:08 +00:00
core.c Embed revision id in the library. 2013-04-21 17:10:10 +00:00
core.h Add procstat_getauxv function to retrieve a process auxiliary vector. 2013-04-20 08:10:47 +00:00
libprocstat_internal.h Extend libprocstat with functions to retrieve process command line 2013-04-20 08:07:04 +00:00
libprocstat.3 Create links to the libprocstat man pages for all of the libprocstat functions so they can be looked up by name 2015-05-21 03:32:44 +00:00
libprocstat.c Fix core corruption caused by race in note_procstat_vmmap 2015-10-06 18:07:00 +00:00
libprocstat.h Change the cap_rights_t type from uint64_t to a structure that we can extend 2013-09-05 00:09:56 +00:00
Makefile Create links to the libprocstat man pages for all of the libprocstat functions so they can be looked up by name 2015-05-21 03:32:44 +00:00
Makefile.depend Add META_MODE support. 2015-06-13 19:20:56 +00:00
msdosfs.c
smbfs.c
Symbol.map Similar to 233760 and 236717, export some more useful info about the 2013-05-03 21:11:57 +00:00
udf.c Do not include buf.h. 2014-11-23 10:26:28 +00:00
Versions.def Export some more useful info about shared memory objects to userland 2012-04-01 18:22:48 +00:00
zfs.c