freebsd-dev/share/man/man5
Conrad Meyer 14bdbaf2e4 Detect badly behaved coredump note helpers
Coredump notes depend on being able to invoke dump routines twice; once
in a dry-run mode to get the size of the note, and another to actually
emit the note to the corefile.

When a note helper emits a different length section the second time
around than the length it requested the first time, the kernel produces
a corrupt coredump.

NT_PROCSTAT_FILES output length, when packing kinfo structs, is tied to
the length of filenames corresponding to vnodes in the process' fd table
via vn_fullpath.  As vnodes may move around during dump, this is racy.

So:

 - Detect badly behaved notes in putnote() and pad underfilled notes.

 - Add a fail point, debug.fail_point.fill_kinfo_vnode__random_path to
   exercise the NT_PROCSTAT_FILES corruption.  It simply picks random
   lengths to expand or truncate paths to in fo_fill_kinfo_vnode().

 - Add a sysctl, kern.coredump_pack_fileinfo, to allow users to
   disable kinfo packing for PROCSTAT_FILES notes.  This should avoid
   both FILES note corruption and truncation, even if filenames change,
   at the cost of about 1 kiB in padding bloat per open fd.  Document
   the new sysctl in core.5.

 - Fix note_procstat_files to self-limit in the 2nd pass.  Since
   sometimes this will result in a short write, pad up to our advertised
   size.  This addresses note corruption, at the risk of sometimes
   truncating the last several fd info entries.

 - Fix NT_PROCSTAT_FILES consumers libutil and libprocstat to grok the
   zero padding.

With suggestions from:	bjk, jhb, kib, wblock
Approved by:	markj (mentor)
Relnotes:	yes
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3548
2015-09-03 20:32:10 +00:00
..
a.out.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
acct.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
ar.5 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
autofs.5 Update the autofs(5) manual to reflect it first appeared in 2014-09-03 17:15:12 +00:00
bluetooth.device.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
bluetooth.hosts.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
bluetooth.protocols.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
boot.config.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
core.5 Detect badly behaved coredump note helpers 2015-09-03 20:32:10 +00:00
devfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
devfs.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
devfs.rules.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
device.hints.5 Document the fact that tunables can be set in device.hints. 2015-07-23 17:27:10 +00:00
dir.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
disktab.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
elf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
ethers.5
eui64.5
ext2fs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
fbtab.5
fdescfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
forward.5
freebsd-update.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
fs.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
fstab.5 Allow to disable BIO_DELETE passthru in fstab for swap-on-geli devices by 2015-08-08 09:57:38 +00:00
group.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
hesiod.conf.5
hosts.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
hosts.equiv.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
hosts.lpd.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
intro.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
libmap.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
link.5
linprocfs.5
linsysfs.5
mailer.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
make.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
Makefile Add MK_AUTOFS knob for building and installing autofs(4), et al 2015-01-26 07:15:49 +00:00
Makefile.depend Add META_MODE support. 2015-06-13 19:20:56 +00:00
moduli.5 Import an updated version of moduli(5) manual page from OpenBSD. 2012-07-20 01:11:53 +00:00
motd.5
mqueuefs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
msdosfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
nandfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
networks.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
nsmb.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
nsswitch.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
nullfs.5 Fix a rendering issue in the nullfs(5) manual page. 2015-02-10 18:49:13 +00:00
passwd.5 Correct the document date for last change. 2014-06-05 01:58:21 +00:00
pbm.5
periodic.conf.5 Allow additional flags to be passed to netstat -i in the daily status check. 2015-03-27 00:37:41 +00:00
pf.conf.5 pf: Remove support for 'scrub fragment crop|drop-ovl' 2015-08-27 21:27:47 +00:00
pf.os.5 Various mdoc fixes. 2014-12-21 12:13:49 +00:00
phones.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
portindex.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
portsnap.conf.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
procfs.5 Update description of process status output. 2013-04-22 20:14:57 +00:00
protocols.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
quota.user.5 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
rc.conf.5 Tweak the "rctl_enable" description to not give the impression 2015-08-23 13:51:06 +00:00
rctl.conf.5 Add manual page for rctl.conf(5). 2011-04-14 18:37:27 +00:00
regdomain.5
reiserfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00
remote.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
resolver.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
services.5 Various mdoc fixes. 2014-12-21 12:13:49 +00:00
shells.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
src.conf.5 Regen src.conf.5 per r286822 2015-08-16 10:10:58 +00:00
stab.5 multiple: Remove 3rd clause from BSD license where approved by the 2014-03-14 03:07:51 +00:00
style.Makefile.5 mdoc: Remove tabs in non-literal context. 2012-03-26 16:40:45 +00:00
sysctl.conf.5
tmpfs.5 use .Mt to mark up email addresses consistently (part6) 2014-06-23 08:27:27 +00:00