Commit Graph

116375 Commits

Author SHA1 Message Date
Allan Jude
546251e8df Fix sparc64 build broken by r316343 and r316076
Reported by:	markj
Sponsored by:	ScaleEngine Inc.
2017-04-02 17:25:37 +00:00
Andriy Voskoboinyk
c422c270b5 iwn: use correct mask for queue ids (0xf -> 0x1f). 2017-04-02 13:24:58 +00:00
Gavin Atkinson
3f4760c8e1 Add IDs for several missing Intel SMBus controllers.
Obtained from:	Data sheets, Linux defines, local hardware
MFH:		2 weeks
2017-04-02 11:36:25 +00:00
Alexander Motin
7e907868b3 Add IDs for Intel Cougar Point USB 2.0 controller.
MFC after:	1 week
2017-04-02 11:32:05 +00:00
Bruce Evans
3a98d83edb Reset the DAC to 6-bit mode before calling the BIOS to set the screen
mode.  This works around bugs in at least 2 Intel BIOSes for our
subsequent setting of the DAC back to 8-bit mode.  The bug caused dark
(mostly 1/4-intensity) colors for all except the first setting to a
VESA graphics mode (including for settings to the current mode).

Remove restoration (with less bits) of the palette in vesa_unload()
after resetting the DAC to 6-bit mode.  Depend on the BIOS to keep
the palette consistent with the DAC for the simpler reset case like
we do everywhere else in places that are actually important.

Setting the video mode should reset everything to defaults, although
we usually don't want that.  Even the buggy BIOSes set the DAC to the
default 6-bit mode, and set the palette to a default that matches the
DAC.  We don't undo the reset for most things, but we do undo it for
the DAC (more precisely, we change to an 8-bit DAC if possible, and
this is the only way that we set to an 8-bit DAC; it is accidental
that if the DAC was in 8-bit mode from a previous mode switch then
setting it to 8-bit mode is an undo).  The buggy BIOSes are confused
by our setting of the DAC to 8-bit mode in the "undo" case.  They
should multiply palette entries by 4 to match, but they actually leave
all palette entries except #2 (green) and #248-255 (unused) untouched.
Green is mysteriously scaled from 0x2a to 0x6a, and #248-255 are scaled
correctly.

Our support for the 8-bit DAC had almost no effect except to enable
bugs.  Syscons barely supports 16 colors, so it doesn't benefit much
from having a palette with 16 million colors instead of only 256K.
Applications can manage the palette using FBIO_{GET,SET}PALETTE, but
the palette managed by this is only used in the less interesting modes
(text and non-truecolor graphics modes up to 8 bits wide), and the
kernel loses the changes on any mode switch (including to another vt
in a different mode).
2017-04-02 08:39:32 +00:00
Dmitry Chagin
0aecedaa83 Remove excess tv_nsec test as this is done by linux_to_native_timespec().
MFC after:	1 week
2017-04-02 07:49:05 +00:00
Dmitry Chagin
2ac9dced18 The value in the tv_nsec field should be in the range 0 to 999999999.
Pointed out by:	bde@

MFC after:	1 week
2017-04-02 07:47:28 +00:00
Dmitry Chagin
71b50d0872 As noted by bde@ negative tv_sec values are not checked for overflow,
so overflow can still occur. Fix that. Also remove the extra check for
tv_sec size as under COMPAT_LINUX32 it is always true.

Pointed out by:	bde@

MFC after:	1 week
2017-04-02 07:46:13 +00:00
Justin Hibbits
d139c624a9 Add Freescale eSPI driver found on QorIQ SoCs 2017-04-02 01:21:35 +00:00
Justin Hibbits
6e1c39e9b2 Use the newly added mpc85xx_get_system_clock()
Simplify the platform clock acquisition by using the new helper function.
2017-04-01 22:35:03 +00:00
Justin Hibbits
bba2d2bd51 Add a helper function to get system reference clock
Many devices are clocked from the SoC's platform clock / 2.  Some device nodes
include their own clock-frequency property, while others are dependent on the
SoC's bus-frequency property instead.  To simplify, add a helper function to get
this clock.
2017-04-01 22:29:11 +00:00
Ian Lepore
1982abfd4a Correct a comment... the stack used by ubldr is the same stack u-boot was
running on when it jumped to the ubldr entry point.  None of the arches
that use this code set up a different stack in their start.S routines.
2017-04-01 22:03:00 +00:00
Emmanuel Vadot
b7e79ebdd0 Reduce the diff on beaglebone-black DTS.
The HDMI TX (tda19988) is already enabled in upstream DTS so use it directly
instead.
2017-04-01 21:55:09 +00:00
Ian Lepore
4260eff804 Preserve the registers containing argc, argv, and return address values
passed in from u-boot across the call to self_reloc and any other early-init
code, and restore them before calling main().

The self_reloc() routine uses r0 and r1 (and calling it uses lr), and
depending on what values get left in them, main() would intermittantly lock
up trying to interpret them as argc and argv values.  This problem affected
the self-relocatable ubldr.bin but not ubldr (the elf version).
2017-04-01 21:51:34 +00:00
Oleksandr Tymoshenko
5d7c109fb9 [versatilepb] Fix keyboard driver after switching to upstream DTS
FreeBSD's DTS contained only one PL050 node and driver considered it to
be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from
the periphers connected to it. New DTS contains two nodes and QEMU emulates
keyboard connected to port #0 and mouse connected to port #1. Since there
is no way to say what's connected to port by checking DTS we hardcode
this knowledge in the driver: it assumes keyboard on port #0 and ignores
port #1 altogether.

Also QEMU defaults emulated keyboard to scan code set 2 while driver used
to work with scan code set 1 so when initializing driver make sure keyboard
is switched to scan code set 1
2017-04-01 20:38:12 +00:00
Oleksandr Tymoshenko
87d2359388 [versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB
Scope of this change is somewhat larger than just converting to INTRNG.
The reason for this is that INTRNG support required switching from custom
to upstream DTS because custom DTS didn't have interrup routing information.
This switch caused rewrite of PCI and CLCD drivers and adding SCM module.
List of changes in this commit:

- Enable INTRNG and switch to versatile-pb.dts

- Add SCM driver that controls various peripheral devices like LCD or
  PCI controller. Previously registers required for power-up and
  configuring peripherals were part of their respective nodes. Upstream
  DTS has dedicated node for SCM

- Convert PL190 driver to INTRNG

- Convert Versatile SIC (secondary interrupt controller) to INTRNG

- Refactor CLCD driver to use SCM API to power up and configuration

- Refactor PCI driver to use SCM API to enable controller

- Refactor PCI driver to use interrupt map provided in DTS for
  interrupt routing. As a result it fixes broken IRQ routing and
  it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1"
  command-line arguments
2017-04-01 20:10:08 +00:00
Kristof Provost
3601d25181 pf: Fix leak of pf_state_keys
If we hit the state limit we returned from pf_create_state() without cleaning
up.

PR:		217997
Submitted by:	Max <maximos@als.nnov.ru>
MFC after:	1 week
2017-04-01 12:22:34 +00:00
Allan Jude
ec5c0e5be9 Implement boot-time encryption key passing (keybuf)
This patch adds a general mechanism for providing encryption keys to the
kernel from the boot loader. This is intended to enable GELI support at
boot time, providing a better mechanism for passing keys to the kernel
than environment variables. It is designed to be extensible to other
applications, and can easily handle multiple encrypted volumes with
different keys.

This mechanism is currently used by the pending GELI EFI work.
Additionally, this mechanism can potentially be used to interface with
GRUB, opening up options for coreboot+GRUB configurations with completely
encrypted disks.

Another benefit over the existing system is that it does not require
re-deriving the user key from the password at each boot stage.

Most of this patch was written by Eric McCorkle. It was extended by
Allan Jude with a number of minor enhancements and extending the keybuf
feature into boot2.

GELI user keys are now derived once, in boot2, then passed to the loader,
which reuses the key, then passes it to the kernel, where the GELI module
destroys the keybuf after decrypting the volumes.

Submitted by:	Eric McCorkle <eric@metricspace.net> (Original Version)
Reviewed by:	oshogbo (earlier version), cem (earlier version)
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9575
2017-04-01 05:05:22 +00:00
Pedro F. Giffuni
ac506a8f5a ext2fs: Initial support for Extended Attributes.
Currently read-only.

Submitted by:	Fedor Uporov
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D10151
2017-04-01 01:00:36 +00:00
Zbigniew Bodek
19fbe8bdbc Rework BGX detection to support both new and old firmware
Improve existing BGX detection and adjust it to support both
new and older ThunderX firmwares. Match BGX FDT nodes by name
and reg. Match PHY instances by qlm-mode and name.
Tested on Firmware Version: 2016-09-30 09:12:11

Obtained from:	Semihalf
Differential Revision:	https://reviews.freebsd.org/D9863
2017-03-31 18:04:34 +00:00
Robert Watson
8e6be21a58 Audit arguments to posix_fallocate(2) and posix_fadvise(2) system calls.
As posix_fadvise() does not lock the vnode argument, don't capture
detailed vnode information for the time being.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-31 14:17:14 +00:00
Robert Watson
475e1fc01f Correct macro names and signatures for !AUDIT versions of canonical
path auditing.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-31 14:13:13 +00:00
Robert Watson
15bcf785ba Audit arguments to POSIX message queues, semaphores, and shared memory.
This requires minor changes to the audit framework to allow capturing
paths that are not filesystem paths (i.e., will not be canonicalised
relative to the process current working directory and/or filesystem
root).

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-31 13:43:00 +00:00
Andrey V. Elsukov
788e62864f Reset the cached state of last lookup in the dynamic states when an
external action is completed, but the rule search is continued.

External action handler can change the content of @args argument,
that is used for dynamic state lookup. Enforce the new lookup to be able
install new state, when the search is continued.

Obtained from:	Yandex LLC
MFC after:	1 week
Sponsored by:	Yandex LLC
2017-03-31 09:26:08 +00:00
Steven Hartland
4d806fc663 Allow explicitly assigned IPv6 loopback address to be used in jails
If a jail has an explicitly assigned IPv6 loopback address then allow it
to be used instead of remapping requests for the loopback adddress to the
first IPv6 address assigned to the jail.

This fixes issues where applications attempt to detect their bound port
where they requested a loopback address, which was available, but instead
the kernel remapped it to the jails first address.

This is the same fix applied to IPv4 fix by: r316313

Also:
* Correct the description of prison_check_ip6_locked to match the code.

MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Multiplay
2017-03-31 09:10:05 +00:00
Kevin Lo
0642eac437 Add support for ThingM blink(1) notification LED to uled(4). 2017-03-31 08:20:59 +00:00
Steven Hartland
6ebc1b7b7d Allow explicitly assigned IPv4 loopback address to be used in jails
If a jail has an explicitly assigned loopback address then allow it to be
used instead of remapping requests for the loopback adddress to the first
IPv4 address assigned to the jail.

This fixes issues where applications attempt to detect their bound port
where they requested a loopback address, which was available, but instead
the kernel remapped it to the jails first address.

A example of this is binding nginx to 127.0.0.1 and then running "service
nginx upgrade" which before this change would cause nginx to fail.

Also:
* Correct the description of prison_check_ip4_locked to match the code.

MFC after:	2 weeks
Relnotes:	Yes
Sponsored by:	Multiplay
2017-03-31 00:41:54 +00:00
Allan Jude
39b7ca4533 sys/geom/eli: Switch bzero() to explicit_bzero() for sensitive data
In GELI, anywhere we are zeroing out possibly sensitive data, like
the metadata struct, the metadata sector (both contain the encrypted
master key), the user key, or the master key, use explicit_bzero.

Didn't touch the bzero() used to initialize structs.

Reviewed by:	delphij, oshogbo
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9809
2017-03-31 00:07:03 +00:00
Allan Jude
9f67bd210a Add explicit_bzero() to libstand, and switch GELIBoot to using it
Make sure sensitive memory is properly cleared when finished with it

Reviewed by:	Eric McCorkle <eric@metricspace.net>
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D9798
2017-03-31 00:04:32 +00:00
David C Somayajulu
a7c62c116c Add support for optional Soft LRO
MFC after:5 days
2017-03-30 22:43:32 +00:00
Robert Watson
1c2da02938 Audit arguments to System V IPC system calls implementing sempahores,
message queues, and shared memory.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-30 22:26:15 +00:00
Robert Watson
f907080983 Add system-call argument auditing for ACL-related system calls.
Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-30 22:00:58 +00:00
Oleksandr Tymoshenko
dda1957040 [am335x] Fix HDMI suport for Beaglebone Black
Fallback to Linux video interface bindings introduced in r313068 worked
with then current DTS but that DTS turned out to be not conformant to
the the bindings spec. DTS import in r314854 fixed the conformancy but
broke the functionality. This commit syncs up functionality to the actual
spec.

Reported by:	manu@
2017-03-30 21:54:57 +00:00
Robert Watson
b65ec5e523 Various BSM generation improvements when auditing AUE_ACCEPT,
AUE_PROCCTL, AUE_SENDFILE, AUE_ACL_*, and AUE_POSIX_FALLOCATE.
Audit AUE_SHMUNLINK path in the path token rather than as a
text string, and AUE_SHMOPEN flags as an integer token rather
than a System V IPC address token.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-30 21:39:03 +00:00
Dmitry Chagin
faa9679e24 Use kern_mincore() helper instead of abusing syscall entry.
Suggested by:	kib@
Reviewed by:	kib@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10143
2017-03-30 19:45:07 +00:00
Dmitry Chagin
46dc8e9d6a Add kern_mincore() helper for micore() syscall.
Suggested by:	kib@
Reviewed by:	kib@
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10143
2017-03-30 19:42:49 +00:00
Toomas Soome
cb83812c70 Remove OLD_NFSV2 from loader and libstand
We have parallel NFSv2 and NFSv3 reader implementations, only configurable at
build time, defaulting to v3. Remove v2.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10206
2017-03-30 19:32:25 +00:00
Tycho Nightingale
86be94fca3 Add support for capturing 'struct ptrace_lwpinfo' for signals
resulting in a process dumping core in the corefile.

Also extend procstat to view select members of 'struct ptrace_lwpinfo'
from the contents of the note.

Sponsored by:	Dell EMC Isilon
2017-03-30 18:21:36 +00:00
Sean Bruno
2b2fc97356 Don't call init functions directly from the timer/watchdog function.
Enqueue this in the admin task now that it can process it.

Submitted by:	Matt Macy <mmacy@nextbsd.org>
Sponsored by:	Limelight Networks
2017-03-30 16:54:01 +00:00
Toomas Soome
c641105f8b loader: simplify efi_zfs_probe and avoid double probing for zfs.
The current efi_zfs_probe() is overcomplicated and can be made
simpler. Still we need to pick up the device handle for our boot
disk first, because the ESP does not have to be the first partition on the
disk.

Once we do have the handle for boot disk, we probe that disk with
pointer for pool GUID.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10198
2017-03-30 16:31:35 +00:00
Toomas Soome
4479aa540f loader: efipart should check disk size from partition table
While testing 32bit UEFI OVMF (which has bug about how the disk size
is presented), I did witness the errors from blkio->ReadBlocks().

It became apparent we can not entirely trust UEFI interfaces either,
so additional checks are needed.

So we use disk_ioctl(DIOCGMEDIASIZE) for disks, with fallback of
Media->LastBlock for other media.

In addition, we need to check if there is media present.

+ small fixes for error printout, and avoiding multiple blk * 512.

Reviewed by:	allanjude
Approved by:	allanjude (mentor)
Differential Revision:	https://reviews.freebsd.org/D10197
2017-03-30 16:23:31 +00:00
Sean Bruno
5c1ff25517 Assert IFF_DRV_OACTIVE in iflib_timer() when the "hung" case is detected
so that iflib's admin task can still process the reset directive and restore
functionality.

Sponsored by:	Limelight Networks
2017-03-30 16:03:51 +00:00
Nick Hibma
b14e3bd289 Add nctgpio conf lines so it can be compiled into the kernel.
MFC after:	2 days
2017-03-30 15:05:10 +00:00
Robert Watson
7cad64f796 Don't ifdef KDTRACE_HOOKS struct, variable, and function prototype
definitions for the DTrace audit provider, so that the dtaudit module
can compile in the absence of kernel DTrace support.  This doesn't
really make run-time sense (since the binary dependencies for the
module won't be present), but it allows the dtaudit module to compile
successfully regardless of the kernel configuration.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
Reported by:	kib
2017-03-30 12:35:56 +00:00
Konstantin Belousov
836c0dc9e5 Only activate __EXT1_VISIBLE block when using sys/errno.h in userspace.
The prerequisite for '#if __EXT1_VISIBLE' functionality is the
inclusion of sys/cdefs.h.  errno.h only auto-includes the header for
non-kernel environment, and EXT1 block only useful for non-kernel as
well.

Reported by:	lwhsu
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2017-03-30 06:24:30 +00:00
Konstantin Belousov
9851b3400a Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.

Other needed supporting types, defines and constraint_handler
infrastructure is added as specified in the C11 spec.

Submitted by:	Tom Rix <trix@juniper.net>
Sponsored by:	Juniper Networks
Discussed with:	ed
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D9903
Differential revision:	https://reviews.freebsd.org/D10161
2017-03-30 04:57:26 +00:00
Enji Cooper
653e7d6396 Split iscsi(4) ctl frontend off of ctl(4) as cfiscsi(4)
The goal of this work is to remove the explicit dependency for ctl(4)
on iscsi(4), so end-users without iscsi(4) support in the kernel can
use ctl(4) for its other functions.

This allows those without iscsi(4) support built into the kernel to use
ctl(4) as a test mechanism. As a sidenote, this was possible around the
10.0-RELEASE period, but made impossible for end-users without iscsi(4)
between 10.0-RELEASE and 11.0-RELEASE.

Automatically load cfiscsi(4) from ctladm(8) and ctld(8) for backwards
compatibility with previously releases. The automatic loading feature is
compiled into the beforementioned tools if MK_ISCSI == yes when building
world.

Add a manpage for cfiscsi(4) and refer to it in ctl(4).

Differential Revision:	D10099
MFC after:	2 months
Relnotes:	yes
Reviewed by:	mav, trasz
Sponsored by:	Dell EMC Isilon
2017-03-30 04:56:27 +00:00
Konstantin Belousov
3aeacc55a5 A followup to r315749, two more places where brand->interp_path was
accessed unconditionally.

Reported by:	se
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-03-30 04:21:02 +00:00
Adrian Chadd
779da5cfb3 [mbufq] add a concat method.
Reviewed by:	gnn, ae, glebius
Approved by:	ae, glebius
Differential Revision:	https://reviews.freebsd.org/D10158
2017-03-30 02:34:21 +00:00
Robert Watson
b783025921 When handling msgsys(2), semsys(2), and shmsys(2) multiplex system calls,
map the 'which' argument into a suitable audit event identifier for the
specific operation requested.

Obtained from:	TrustedBSD Project
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2017-03-29 23:31:35 +00:00