1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
Mirror of the FreeBSD src repository https://git.FreeBSD.org/src.git .
Go to file
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
bin sh: Allow empty << EOF markers. 2015-09-02 19:49:55 +00:00
cddl Remove duplicate defines introduced in initial ZFS import (r168404) 2015-08-31 22:36:17 +00:00
contrib Fix t_spawnattr test for attributes handling by posix_spawn(3). 2015-09-01 12:47:11 +00:00
crypto Fix OpenSSH multiple vulnerabilities by backporting three changes 2015-08-25 20:48:37 +00:00
etc Add iwm(4), that was missing in r287394. 2015-09-02 14:38:16 +00:00
games Fix a typo. 2015-07-02 11:46:35 +00:00
gnu Remove .WAIT hacks and put in specific dependencies. 2015-08-28 16:23:03 +00:00
include Use bool rather than _Bool for C++ compatibility. 2015-08-19 18:32:12 +00:00
kerberos5 Move setting of LDFLAGS to the modules which require it actually, as 2015-08-27 17:16:18 +00:00
lib Detect badly behaved coredump note helpers 2015-09-03 20:32:10 +00:00
libexec Fix how we place each objects thread local data. The code used was based 2015-09-01 15:57:03 +00:00
release Remove '-' separating OSRELEASE and SNAPSHOT_DATE for vagrant 2015-09-01 15:28:35 +00:00
rescue
sbin The dumpfs(8) utility doesn't actually use disktab(5); remove it 2015-09-03 11:40:47 +00:00
secure Merge OpenSSL 1.0.1p. 2015-07-09 17:07:45 +00:00
share Detect badly behaved coredump note helpers 2015-09-03 20:32:10 +00:00
sys Detect badly behaved coredump note helpers 2015-09-03 20:32:10 +00:00
targets Roll WITHOUT_ELFTOOLCHAIN_TOOLS into WITHOUT_TOOLCHAIN 2015-08-13 17:50:47 +00:00
tests Add various tests to ensure that invalid arguments passed to mmap() 2015-08-06 16:14:29 +00:00
tools oops - mis-commit. 2015-08-30 21:55:01 +00:00
usr.bin Rename YP to NIS in the manpages. 2015-09-03 07:18:52 +00:00
usr.sbin Use proper term in the ctld(8) and iscsid(8) man pages. 2015-09-03 11:43:56 +00:00
.arcconfig Add repository.callsign, to help arcanist figure out what repo it's 2015-07-02 22:23:52 +00:00
.arclint
COPYRIGHT
LOCKS
MAINTAINERS
Makefile Fix generation of src.conf.5 2015-07-03 06:10:09 +00:00
Makefile.inc1 The ${BUILDKERNELS:[2..-1]} appears to produce a non zero result for 2015-09-02 15:42:14 +00:00
ObsoleteFiles.inc Belatedly add entries for libugidfw.so.4 to catch up with r284745. 2015-08-26 18:22:59 +00:00
README
UPDATING Add reminder to run etcupdate or mergemaster to get updated 2015-08-29 07:59:31 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree.  See build(7)
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The `buildkernel` and `installkernel` targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process.  See build(7), config(8),
and http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
for more information.

Note: If you want to build and install the kernel with the
`buildkernel` and `installkernel` targets, you might need to build
world before.  More information is available in the handbook.

The kernel configuration files reside in the sys/<arch>/conf
sub-directory.  GENERIC is the default configuration used in release builds.
NOTES contains entries and documentation for all possible
devices, not just those commonly used.


Source Roadmap:
---------------

bin		System/user commands.

cddl		Various commands and libraries under the Common Development
		and Distribution License.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tests		Regression tests which can be run by Kyua.  See tests/README
		for additional information.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html