Commit Graph

208797 Commits

Author SHA1 Message Date
Andrey V. Elsukov
23a6c7330c Fix bug in filling and handling ipfw's O_DSCP opcode.
Due to integer overflow CS4 token was handled as BE.

PR:		207459
MFC after:	1 week
2016-02-24 13:16:03 +00:00
Andrey V. Elsukov
b833ff5ab4 Fix useless check. m_pkthdr.len should be equal to orglen.
MFC after:	2 weeks
2016-02-24 12:28:49 +00:00
Konstantin Belousov
abb8f08388 Return dst as the result from memcpy(9) on amd64.
PR:	207422
MFC after:	1 week
2016-02-24 11:58:15 +00:00
Ed Schouten
c0af8d16d8 Call cap_rights_init() properly.
Even though or'ing the individual rights works in this specific case, it
may not work in general. Pass them in as varargs.
2016-02-24 10:54:26 +00:00
Sepherosa Ziehau
600d84765f hyperv/vmbus: Use free(9) for interrupt page; it is allocated by malloc(9)
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5417
2016-02-24 08:54:50 +00:00
Wojciech Macek
fb05500b24 Make pci_host_generic and thunderx_pci common
* provided OFW interface for pci_host_generic (for handling devices which are present in DTS under the PCI node)
  * removed support for internal PCI from arm64/cavium
  * cleaned up and made most of the code common

Obtained from:         Semihalf
Sponsored by:          Cavium
Approved by:           cognet (mentor)
Reviewed by:           zbb
Differential revision: https://reviews.freebsd.org/D5261
2016-02-24 06:05:30 +00:00
Maxim Sobolev
a97562ad6c o kill few remaining references to the GEOM_UNCOMPRESS;
o add GEOM_UZIP_DEBUG.
2016-02-24 05:17:52 +00:00
Maxim Sobolev
3c3cbe9cf4 Kill few remaininng instances of GEOM_UNCOMPRESS. 2016-02-24 05:16:24 +00:00
Sepherosa Ziehau
0bc2abddc8 hyperv/utils: Code rearrange and cleanup
Split heartbeat, shutdown and timesync out of utils code
and name them properly.

Submitted by:	Jun Su <junsu microsoft com>
Reviewed by:	adrian, sephe, Hongjiang Zhang <honzhan microsoft com>
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5216
2016-02-24 05:01:18 +00:00
Adrian Chadd
dc2e095538 Migrate UNCOMPRESS -> UZIP 2016-02-24 03:06:26 +00:00
Adrian Chadd
443a0f85dd Fixes to make it compile under gcc-4.2. 2016-02-24 02:52:49 +00:00
Kirk McKusick
24b6748c42 The UFS filesystem requires that the last block of a file always be
allocated. When shortening the length of a file in which the new end
of the file contains a hole, the hole must have a block allocated.

Reported by: Maxim Sobolev
Reviewed by: kib
Tested by:   Peter Holm
2016-02-24 01:58:40 +00:00
Marcelo Araujo
3bead71e95 - Add a global option where we can protect processes when swap space
is exhausted.

How to use:

Basically we need to add on rc.conf an another option like:

    If we want to protect only the main processes.
    syslogd_oomprotect="YES"

    If we want to protect all future children of the specified processes.
    syslogd_oomprotect="ALL"

PR:		204741 (based on)
Submitted by:	eugen@grosbein.net
Reviewed by:	jhb, allanjude, rpokala and bapt
MFC after:	4 weeks
Relnotes:	Yes
Sponsored by:	gandi.net
Differential Revision:	https://reviews.freebsd.org/D5176
2016-02-24 01:32:12 +00:00
Eric Joyner
e4c893dd01 ixl(4)/ixlv(4): Remove a couple unnecessary register writes/flushes.
The one in ixl_xmit() has brought up to us as being unnecessary at least a
couple times.

Differential Revision:	https://reviews.freebsd.org/D5208
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-24 01:11:51 +00:00
Eric Joyner
e84c2dea93 ixl(4): Fix potential driver interrupt setup issues and startup crash.
- Limit queue autoconfiguration to 8 queues to prevent the driver from
  requesting a large number of MSI-X vectors at boot.

- Fix potential kernel panic that occurs when the driver loads and cannot
  get all requested MSIX vectors. Instead, attach() will fail with an error.
  - Move taskqueue setup to later in attach() to prevent having to free
    taskqueues if some other error in attach() occurs.

Differential Revision:	 https://reviews.freebsd.org/D5205
MFC after:	1 month
Tested by:	jeffrey.e.pieper@intel.com
Sponsored by:	Intel Corporation
2016-02-24 00:42:43 +00:00
Maxim Sobolev
5497acc527 Obsolete mkulzma(8) and geom_uncompress(4), their functionality
is now provided by mkuzip(8) and geom_uzip(4) respectively.

MFC after:	1 month
2016-02-24 00:39:36 +00:00
Jim Harris
361e1fb408 nvme: fix intx handler to not dereference ioq during initialization
This was a regression from r293328, which deferred allocation
of the controller's ioq array until after interrupts are enabled
during boot.

PR:		207432
Reported and tested by: Andy Carrel <wac@google.com>
MFC after:	3 days
Sponsored by:	Intel
2016-02-24 00:01:10 +00:00
Maxim Sobolev
8f8cb840b0 Improve mkuzip(8) and geom_uzip(4), merge in LZMA support from mkulzma(8)
and geom_uncompress(4):

1. mkuzip(8):

 - Proper support for eliminating all-zero blocks when compressing an
   image. This feature is already supported by the geom_uzip(4) module
   and CLOOP format in general, so it's just a matter of making mkuzip(8)
   match. It should be noted, however that this feature while it sounds
   great, results in very slight improvement in the overall compression
   ratio, since compressing default 16k all-zero block produces only 39
   bytes compressed output block, which is 99.8% compression ratio. With
   typical average compression ratio of amd64 binaries and data being
   around 60-70% the difference between 99.8% and 100.0% is not that
   great further diluted by the ratio of number of zero blocks in the
   uncompressed image to the overall number of blocks being less than
   0.5 (typically). However, this may be important from performance
   standpoint, so that kernel are not spinning its wheels decompressing
   those empty blocks every time this zero region is read. It could also
   be important when you create huge image mostly filled with zero
   blocks for testing purposes.

 - New feature allowing to de-duplicate output image. It turns out that
   if you twist CLOOP format a bit you can do that as well. And unlike
   zero-blocks elimination, this gives a noticeable improvement in the
   overall compression ratio, reducing output image by something like
   3-4% on my test UFS2 3GB image consisting of full FreeBSD base system
   plus some of the packages (openjdk, apache etc), about 2.3GB worth of
   file data (800+MB compressed). The only caveat is that images created
   with this feature "on" would not work on older versions of FeeBSDxi
   kernel, hence it's turned off by default.

 - provide options to control both features and document them in manual
   page.

 - merge in all relevant LZMA compression support from the mkulzma(8),
   add new option to select between both.

 - switch license from ad-hoc beerware into standard 2-clause BSD.

2. geom_uzip(4):

 - implement support for de-duplicated images;

 - optimize some code paths to handle "all-zero" blocks without reading
   any compressed data;

 - beef up manual page to explain that geom_uzip(4) is not limited only
   to md(4) images. The compressed data can be written to the block
   device and accessed directly via magic of GEOM(4) and devfs(4),
   including to mount root fs from a compressed drive.

 - convert debug log code from being compiled in conditionally into
   being present all the time and provide two sysctls to turn it on or
   off. Due to intended use of the module, it can be used in
   environments where there may not be a luxury to put new kernel with
   debug code enabled. Having those options handy allows debug issues
   without as much problem by just having access to serial console or
   network shell access to a box/appliance. The resulting additional
   CPU cycles are just few int comparisons and branches, and those are
   minuscule when compared to data decompression which is the main
   feature of the module.

 - hopefully improve robustness and resiliency of the geom_uzip(4) by
   performing some of the data validation / range checking on the TOC
   entries and rejecting to attach to an image if those checks fail.

 - merge in all relevant LZMA decompression support from the
   geom_uncompress(4), enable automatically when appropriate format is
   indicated in the header.

 - move compilation work into its own worker thread so that it does not
   clog g_up. This allows multiple instances work in parallel utilizing
   smp cores.

 - document new knobs in the manual page.

Reviewed by:		adrian
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D5333
2016-02-23 23:59:08 +00:00
Jung-uk Kim
0eda5b3f23 Silence PVS-Studio warning (V595). It can never be NULL here. 2016-02-23 23:57:24 +00:00
Bryan Drewery
200241b504 Fix build after r295934. 2016-02-23 23:37:10 +00:00
Jung-uk Kim
2f977ab449 Silence PVS-Studio warning (V595). 2016-02-23 23:09:45 +00:00
Jung-uk Kim
8444599e1e Silence PVS-Studio warning (V595). 2016-02-23 22:55:44 +00:00
Jung-uk Kim
7054df7f5b Remove brightness notify handler before reinstalling new one. 2016-02-23 22:50:45 +00:00
Jilles Tjoelker
84f1891033 sh: Fix set -v and multiline history after r295825.
r295825 erroneously dropped the newline from the input data for 'set -v'
output and multiline history.

Reported by:	vangyzen
2016-02-23 22:44:01 +00:00
Jung-uk Kim
3e4f6cc6c7 Fix white spaces. 2016-02-23 22:30:45 +00:00
Jung-uk Kim
8d4a1dbf7b Fix style(9) bugs. 2016-02-23 22:22:15 +00:00
Mariusz Zaborski
94e6fdd806 According to the sys/kern/capabilities.conf, gethostid(3) should be allowed.
Pointed out by:	Milosz Kaniewski <m.kaniewski@wheelsystems.com>
Approved by:	pjd (mentor)
MFC after:	3 days
Sponsored by:	Wheel Systems, http://wheelsystems.com
2016-02-23 22:02:25 +00:00
Bryan Drewery
6971a63795 Fix build after r29592. 2016-02-23 21:21:47 +00:00
Andriy Voskoboinyk
ffadb4acda net80211: fix TIM cleanup.
Remove duplicate 'ni->ni_associd = 0' assignment from
ieee80211_node_leave(), since it breaks iv_set_tim() in
ic->ic_node_cleanup() (associd is cleared right after this call).

Tested with RTL8188EU (HOSTAP mode) and
WUSB54GC (STA mode, with powersaving enabled).

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D5398
2016-02-23 21:11:42 +00:00
John Baldwin
287b96dd25 Add handling for non-native error values to libsysdecode.
Add two new functions, sysdecode_abi_to_freebsd_errno() and
sysdecode_freebsd_to_abi_errno(), which convert errno values between
the native FreeBSD ABI and other supported ABIs. Note that the
mappings are not necessarily perfect meaning in some cases multiple
errors in one ABI might map to a single error in another ABI. In that
case, the reverse mapping will return one of the errors that maps, but
which error is non-deterministic.

Change truss to always report the raw error value to the user but
use libsysdecode to map it to a native errno value that can be used
with strerror() to generate a description. Previously truss reported
the "converted" error value. Now the user will always see the exact
error value that the application sees.

Change kdump to report the truly raw error value to the user. Previously
kdump would report the absolute value of the raw error value (so for
Linux binaries it didn't output the FreeBSD error value, but the positive
value of the Linux error). Now it reports the real (i.e. negative) error
value for Linux binaries. Also, use libsysdecode to convert the native
FreeBSD error reported in the ktrace record to the raw error used by the
ABI. This means that the Linux ABI can now be handled directly in
ktrsysret() and removes the need for linux_ktrsysret().

Reviewed by:	bdrewery, kib
Helpful notes:	wblock (manpage)
Differential Revision:	https://reviews.freebsd.org/D5314
2016-02-23 20:00:55 +00:00
John Baldwin
d70876fd7e Add support for displaying thread IDs to truss(1).
- Consolidate duplicate code for printing the metadata at the start of
  each line into a shared function.
- Add an -H option which will log the thread ID of the relevant thread
  for each event.

While here, remove some extraneous calls to clock_gettime() in
print_syscall() and print_syscall_ret().  The caller of print_syscall_ret()
always updates the current thread's "after" time before it is called.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D5363
2016-02-23 19:56:29 +00:00
Michael Tuexen
9a59fb36b2 Don't leak an address in an error path.
CID:		1351729
MFC after:	3 days
2016-02-23 18:50:34 +00:00
Hans Petter Selasky
b265897c37 Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.

MFC after:	1 week
2016-02-23 18:17:01 +00:00
Randall Stewart
6e0efc6a39 This fixes the fastpath code to have a better module initialization sequence when
included in loader.conf. It also fixes it so that no matter if some one incorrectly
specifies a load order, the lists and such will be initialized on demand at that
time so no one can make that mistake.

Reviewed by:	hiren
Differential Revision:	D5189
2016-02-23 17:53:39 +00:00
David Malone
95bcaf513b Following revision r295924, the changes to a db file should be fsynced
before the file is closed. Consequently, it shouldn't be necessary to
open the file with O_SYNC any more.

This improves the performance of building large .db files for large
password files a lot and should resolve this problem:

	https://forums.freebsd.org/threads/10-2-pre-pwd_mkdb-slow-on-larger-master-passwd.52700/

Differential Revision:	https://reviews.freebsd.org/D5186
Reviewed by:	garga, vangyzen, bapt, se
MFC after:	1 week
2016-02-23 15:28:13 +00:00
David Malone
efb7dae251 If we close or sync a hash-based db file, make sure to call fsync to
make sure the changes are on disk. The people at pfSense noticed that
it didn't always make it to the disk soon enough with soft updates.

Differential Revision:	https://reviews.freebsd.org/D5186
Reviewed by:	garga, vangyzen, bapt, se
MFC after:	1 week
2016-02-23 15:21:13 +00:00
Hans Petter Selasky
ecc7ce0f3e Be more verbose when truncating number of HID items.
Suggested by:	Larry Rosenman <ler@lerctr.org>
MFC after:	1 week
2016-02-23 14:58:20 +00:00
Ruslan Bukin
48eeabc1a9 Set a dependencies for stack(9) RISC-V MD part.
Pointed out by:	andrew
2016-02-23 14:29:22 +00:00
Ruslan Bukin
cea32c0742 o Grab physical memory regions information from the device tree.
o Increase memory size.
2016-02-23 14:21:46 +00:00
Svatopluk Kraus
fe6928058c Remove redundant __ARM_ARCH >= 6 check in armv6 specific files. 2016-02-23 10:12:50 +00:00
Sepherosa Ziehau
1b3ce7e39f hyperv/stor: Fix print format
Detected by:	PVS Static Analysis
MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5388
2016-02-23 09:29:45 +00:00
Sepherosa Ziehau
b87683cb78 hyperv/hn: Use IFQ_DRV_PREPEND instead of IF_PREPEND
IF_PREPEND promises out-of-order packet sending when the TX desc list
is depleted. It was overlooked and copied blindly when the transmission
path was partially rewritten.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5386
2016-02-23 09:25:20 +00:00
Ed Schouten
70907712be Make handling of mmap()'s prot argument more strict.
- Make the system call fail if prot contains bits other than read, write
  and exec.
- Similar to OpenBSD's W^X, don't allow write and exec to be set at the
  same time. I'd like to see for now what happens if we enforce this
  policy unconditionally. If it turns out that this is far too strict,
  we'll loosen this requirement.
2016-02-23 09:22:00 +00:00
Sepherosa Ziehau
a0a3cf18ec hyperv/hn: Factor out hn_send_pkt() from hn_start_locked()
It will be shared w/ the upcoming ifnet.if_transmit method
implementation.

No functional change.

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D5385
2016-02-23 09:20:33 +00:00
Xin LI
876964d12a MFV r295913:
Partially apply upstream changeset 6e06b1c8 (kientzle).

Limit filter recursion level to 25 (instead of infinite).  This fixes a
potential crash issue discovered by Alexander Cherepanov.

PR:		207362
Reported by:	Robert Clausecker
Obtained from:	libarchive github project
2016-02-23 07:13:22 +00:00
Xin LI
c5f9310ca9 Apply upstream commit 6e06b1c8 (partial, by kientzle):
Fix a potential crash issue discovered by Alexander Cherepanov:
It seems bsdtar automatically handles stacked compression. This is a
nice feature but it could be problematic when it's completely
unlimited.  Most clearly it's illustrated with quines:

$ curl -sRO http://www.maximumcompression.com/selfgz.gz
$ (ulimit -v 10000000 && bsdtar -tvf selfgz.gz)
bsdtar: Error opening archive: Can't allocate data for gzip decompression

Without ulimit, bsdtar will eat all available memory. This could also
be a problem for other applications using libarchive.
2016-02-23 07:04:54 +00:00
Ian Lepore
3f817dd216 Stop using the global fdtbus_bs_tag and instead use the tag from the softc
that was set up properly at init time.
2016-02-23 03:34:36 +00:00
Ian Lepore
b1c2e02c10 This code no longer references fdtbus_bs_tag, no need for a special extern
declaration of it for aarch64.
2016-02-23 03:01:46 +00:00
Ian Lepore
99c4102214 Now that we have OF_decode_addr(), with proper MD implementations, to obtain
the bus space tag and handle for a uart console, use the values returned by
that routine to set the global uart_bus_space_mem, instead of assuming that
there will be a global variable named fdtbus_bs_tag to set it from.

Also, use OF_getencprop() instead calling fdt32_to_cpu() separately.
2016-02-23 02:57:45 +00:00
Justin Hibbits
9ef05032c0 Allow the size argument for law_enable() to be non-power-of-2.
Although the local access windows are powers of 2 in size, allow arguments that
aren't power of 2, and round up.
2016-02-23 02:28:19 +00:00