Commit Graph

218175 Commits

Author SHA1 Message Date
Enji Cooper
110559ba69 free/NULL out variables prior to calling strdup to avoid leaking memory
if arguments are specified more than once with "camcontrol timestamp".

CID:		1366829, 1366831
MFC after:	1 week
2016-12-10 23:26:34 +00:00
Andriy Voskoboinyk
14a8d2f995 rsu: various initialization fixes.
- Do not ignore initialization errors; call ieee80211_stop()
when initialization failed.
- Use usb_pause_mtx() instead of DELAY() while waiting for firmware
loading; this fixes system freeze during firmware startup.
- Do not execute rsu_stop() when device is powered off; fixes
'unknown board type (rfconfig=0xff)' error when the device is
reattached.

Tested with Asus USB-N10.
2016-12-10 22:31:49 +00:00
Enji Cooper
cc7734cbac Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when
executing :mincore_resid

The default process limits in FreeBSD is 64kB for unprivileged users,
which empirically is too low to run the :mincore_resid testcase.

Process limits are inherited, so even though the default limit for
root users is RLIM_INFINITY, the inherited limit with "sudo" with the
default login.conf will be 64kB.

Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to
avoid ENOMEM issues when calling mlock to wire the mmap'ed address
space.

setrlimit requires root access to increase rlim_max, so require root
privileges when running the test

Discovered when executing the tests with sudo, e.g.
"sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test"

MFC after:	2 weeks
2016-12-10 22:08:33 +00:00
Jilles Tjoelker
b1dd83d1d0 Add some tests for reaper functionality (in procctl()).
MFC after:	1 week
2016-12-10 22:05:24 +00:00
Dimitry Andric
e480fc73f5 Tentatively apply https://reviews.llvm.org/D18730 to work around gcc PR
70528 (bogus error: constructor required before non-static data member).
This should fix buildworld with the external gcc package.

Reported by:	https://jenkins.freebsd.org/job/FreeBSD_HEAD_amd64_gcc/
2016-12-10 22:03:44 +00:00
Alexander Motin
2fb5d72d58 Add missed vfs.zfs.zfetch.max_idistance sysctl. 2016-12-10 21:19:27 +00:00
Andriy Voskoboinyk
88c2e36adb rsu: use bitmap for all debug messages.
- Replace all remaining DPRINTF(N)'s with RSU_DPRINTF.
- Add new RSU_DEBUG_USB flag to track error codes returned by
usbd_do_request_flags().
- Improve few messages.
2016-12-10 20:19:57 +00:00
Andriy Voskoboinyk
4b8f606947 rsu(4): refresh the manpage.
- Add monitor mode into the list of supported modes.
- Describe promiscuous mode limitations in CAVEATS section.

Reported by:	adrian
2016-12-10 19:14:51 +00:00
Andriy Voskoboinyk
f06ccf881e rsu: add promiscuous mode support.
- Add partial promiscuous mode support (no management frames;
they cannot be received by the firmware and net80211 at the same time).
- Add monitor mode support (all frames).

Tested with Asus, USB-N10.
2016-12-10 18:47:13 +00:00
Baptiste Daroussin
629582ca46 Now that external gcc directly natively links to libc++ we can remove
the dirty hack made to fake libstdc++
2016-12-10 18:29:39 +00:00
Oleksandr Tymoshenko
4af79d4f2b [evdev] Adds evdev support to sysmouse(4) driver
For horizontal (T-axis) wheel reporting which is not supported by
sysmouse protocol kern.evdev.sysmouse_t_axis sysctl is introduced.
It can take following values:

0 - no T-axis events (default)
1 - T-axis events are originated in ums(4) driver.
2 - T-axis events are originated in psm(4) driver.

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8597
2016-12-10 18:07:16 +00:00
Oleksandr Tymoshenko
c837b8e35f [iwn] Perform BUS_DMASYNC_PREREAD when initializing RX buffer
BUS_DMASYNC_PREREAD is required when setting up RX buffer, otherwise
data provided by card can be overwritten by data evicted from cache

Also use proper tag when setting up RX descriptor

Reviewed by:	adrian, avos, ivadasz
Differential Revision:	https://reviews.freebsd.org/D8717
2016-12-10 17:59:34 +00:00
Andriy Voskoboinyk
7a4575d0b5 rsu: increase Rx buffer size from 8k to 30k.
This is required for USB Rx aggregation
(and fixes 'could not allocate RX mbuf' / few other failures).

While here, reduce the number of Rx buffers from 100 to 1 -
the driver never uses more than one Rx buffer.

Tested with Asus USB-N10.
2016-12-10 17:06:55 +00:00
Konrad Witaszczyk
480f31c214 Add support for encrypted kernel crash dumps.
Changes include modifications in kernel crash dump routines, dumpon(8) and
savecore(8). A new tool called decryptcore(8) was added.

A new DIOCSKERNELDUMP I/O control was added to send a kernel crash dump
configuration in the diocskerneldump_arg structure to the kernel.
The old DIOCSKERNELDUMP I/O control was renamed to DIOCSKERNELDUMP_FREEBSD11 for
backward ABI compatibility.

dumpon(8) generates an one-time random symmetric key and encrypts it using
an RSA public key in capability mode. Currently only AES-256-CBC is supported
but EKCD was designed to implement support for other algorithms in the future.
The public key is chosen using the -k flag. The dumpon rc(8) script can do this
automatically during startup using the dumppubkey rc.conf(5) variable.  Once the
keys are calculated dumpon sends them to the kernel via DIOCSKERNELDUMP I/O
control.

When the kernel receives the DIOCSKERNELDUMP I/O control it generates a random
IV and sets up the key schedule for the specified algorithm. Each time the
kernel tries to write a crash dump to the dump device, the IV is replaced by
a SHA-256 hash of the previous value. This is intended to make a possible
differential cryptanalysis harder since it is possible to write multiple crash
dumps without reboot by repeating the following commands:
# sysctl debug.kdb.enter=1
db> call doadump(0)
db> continue
# savecore

A kernel dump key consists of an algorithm identifier, an IV and an encrypted
symmetric key. The kernel dump key size is included in a kernel dump header.
The size is an unsigned 32-bit integer and it is aligned to a block size.
The header structure has 512 bytes to match the block size so it was required to
make a panic string 4 bytes shorter to add a new field to the header structure.
If the kernel dump key size in the header is nonzero it is assumed that the
kernel dump key is placed after the first header on the dump device and the core
dump is encrypted.

Separate functions were implemented to write the kernel dump header and the
kernel dump key as they need to be unencrypted. The dump_write function encrypts
data if the kernel was compiled with the EKCD option. Encrypted kernel textdumps
are not supported due to the way they are constructed which makes it impossible
to use the CBC mode for encryption. It should be also noted that textdumps don't
contain sensitive data by design as a user decides what information should be
dumped.

savecore(8) writes the kernel dump key to a key.# file if its size in the header
is nonzero. # is the number of the current core dump.

decryptcore(8) decrypts the core dump using a private RSA key and the kernel
dump key. This is performed by a child process in capability mode.
If the decryption was not successful the parent process removes a partially
decrypted core dump.

Description on how to encrypt crash dumps was added to the decryptcore(8),
dumpon(8), rc.conf(5) and savecore(8) manual pages.

EKCD was tested on amd64 using bhyve and i386, mipsel and sparc64 using QEMU.
The feature still has to be tested on arm and arm64 as it wasn't possible to run
FreeBSD due to the problems with QEMU emulation and lack of hardware.

Designed by:	def, pjd
Reviewed by:	cem, oshogbo, pjd
Partial review:	delphij, emaste, jhb, kib
Approved by:	pjd (mentor)
Differential Revision:	https://reviews.freebsd.org/D4712
2016-12-10 16:20:39 +00:00
Baptiste Daroussin
aced69428c Regen after 309805 2016-12-10 13:30:18 +00:00
Andriy Voskoboinyk
88e8709ef1 rsu: add TSF field into Rx radiotap.
Tested with Asus USB-N10.
2016-12-10 13:30:16 +00:00
Baptiste Daroussin
58551dc674 Make WITHOUT_CAPSICUM implying WITHOUT_CASPER
PR:		214562
Reported by:	dewayne@heuristicsystems.com.au
MFC after:	2 days
2016-12-10 13:29:51 +00:00
Baptiste Daroussin
abd4699ce2 Fix pkg groupshow <gid>
PR:		204676
Submitted by:	longwitz@incore.de
MFC after:	2 days
2016-12-10 12:48:48 +00:00
Baptiste Daroussin
1a4604e37b Respect WITHOUT_FINGER in src.conf when running make delete-old
PR:		213719
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:28:43 +00:00
Baptiste Daroussin
bdc5a21692 Respect WITHOUT_BOOTPD in src.conf when running make delete-old
PR:		213720
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:26:49 +00:00
Baptiste Daroussin
06af16fb5b Respect WITHOUT_BOOTPARAMD in src.conf when running make delete-old
PR:		213721
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:24:31 +00:00
Baptiste Daroussin
53a04062b4 Respect WITHOUT_RBOOTD in src.conf when running make delete-old
PR:		213722
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:21:24 +00:00
Baptiste Daroussin
87ac01ca08 Also remove auditdistd files if src.conf has WITHOUT_AUDIT
PR:		213723
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:18:03 +00:00
Baptiste Daroussin
0c421ffe53 Add entries to remove timed files with make delete-old if WITHOUT_TIMED is set
PR:		213724
Submitted by:	philippe.michel7@sfr.fr
MFC after:	2 days
2016-12-10 12:14:41 +00:00
Baptiste Daroussin
cd5245e4c9 Perl is not available in base fix scripts depending on it to use
the version from ports

PR:		215159
Reported by:	Anatoly Kamchatnov <akamch@gmail.com>
MFC after:	2 days
2016-12-10 12:02:32 +00:00
Baptiste Daroussin
e93a36a3cf Update pci ids database to 2016.11.21
MFC after:	2 days
2016-12-10 11:41:26 +00:00
George V. Neville-Neil
c2e34f488c This adds a configuration for arm64 users that track CURRENT but
don't need the extra debug facilities.  Copied from the amd64
configuration of the same name.

Submitted by: Nikolai Lifanov
Reviewed by: emaste
MFC after: 2 weeks
2016-12-10 10:00:27 +00:00
Poul-Henning Kamp
34feb2d2cb Add Genesys Logic USB hub.
Make two other USB hub descriptions more precise.
2016-12-10 09:10:48 +00:00
Marcel Moolenaar
aa8c6a6dca Improve upon r309394
Instead of taking an extra reference to deal with pfsync_q_ins()
and pfsync_q_del() taken and dropping a reference (resp,) make
it optional of those functions to take or drop a reference by
passing an extra argument.

Submitted by:	glebius@
2016-12-10 03:31:38 +00:00
Mark Johnston
f99a517272 Don't create FBT probes for lock owner methods.
These functions may be called in DTrace probe context, so they cannot be
safely traced. Moreover, they are currently only used by DTrace, so their
corresponding FBT probes are not particularly useful.

MFC after:	2 weeks
2016-12-10 03:13:11 +00:00
Mark Johnston
8bb9b7f17a Consistently use fbt_excluded() on all architectures.
MFC after:	2 weeks
2016-12-10 03:11:05 +00:00
Mark Johnston
02315a6759 Use a consistent snapshot of the lock state in owner_mtx().
MFC after:	2 weeks
2016-12-10 02:59:34 +00:00
Mark Johnston
c365a2934e Return a non-NULL owner only if the lock is exclusively held in owner_sx().
Fix some whitespace bugs while here.

MFC after:	2 weeks
2016-12-10 02:56:44 +00:00
Ed Maste
3ca2845d13 libelftc: add elf{32,64}-tradlittlemips target emulation names
Sponsored by:	The FreeBSD Foundation
2016-12-10 01:40:10 +00:00
Enji Cooper
5eabf0ffea Use _test_unmount instead of test_unmount in cleanup to avoid
false positives with atf_check when tmpfs is not loaded, etc

MFC after:	1 week
2016-12-09 23:44:25 +00:00
Enji Cooper
60fbebc327 - Ignore errors from umount
- Use _test_unmount instead of test_unmount in cleanup

MFC after:	1 week
2016-12-09 23:43:33 +00:00
Enji Cooper
5be335bb11 Make test_unmount usable in cleanup subroutines
- Duplicate test_unmount to _test_unmount
- Remove atf_check calls
- Call _test_unmount from test_unmount, checking the exit code
  at the end, and returning it to maintain the test_unmount
  "contract"

MFC after:	1 week
2016-12-09 23:42:04 +00:00
Warner Losh
40975988cb Implement Intel's log page 0xc1 (Read Command Latency Log) and page
0xc1 (Write Command Latency Log).

Sponsored By: Netflix, Inc
2016-12-09 23:37:14 +00:00
Warner Losh
8bece6062d Permit loading of efirt module even when there's no EFI to call. The
module loading is successful, but attempts to use it will not be
successful. This is similar to what we do (did?) with ACPI on non-ACPI
systems. We succeed if we can't find the necessary information to hook
into EFI, but still fail if we're unable to allocate resources if we
do find EFI.

Not Objected to by: kib@
MFC Afer: 3 days
2016-12-09 23:37:11 +00:00
Ed Maste
beced2eabd Keep /usr/bin/ld for WITHOUT_BINUTILS but WITH_LLD_AS_LD
Reported by:	Nikolai Lifanov
2016-12-09 22:51:58 +00:00
Enji Cooper
7f9dff23d3 Only run mdconfig -d -u 3 if /dev/md3 exists on the system
This will prevent "cleanup failures" (exit code != 0 returned) when
tmpfs is not loaded

MFC after:	1 week
2016-12-09 22:50:43 +00:00
Maxim Sobolev
79847968f9 Check that SCM_XXX timestamp returned by the kernel is less 1 second
away in the past from the current time. This should be plenty for the
scheduler to do its job. It provides assurance that the timestamp
returned is actually a valid one, not just some random garbage.
2016-12-09 22:13:00 +00:00
Gleb Smirnoff
255003da42 Allow bogus_page to be passed to pager(s). 2016-12-09 21:21:24 +00:00
Gleb Smirnoff
8c70a35334 Fix build for 32-bit machines.
Submitted by:	tuexen
2016-12-09 20:50:35 +00:00
Ed Maste
36e8c7bb84 src.conf.5: regen after r309142 (WITH_LLD_AS_LD knob)
Reported by:	Nikolai Lifanov
Sponsored by:	The FreeBSD Foundation
2016-12-09 19:09:58 +00:00
Gleb Smirnoff
5040da77c1 Use acquire write to cr_lock to complement with release write at end
of locked region.

Submitted by:	kib
2016-12-09 19:07:31 +00:00
Mark Johnston
90458813cd Conditionalize PG_CACHE sysctls on COMPAT_FREEBSD11.
Reviewed by:	glebius, imp, jhb
Differential Revision:	https://reviews.freebsd.org/D8736
2016-12-09 18:55:27 +00:00
Mark Johnston
7f68a896dc Add a COMPAT_FREEBSD11 kernel option.
Use it wherever COMPAT_FREEBSD10 is currently specified.

Reviewed by:	glebius, imp, jhb
Differential Revision:	https://reviews.freebsd.org/D8736
2016-12-09 18:54:12 +00:00
Gleb Smirnoff
f98751499c Treat R_X86_64_PLT32 relocs as R_X86_64_PC32.
If we load a binary that is designed to be a library, it produces
relocatable code via assembler directives in the assembly itself
(rather than compiler options).  This emits R_X86_64_PLT32 relocations,
which are not handled by the kernel linker.

Submitted by:	gallatin
Reviewed by:	kib
2016-12-09 18:07:28 +00:00
Gleb Smirnoff
296d65b7a9 Backout accidentially leaked in r309746 not yet reviewed patch :( 2016-12-09 18:00:45 +00:00