freebsd kernel with SKQ
Go to file
mav ed042b9725 MFC r287283 (by delphij):
Fix a buffer overrun which may lead to data corruption, introduced in
r286951 by reinstating changes in r274628.

In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
data in 'cdata', allocated of l2hdr->b_asize bytes.

We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
which is of l2hdr->b_asize bytes, and have the compressed size (or original
size, if compress didn't gain enough) stored in csize.

To pad the buffer to fit the optimal write size, we round up the compressed
size to L2 device's vdev_ashift.

Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
we are guaranteed that the rounded up csize would be <= b_asize. However,
this is not necessarily true when we round up to 1 << vdev_ashift, because
it could be larger than SPA_MINBLOCKSIZE.

So, in the worst case scenario, we are overwriting at most

        (1 << vdev_ashift - SPA_MINBLOCKSIZE)

bytes of memory next to the compressed data buffer.

Andriy's original change in r274628 reorganized the code a little bit,
by moving the padding to after we determined that the compression was
beneficial.  At which point, we would check rounded size against the
allocated buffer size, and the buffer overrun would not be possible.
2015-10-03 11:24:47 +00:00
bin MFC r287237: Respect locale settings. 2015-09-14 17:57:01 +00:00
cddl MFC r286708: 5959 clean up per-dataset feature count code 2015-10-03 08:05:33 +00:00
contrib MFC r256692: Fix .debug_line prologue header length calculation for 64-bit DWARF 2015-09-24 19:33:35 +00:00
crypto MFC: Fix OpenSSH multiple vulnerabilities. 2015-08-25 20:48:44 +00:00
etc MFC r279248: Unconditionally install debug directory hierarchy 2015-09-24 20:56:26 +00:00
games MFC r283929: Correct grdc(1) 12-hour display between 12:00 and 13:00 2015-09-24 19:37:34 +00:00
gnu MFC r285041: 2015-08-05 07:21:44 +00:00
include MFC r275805: 2015-04-30 16:08:47 +00:00
kerberos5 MFC r287208, r287216: 2015-09-03 11:33:33 +00:00
lib MFC 286177: 2015-10-01 21:57:15 +00:00
libexec MFC r287369: 2015-09-08 12:00:13 +00:00
release MFC r288374: 2015-10-02 02:08:40 +00:00
rescue MFC sa(4) and mt(1) improvements. 2015-03-24 14:36:10 +00:00
sbin MFC r281787 2015-10-02 14:24:39 +00:00
secure MFC: r285329 2015-07-09 17:17:22 +00:00
share MFC r281785 2015-10-02 14:21:07 +00:00
sys MFC r287283 (by delphij): 2015-10-03 11:24:47 +00:00
tests MFC 287448: 2015-10-01 22:19:41 +00:00
tools MFC r287935: 2015-09-29 21:45:23 +00:00
usr.bin MFC 283624,283630: 2015-10-01 17:09:20 +00:00
usr.sbin Fix a regression with SA-15:24 patch that prevented NIS from 2015-10-02 16:36:16 +00:00
COPYRIGHT MFC r276462: 2014-12-31 10:03:19 +00:00
LOCKS Explicitly require Security Officer's approval for kernel PRNG bits. 2013-09-17 14:19:05 +00:00
MAINTAINERS MFH (r263160): remove lukemftpd 2014-08-23 15:07:09 +00:00
Makefile MFC r270155, r274490, r274593, r274607 2015-04-21 17:02:55 +00:00
Makefile.inc1 MFC r262670 (marcel): 2015-08-13 22:29:26 +00:00
ObsoleteFiles.inc MFC r257077: 2015-08-11 16:01:34 +00:00
README
UPDATING MFC r286469, r286591, r286595, r286596, r286613: 2015-08-23 17:07:23 +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, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
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, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
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 sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


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.

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