]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoExit with an error if a linker hints file can't be found.
jhb [Thu, 14 Jun 2018 22:31:30 +0000 (22:31 +0000)]
Exit with an error if a linker hints file can't be found.

Continuing with a NULL hints variable just triggers a segfault later on.
The other error cases in this function all exit for an error rather than
warning.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15579

6 years agoTCPOUTFLAGS no longer exists since r334843.
glebius [Thu, 14 Jun 2018 22:25:10 +0000 (22:25 +0000)]
TCPOUTFLAGS no longer exists since r334843.

6 years agoProvide the ip6_plen in network byte order when calling ip6_output().
tuexen [Thu, 14 Jun 2018 21:30:52 +0000 (21:30 +0000)]
Provide the ip6_plen in network byte order when calling ip6_output().

This is not strictly required by ip6_output(), since it overrides it,
but it is needed for upcoming dtrace support.

6 years agoRegen after 335177 (rename sys_obreak to sys_break).
brooks [Thu, 14 Jun 2018 21:29:31 +0000 (21:29 +0000)]
Regen after 335177 (rename sys_obreak to sys_break).

6 years agoName the implementation of brk and sbrk sys_break().
brooks [Thu, 14 Jun 2018 21:27:25 +0000 (21:27 +0000)]
Name the implementation of brk and sbrk sys_break().

The break() system call was renamed (several times) starting in v3
AT&T UNIX when C was invented and break was a language keyword. The
last vestage of a need for it to be called something else (eg obreak)
was removed in r225617 which consistantly prefixed all syscall
implementations.

Reviewed by: emaste, kib (older version)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15638

6 years agoWhitespace changes.
tuexen [Thu, 14 Jun 2018 21:22:14 +0000 (21:22 +0000)]
Whitespace changes.

6 years agoAdd a new man page that briefly describes the pNFS variant of the NFSv4.1
rmacklem [Thu, 14 Jun 2018 21:12:08 +0000 (21:12 +0000)]
Add a new man page that briefly describes the pNFS variant of the NFSv4.1
protocol.

This is a content change.

6 years agoDocument the "-p" and "-m" options added to nfsd.c by r335172.
rmacklem [Thu, 14 Jun 2018 20:55:33 +0000 (20:55 +0000)]
Document the "-p" and "-m" options added to nfsd.c by r335172.

This is a content change.

6 years agoextres/regulator: Properly refcount gpio regulators
kevans [Thu, 14 Jun 2018 20:37:25 +0000 (20:37 +0000)]
extres/regulator: Properly refcount gpio regulators

regnode::enable_cnt is generally used to refcount regulator nodes. For
GPIOs, the refcount was done on the gpio_entry since more than one regulator
can share a GPIO.

GPIO regulators were not taking part in the node refcount, since they had
their own mechanism. This caused some fallout after manu started disabling
everybody's unused regulators in r331989.

Refcount it.

Glanced over by: manu

6 years agoAdd the "-p" and "-m" options to nfsd.c for the pNFS service.
rmacklem [Thu, 14 Jun 2018 20:36:55 +0000 (20:36 +0000)]
Add the "-p" and "-m" options to nfsd.c for the pNFS service.

The "-p" option specifies that the nfsd should run a pNFS service instead
of a regular NFS service. The "-m" option is only meaningful when used with
"-p" to specify that mirroring on the DSs should be done and on how many of
them.
This change requires the kernel changes committed as r334930.
The man page update will be committed as a separate commit soon.

6 years agoHandle the race between fork/vm_object_split() and faults.
kib [Thu, 14 Jun 2018 19:41:02 +0000 (19:41 +0000)]
Handle the race between fork/vm_object_split() and faults.

If fault started before vmspace_fork() locked the map, and then during
fork, vm_map_copy_entry()->vm_object_split() is executed, it is
possible that the fault instantiate the page into the original object
when the page was already copied into the new object (see
vm_map_split() for the orig/new objects terminology). This can happen
if split found a busy page (e.g. from the fault) and slept dropping
the objects lock, which allows the swap pager to instantiate
read-behind pages for the fault.  Then the restart of the scan can see
a page in the scanned range, where it was already copied to the upper
object.

Fix it by instantiating the read-ahead pages before
swap_pager_getpages() method drops the lock to allocate pbuf.  The
object scan would see the whole range prefilled with the busy pages
and not proceed the range.

Note that vm_fault rechecks the map generation count after the object
unlock, so that it restarts the handling if raced with split, and
re-lookups the right page from the upper object.

In collaboration with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agomx25l: compat_data is only defined when FDT is
manu [Thu, 14 Jun 2018 19:01:40 +0000 (19:01 +0000)]
mx25l: compat_data is only defined when FDT is

Reported by: O. Hartmann <ohartmann@walstatt.org>

6 years agoa10_ahci: Correct clock indices for new bindings
kevans [Thu, 14 Jun 2018 18:34:02 +0000 (18:34 +0000)]
a10_ahci: Correct clock indices for new bindings

r329104 imported 4.15 DTS which brought CCU to a10/a20. In the process, they
swapped the ordering of 'clocks' for allwinner,sun4i-a10-ahci on both
sun4i-a10 and sun7i-a20 from PLL, Gate to Gate, PLL.

Swap it in the driver.

6 years agoaw_ccung: Add a10/a20 support
kevans [Thu, 14 Jun 2018 17:50:29 +0000 (17:50 +0000)]
aw_ccung: Add a10/a20 support

Note: At this time, this has only been tested on a single board from one of
the supported SoCs. This is enough to boot the board from MMC and have
functional USB- which is still an improvement over where we were at just
before with no functional clocks.

Differential Revision: https://reviews.freebsd.org/D15810

6 years agoaw_ccung: Support clock factors where factor=0, factor is effectively 1
kevans [Thu, 14 Jun 2018 17:36:02 +0000 (17:36 +0000)]
aw_ccung: Support clock factors where factor=0, factor is effectively 1

This happens in two cases for a20 clocks:

pll_core for 'n' factor:
factor=0, val=1
factor=n, val=n

ahb divisor:
factor=0,val=/2
factor=n,val=/2^n

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D15806

6 years agoarm timer: Use the default get_cntxct by default
manu [Thu, 14 Jun 2018 17:32:23 +0000 (17:32 +0000)]
arm timer: Use the default get_cntxct by default

Reported by: kevans

6 years agoSplit the PowerISA 3.0 HPT implementation from historic
jhibbits [Thu, 14 Jun 2018 17:23:51 +0000 (17:23 +0000)]
Split the PowerISA 3.0 HPT implementation from historic

PowerISA 3.0 makes several changes to not only the format of the HPT but
also the behavior surrounding it.  For instance, TLBIE no longer requires
serialization.  Removing this lock cuts buildworld time in half on a
18-core/72-thread POWER9 system, demonstrating that this lock is highly
contended on such a system.

There was odd behavior observed trying to make this change in a
backwards-compatible manner in moea64_native.c, so the best option was to
fully split it, and largely revert the original changes adding POWER9
support to the original file.

Suggested by: nwhitehorn

6 years agomx25l: Add pnp info
manu [Thu, 14 Jun 2018 17:21:09 +0000 (17:21 +0000)]
mx25l: Add pnp info

6 years agospi: Add SPIBUS_PNP_INFO macro
manu [Thu, 14 Jun 2018 17:20:47 +0000 (17:20 +0000)]
spi: Add SPIBUS_PNP_INFO macro

The PNP info string is the same as the SIMPLEBUS one but driver should
depend on spibus and not simplebus

6 years agoaw_spi: Add pnp info
manu [Thu, 14 Jun 2018 17:19:44 +0000 (17:19 +0000)]
aw_spi: Add pnp info

6 years agoarm timer: Add workaround for Allwinner A64 timer
manu [Thu, 14 Jun 2018 17:18:15 +0000 (17:18 +0000)]
arm timer: Add workaround for Allwinner A64 timer

The timer present in allwinner A64 SoC is unstable, value can jump backward
or forward.
It was found that when bit 11 and upper roll over the low bits can sometimes
being read as all as 1 or all as 0.
Simply ignore the values for those cases.

6 years agoFix da(4) locking when probing SMR drives.
ken [Thu, 14 Jun 2018 17:08:44 +0000 (17:08 +0000)]
Fix da(4) locking when probing SMR drives.

Probing host aware and host managed SMR drives got broken in revision
330796.

The added cam_periph_lock() calls were in areas in dadone() where
the peripheral lock was already held.

Since then, dadone() has been split into separate functions that are
dedicated to each probe state.

The result is that when probing a host aware drive, I ran into a recursive
lock acquisition in dadone_probeatalogdir(). I would have run into the
same problem in dadone_probeataiddir(), and in dadone_probeatasup() and
dadone_probeatazone() in the error paths had the probe continued.

The solution is to take out all of the extra cam_periph_lock() calls. I
also added cam_periph_assert(periph, MA_OWNED) near the top of each of
the dadone_* calls. These make it clear to anyone coming along in the
the future that the lock is held in the probe done functions.

Also add a locking assert in daprobedone(), to make it clear that it must
be called with the periph lock held.

Sponsored by: Spectra Logic
Differential Revision: https://reviews.freebsd.org/D15764

6 years agolibsa: open() should use NULL instead of typecasted 0
tsoome [Thu, 14 Jun 2018 16:11:50 +0000 (16:11 +0000)]
libsa: open() should use NULL instead of typecasted 0

6 years agodevmatch: Address some rc nits
kevans [Thu, 14 Jun 2018 16:09:29 +0000 (16:09 +0000)]
devmatch: Address some rc nits

- devmatch_enable in rc.conf(5) was not gating the start of devmatch

- Use quietstart in devd/devmatch to suppress dozens of 'Cannot start'
  messages and other spurious messages from rc.subr(8) that aren't
  necessarily helpful.

Discussed with: imp

6 years agoFix CTR formatting for moea64_native bootstrap
jhibbits [Thu, 14 Jun 2018 16:01:11 +0000 (16:01 +0000)]
Fix CTR formatting for moea64_native bootstrap

On very large memory systems 'size' can become 2GB or larger, resulting in a
negative value being formatted.  Also, moea64_pteg_count is already a long, so
format it as such.

6 years agoaudit(4): add tests for fhopen, fhstat, and fhstatfs
asomers [Thu, 14 Jun 2018 15:04:49 +0000 (15:04 +0000)]
audit(4): add tests for fhopen, fhstat, and fhstatfs

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15798

6 years agoAdd missing BPF_MTAP2() for outbound packets.
ae [Thu, 14 Jun 2018 15:04:30 +0000 (15:04 +0000)]
Add missing BPF_MTAP2() for outbound packets.

6 years agoConvert if_me(4) driver to use encap_lookup_t method and be lockless on
ae [Thu, 14 Jun 2018 14:53:24 +0000 (14:53 +0000)]
Convert if_me(4) driver to use encap_lookup_t method and be lockless on
data path.

6 years agoaudit(4): fix typo from r335136
asomers [Thu, 14 Jun 2018 14:53:01 +0000 (14:53 +0000)]
audit(4): fix typo from r335136

Typo in Makefile accidentally disabled some older tests

MFC after: 2 weeks
X-MFC-With: 335136

6 years agoaudit(4): add tests for flock, fcntl, and fsync
asomers [Thu, 14 Jun 2018 13:42:58 +0000 (13:42 +0000)]
audit(4): add tests for flock, fcntl, and fsync

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15795

6 years agolinuxolator/amd64: Don't mangle %r10 on return from syscall for EJUSTRETURN.
kib [Thu, 14 Jun 2018 12:35:57 +0000 (12:35 +0000)]
linuxolator/amd64: Don't mangle %r10 on return from syscall for EJUSTRETURN.

This fixes the %r10 content for rt_sigreturn.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
MFC after: 1 week

6 years agotop(1): remove myself from top.1
eadler [Thu, 14 Jun 2018 12:14:51 +0000 (12:14 +0000)]
top(1): remove myself from top.1

I wrote some, but not enough for the man page.

6 years agoIn m_megapullup() use m_getjcl() to allocate 9k or 16k mbuf when requested.
ae [Thu, 14 Jun 2018 11:15:39 +0000 (11:15 +0000)]
In m_megapullup() use m_getjcl() to allocate 9k or 16k mbuf when requested.

It is better to try allocate a big mbuf, than just silently drop a big
packet. A better solution could be reworking of libalias modules to be
able use m_copydata()/m_copyback() instead of requiring the single
contiguous buffer.

PR: 229006
MFC after: 1 week

6 years agoReorganize code flow in fpudna()/npxdna() to highlight the critical
kib [Thu, 14 Jun 2018 11:09:51 +0000 (11:09 +0000)]
Reorganize code flow in fpudna()/npxdna() to highlight the critical
section scope.  Sprinkle __predict_false() for conditions known to
never occur or occur only on rare platforms.

Sponsored by: The FreeBSD Foundation

6 years agoRemove printf() in #NM handler.
kib [Thu, 14 Jun 2018 10:33:26 +0000 (10:33 +0000)]
Remove printf() in #NM handler.

Give up and remove the almost useless informational message reporting
that device not available exception occured while our state tracking
indicates the current CPU has FPU context loaded for the current
thread.

It seems that this is recurring bug with some VM monitors.

Sponsored by: The FreeBSD Foundation

6 years agoMove four functions in nfscl.ko to nfscommon.ko.
rmacklem [Thu, 14 Jun 2018 10:00:19 +0000 (10:00 +0000)]
Move four functions in nfscl.ko to nfscommon.ko.

Four functions nfscl_reqstart(), nfscl_fillsattr(), nfsm_stateidtom()
and nfsmnt_mdssession() are now called from within the nfsd.
As such, they needed to be moved from nfscl.ko to nfscommon.ko so that
nfsd.ko would load when nfscl.ko wasn't loaded.

Reported by: herbert@gojira.at

6 years agoAdd NULL check like the rest of code has.
ae [Thu, 14 Jun 2018 09:36:25 +0000 (09:36 +0000)]
Add NULL check like the rest of code has.

It is possible that ifma_protospec becomes NULL in this function for
some entry, but it is still referenced and thus it will not unlinked
from the list. Then "restart" condition triggers and this entry with
NULL ifma_protospec will lead to page fault.

PR: 228982

6 years agoRemove stale comment. in6_ifdetach() can be called from places
ae [Thu, 14 Jun 2018 09:29:39 +0000 (09:29 +0000)]
Remove stale comment.  in6_ifdetach() can be called from places
where addresses are not removed yet.

6 years agolibsa: remobe unneeded check before free()
tsoome [Thu, 14 Jun 2018 09:10:34 +0000 (09:10 +0000)]
libsa: remobe unneeded check before free()

free() is checking for NULL, remove duplicate check.

6 years agolibsa: f_rabuf could be NULL
tsoome [Thu, 14 Jun 2018 09:06:53 +0000 (09:06 +0000)]
libsa: f_rabuf could be NULL

It is possible that we will not get RA buffer from open(), therefore
we must validate RA.

6 years agolibsa: cstyle cleanup for open/close/read/write sources
tsoome [Thu, 14 Jun 2018 08:58:10 +0000 (08:58 +0000)]
libsa: cstyle cleanup for open/close/read/write sources

6 years agork_i2c: Add manpage for this driver
manu [Thu, 14 Jun 2018 07:59:47 +0000 (07:59 +0000)]
rk_i2c: Add manpage for this driver

6 years agoRevert r335094 and properly fix OFED build after r335053.
hselasky [Thu, 14 Jun 2018 07:55:10 +0000 (07:55 +0000)]
Revert r335094 and properly fix OFED build after r335053.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agodts: Update our copy to Linux 4.17
manu [Thu, 14 Jun 2018 07:12:10 +0000 (07:12 +0000)]
dts: Update our copy to Linux 4.17

6 years agodts: Import files from Linux 4.17
manu [Thu, 14 Jun 2018 06:56:07 +0000 (06:56 +0000)]
dts: Import files from Linux 4.17

6 years agobootprog_info is generated in vers.c. Move it's definition to
imp [Thu, 14 Jun 2018 06:41:33 +0000 (06:41 +0000)]
bootprog_info is generated in vers.c. Move it's definition to
bootstrap.h and remove all the redundant copies.

Sponsored by: Netflix

6 years agoUse bool for vargood, since it's a boolean.
imp [Thu, 14 Jun 2018 06:41:22 +0000 (06:41 +0000)]
Use bool for vargood, since it's a boolean.

Sponsored by: Netflix

6 years agoAdd modules/rockchip
manu [Thu, 14 Jun 2018 06:40:59 +0000 (06:40 +0000)]
Add modules/rockchip

Build rockchip modules as part of buildkernel.
Add the i2c controller module.

6 years agork_i2c: Add driver for the I2C controller present in RockChip SoC
manu [Thu, 14 Jun 2018 06:39:33 +0000 (06:39 +0000)]
rk_i2c: Add driver for the I2C controller present in RockChip SoC

This controller have a special mode for RX to help with smbus-like transfer
when the controller will automatically send the slave address, register address
and read the data. Use it when possible.
The same mode for TX is describe is the datasheet but is broken and have been
since ~10 years of presence of this controller in RockChip SoCs.

Attach this driver early at we need it to communicate with the PMIC early in the
boot.
Do not hook it to the kernel build for now.

6 years agork3328: Add support for the i2c clocks
manu [Thu, 14 Jun 2018 06:34:27 +0000 (06:34 +0000)]
rk3328: Add support for the i2c clocks

6 years agoif_dwc_rk: Add DesignWare driver for RockChip SoCs.
manu [Thu, 14 Jun 2018 06:28:09 +0000 (06:28 +0000)]
if_dwc_rk: Add DesignWare driver for RockChip SoCs.

Add driver for the designware ethernet controller found in some RockChip SoCs.
The driver still rely on a lot of things setup by the bootloader like clocks
and phy mode.
But since netbooting is the only/easiest way to boot rockchip board at the
moment add the driver so other people can test/dev on thoses boards.

6 years agoRemove redundant defs.mk includes. They aren't needed.
imp [Thu, 14 Jun 2018 06:14:48 +0000 (06:14 +0000)]
Remove redundant defs.mk includes. They aren't needed.

6 years agork_armclk: Add the write mask to the register mux value
manu [Thu, 14 Jun 2018 05:46:57 +0000 (05:46 +0000)]
rk_armclk: Add the write mask to the register mux value

This was omitted in r334112 and r334996 which cause the PLL to not correctly
reparent, leaving the armclk to be derived from the APLL instead of the NPLL.
The arm core clock is now correctly set to 600Mhz via the assigned-clock present
in the DTB.

6 years agork_pll: Add support for mode
manu [Thu, 14 Jun 2018 05:43:45 +0000 (05:43 +0000)]
rk_pll: Add support for mode

RockChip PLL have two modes controlled by a register, a "slow mode" (the
default one) where the frequency is derived from the 24Mhz oscillator on the
board, and a "normal" one when the pll take it's input from the real PLL output.

Default the mode to normal for all the PLLs.

6 years agork_pinctrl: Only add gpio subnode
manu [Thu, 14 Jun 2018 05:41:16 +0000 (05:41 +0000)]
rk_pinctrl: Only add gpio subnode

This is the only node we are interested in so do not waste time to test
creating device that will be either unused or fail as most of the nodes
don't have a compatible string.

6 years agoThis fixes several bugs that Larry Rosenman helped me find in
rrs [Thu, 14 Jun 2018 03:27:42 +0000 (03:27 +0000)]
This fixes several bugs that Larry Rosenman helped me find in
Rack with respect to its handling of TCP Fast Open. Several
fixes all related to TFO are included in this commit:
1) Handling of non-TFO retransmissions
2) Building the proper send-map when we are doing TFO
3) Dealing with the ack that comes back that includes the
   SYN and data.

It appears that with this commit TFO now works :-)

Thanks Larry for all your help!!

Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D15758

6 years agoaudit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)
asomers [Thu, 14 Jun 2018 02:30:43 +0000 (02:30 +0000)]
audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)

Submitted by: aniketp
MFC after: 2 weeks
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15750

6 years agoFix style(9) space vs tab.
araujo [Thu, 14 Jun 2018 01:34:53 +0000 (01:34 +0000)]
Fix style(9) space vs tab.

Reviewed by: jhb
MFC after: 3 weeks.
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D15768

6 years agoFix style(9) space vs tab.
araujo [Thu, 14 Jun 2018 01:28:55 +0000 (01:28 +0000)]
Fix style(9) space vs tab.

Reviewed by: jhb
MFC after: 3 weeks.
Sponsored by: iXsystems Inc.
Differential Revision: https://reviews.freebsd.org/D15774

6 years agocxgbe(4): Catch up with recent changes in the kernel -- it no longer
np [Thu, 14 Jun 2018 01:27:35 +0000 (01:27 +0000)]
cxgbe(4): Catch up with recent changes in the kernel -- it no longer
holds non-sleepable locks around any of the driver ioctls.

Sponsored by: Chelsio Communications

6 years agoNVME support is only for x86 and powerpc64.
imp [Thu, 14 Jun 2018 01:15:19 +0000 (01:15 +0000)]
NVME support is only for x86 and powerpc64.

Implement MK_NVME now that the expression for where NVMe is
complicated. Default it to "yes" for x86 and powerpc64 and
no everywhere else. Use it in camcontrol to define WITH_NVME
for those platforms where we support nvme.

This should fix the newly introduced nvme files to camcontrol
which were building everywhere.

Pointy Hat To: imp
Sponsored by: Netflix

6 years agoFix top(1) support for displaying ZFS Compressed ARC statistics
allanjude [Thu, 14 Jun 2018 00:10:16 +0000 (00:10 +0000)]
Fix top(1) support for displaying ZFS Compressed ARC statistics

Broken in r334514

sysctlbyname("vfs.zfs.compressed_arc_enabled", ...) would return ENOMEM
while trying to read the sysctl (a boolean_t) into a bool, which is too small.

Reviewed by: jhb (on irc)
Sponsored by: Klara Systems

6 years agofix OFED build after r335053
mmacy [Wed, 13 Jun 2018 23:30:54 +0000 (23:30 +0000)]
fix OFED build after r335053

6 years agoFix PCBGROUPS build post CK conversion of pcbinfo
mmacy [Wed, 13 Jun 2018 23:19:54 +0000 (23:19 +0000)]
Fix PCBGROUPS build post CK conversion of pcbinfo

6 years agoMake camcontrol identify work with nda devices
imp [Wed, 13 Jun 2018 22:00:08 +0000 (22:00 +0000)]
Make camcontrol identify work with nda devices

Both ATA and NVME have an identify command. They are completely
different, but to the user they are the same. Leverage nvmecontrol's
print_controller code to provide that functionality to camcontrol
identify. Query the path to see what kind of protocol it supports, and
send the most appropriate command down. Refactor nvme_print_dev a
little to make it easy to get the nvme cdata.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15371

6 years agoMake it possible to use print_controller from another program
imp [Wed, 13 Jun 2018 22:00:02 +0000 (22:00 +0000)]
Make it possible to use print_controller from another program

Rename print_controller to nvme_print_controller. Put it in its
own file for easy inclusion. Move util.c to be nc_util.c to not
conflict with camcontrol. add nvecontrol_ext.h to define shared
interfaces.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15371

6 years agoEnable eager FPU context switch by default on i386 too, based on
kib [Wed, 13 Jun 2018 21:10:23 +0000 (21:10 +0000)]
Enable eager FPU context switch by default on i386 too, based on
amd64 r335072.

Security: CVE-2018-3665
Sponsored by: The FreeBSD Foundation

6 years agoAdd PNP info to PCI attachment of ae driver
imp [Wed, 13 Jun 2018 20:25:36 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of ae driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachments of age driver
imp [Wed, 13 Jun 2018 20:25:32 +0000 (20:25 +0000)]
Add PNP info to PCI attachments of age driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachment of amr driver
imp [Wed, 13 Jun 2018 20:25:27 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of amr driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachment of ale driver
imp [Wed, 13 Jun 2018 20:25:23 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of ale driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachment of bwi driver
imp [Wed, 13 Jun 2018 20:25:18 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of bwi driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachment of bwn driver
imp [Wed, 13 Jun 2018 20:25:13 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of bwn driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to PCI attachment of an driver
imp [Wed, 13 Jun 2018 20:25:09 +0000 (20:25 +0000)]
Add PNP info to PCI attachment of an driver

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to the PCI attachment of the ahci driver
imp [Wed, 13 Jun 2018 20:25:04 +0000 (20:25 +0000)]
Add PNP info to the PCI attachment of the ahci driver

Mark the PNP table, but still need to handle the CLASS / SUBCLASS /
REVID matching.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to the PCI attachment of the aacraid driver.
imp [Wed, 13 Jun 2018 20:25:00 +0000 (20:25 +0000)]
Add PNP info to the PCI attachment of the aacraid driver.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoAdd PNP info to the PCI attachment of the ncr driver.
imp [Wed, 13 Jun 2018 20:24:49 +0000 (20:24 +0000)]
Add PNP info to the PCI attachment of the ncr driver.

Reviewed by: imp, chuck
Submitted by: Lakhan Shiva Kamireddy <lakhanshiva@gmail.com>
Sponsored by: Google, Inc. (GSoC 2018)

6 years agoi386: copyin/copyout error is EFAULT
rlibby [Wed, 13 Jun 2018 19:57:03 +0000 (19:57 +0000)]
i386: copyin/copyout error is EFAULT

Discussed with: kib
MFC with: r332489
Sponsored by: Dell EMC Isilon

6 years agoMention that ports are used to build packages, this fact - obvious
trasz [Wed, 13 Jun 2018 18:50:51 +0000 (18:50 +0000)]
Mention that ports are used to build packages, this fact - obvious
to the developers, but much less so to users - seems to be rather
weakly documented.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL

6 years agoGet rid of references to /usr/share/doc/ from ports(7) and getosreldate(3).
trasz [Wed, 13 Jun 2018 18:34:49 +0000 (18:34 +0000)]
Get rid of references to /usr/share/doc/ from ports(7) and getosreldate(3).
The handbooks are not installed there anymore. While here, improve the
URLs markup a bit.

Reviewed by: allanjude@
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D15793

6 years agoEnable eager FPU context switch by default on amd64.
kib [Wed, 13 Jun 2018 17:55:09 +0000 (17:55 +0000)]
Enable eager FPU context switch by default on amd64.

With compilers making increasing use of vector instructions the
performance benefit of lazily switching FPU state is no longer a
desirable tradeoff.  Linux switched to eager FPU context switch some
time ago, and the idea was floated on the FreeBSD-current mailing list
some years ago[1].

Enable eager FPU context switch by default on amd64, with a tunable/sysctl
available to turn it back off.

[1] https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055198.html

Reviewed by: jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation

6 years agoInitialize variables we later free so they aren't used
imp [Wed, 13 Jun 2018 17:42:55 +0000 (17:42 +0000)]
Initialize variables we later free so they aren't used
uninitialized in the error path.
Remove unused variables.

Sponsored by: Netflix

6 years agoRemove unused variables.
imp [Wed, 13 Jun 2018 17:42:50 +0000 (17:42 +0000)]
Remove unused variables.

Sponsored by: Netflix

6 years agoRemove fail: label. It's unused.
imp [Wed, 13 Jun 2018 17:28:06 +0000 (17:28 +0000)]
Remove fail: label. It's unused.

Sponsored by: Netflix

6 years agoMake UMA and malloc(9) return non-executable memory in most cases.
jtl [Wed, 13 Jun 2018 17:04:41 +0000 (17:04 +0000)]
Make UMA and malloc(9) return non-executable memory in most cases.

Most kernel memory that is allocated after boot does not need to be
executable.  There are a few exceptions.  For example, kernel modules
do need executable memory, but they don't use UMA or malloc(9).  The
BPF JIT compiler also needs executable memory and did use malloc(9)
until r317072.

(Note that a side effect of r316767 was that the "small allocation"
path in UMA on amd64 already returned non-executable memory.  This
meant that some calls to malloc(9) or the UMA zone(9) allocator could
return executable memory, while others could return non-executable
memory.  This change makes the behavior consistent.)

This change makes malloc(9) return non-executable memory unless the new
M_EXEC flag is specified.  After this change, the UMA zone(9) allocator
will always return non-executable memory, and a KASSERT will catch
attempts to use the M_EXEC flag to allocate executable memory using
uma_zalloc() or its variants.

Allocations that do need executable memory have various choices.  They
may use the M_EXEC flag to malloc(9), or they may use a different VM
interfact to obtain executable pages.

Now that malloc(9) again allows executable allocations, this change also
reverts most of r317072.

PR: 228927
Reviewed by: alc, kib, markj, jhb (previous version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D15691

6 years agoaudit(4): Fix file descriptor leaks in ATF tests
asomers [Wed, 13 Jun 2018 17:01:57 +0000 (17:01 +0000)]
audit(4): Fix file descriptor leaks in ATF tests

Submitted by: aniketp
Reported by: Coverity
CID: 1393343 1393346 1392695 1392781 1391709 1392078 1392413
CID: 1392014 1392521 1393344 1393345 1393347 1393348 1393349
CID: 1393354 1393355 1393356 1393357 1393358 1393360 1393362
CID: 1393368 1393369 1393370 1393371 1393372 1393373 1393376
CID: 1393380 1393384 1393387 1393388 1393389
MFC after: 2 weeks
Sponsored by: Google, Inc (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15782

6 years agoImplement a 'car limit' for bioq.
imp [Wed, 13 Jun 2018 16:48:07 +0000 (16:48 +0000)]
Implement a 'car limit' for bioq.

Allow one to implement a 'car limit' for
bioq_disksort. debug.bioq_batchsize sets the size of car limit. Every
time we queue that many requests, we start over so that we limit the
latency for requests when the software queue depths are large. A value
of '0', the default, means to revert to the old behavior.

Sponsored by: Netflix

6 years agoAdd ThunderX2 to the list of CPUs we need to apply the branch predictor
andrew [Wed, 13 Jun 2018 15:58:33 +0000 (15:58 +0000)]
Add ThunderX2 to the list of CPUs we need to apply the branch predictor
hardening to.

Sponsored by: DARPA, AFRL

6 years agoSwitch to the SMCCC function for branch predictor hardening. The previous
andrew [Wed, 13 Jun 2018 15:56:24 +0000 (15:56 +0000)]
Switch to the SMCCC function for branch predictor hardening. The previous
method may not have worked as the firmware checks for the ARCH_WORKAROUND_1
function ID.

Sponsored by: DARPA, AFRL

6 years agoAdd the SMCCC return codes from ARM DEN 0070A.
andrew [Wed, 13 Jun 2018 15:41:22 +0000 (15:41 +0000)]
Add the SMCCC return codes from ARM DEN 0070A.

While here add a comment with the document the function IDs come from.

Sponsored by: DARPA, AFRL

6 years agoAdd support for the ARM SMC Calling Convention (SMCCC). This is a method
andrew [Wed, 13 Jun 2018 15:32:00 +0000 (15:32 +0000)]
Add support for the ARM SMC Calling Convention (SMCCC). This is a method
to call into the firmware in a similar way to the existing PSCI, and used
PSCI to detect when SMCCC is enabled.

There is a function ID space we can use. Currently we only support 3
functions in the ARM Architecture Calls region, however it is expected we
will expend these in the future.

Sponsored by: DARPA, AFRL

6 years agoMove psci_call to a header file so we can use it in other files to
andrew [Wed, 13 Jun 2018 15:24:07 +0000 (15:24 +0000)]
Move psci_call to a header file so we can use it in other files to
communicate with the firmware.

Sponsored by: DARPA, AFRL

6 years agoaudit(4): fix the definition of ARG_TERMID_ADDR
asomers [Wed, 13 Jun 2018 14:55:31 +0000 (14:55 +0000)]
audit(4): fix the definition of ARG_TERMID_ADDR

Due to a copy/paste error in r168688, ARG_TERMID_ADDR has the same
definition as ARG_SADDRUNIX.  Fix it.

The header change, while publicly visible, is guarded by #ifdef KERNEL, and
I can't find any kmod ports that use it.  So I'm not bumping
__FreeBSD_version.

PR: 228820
Submitted by: aniketp
Sponsored by: Google, Inc. (GSoC 2018)
Differential Revision: https://reviews.freebsd.org/D15702

6 years agoOops, r335053 had an old version of the comment about 16-bit linux dev_t
bde [Wed, 13 Jun 2018 12:44:45 +0000 (12:44 +0000)]
Oops, r335053 had an old version of the comment about 16-bit linux dev_t
translation.

6 years agoAdd a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
andrew [Wed, 13 Jun 2018 12:33:47 +0000 (12:33 +0000)]
Add a handler for the PSCI_FEATURES function. This needs PSCI 1.0, so
check for this, returning an error if the version is too old.

Sponsored by: DARPA, AFRL

6 years agoFind and cache the PSCI version on driver attach.
andrew [Wed, 13 Jun 2018 12:32:04 +0000 (12:32 +0000)]
Find and cache the PSCI version on driver attach.

Sponsored by: DARPA, AFRL

6 years agoAdd the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
andrew [Wed, 13 Jun 2018 12:26:37 +0000 (12:26 +0000)]
Add the PSCI_FEATURES function ID. This is found in PSCI 1.0 and is used
to query if a given function is implemented and its features.

Sponsored by: DARPA, AFRL

6 years agoFix the encoding of major and minor numbers in 64-bit dev_t by restoring
bde [Wed, 13 Jun 2018 12:22:00 +0000 (12:22 +0000)]
Fix the encoding of major and minor numbers in 64-bit dev_t by restoring
the old encodings for the lower 16 and 32 bits and only using the
higher 32 bits for unusually large major and minor numbers.  This
change breaks compatibility with the previous encoding (which was only
used in -current).

Fix truncation to (essentially) 16-bit dev_t in newnfs v3.

Any encoding of device numbers gives an ABI, so it can't be changed
without translations for compatibility.  Extra bits give the much
larger complication that the translations need to compress into fewer
bits.  Fortunately, more than 32 bits are rarely needed, so
compression is rarely needed except for 16-bit linux dev_t where it
was always needed but never done.

The previous encoding moved the major number into the top 32 bits.
Almost no translation code handled this, so the major number was blindly
truncated away in most 32-bit encodings.  E.g., for ffs, mknod(8) with
major = 1 and minor = 2 gave dev_t = 0x10000002; ffs cannot represent
this and blindly truncated it to 2.  But if this mknod was run on any
released version of FreeBSD, it gives dev_t = 0x102.  ffs can represent
this, but in the previous encoding it was not decoded, giving major = 0,
minor = 0x102.

The presence of bugs was most obvious for exporting dev_t's from an
old system to -current, since bugs in newnfs augment them.  I fixed
oldnfs to support 32-bit dev_t in 1996 (r16634), but this regressed
to 16-bit dev_t in newnfs, first to the old 16-bit encoding and then
further in -current.  E.g., old ad0 with major = 234, minor = 0x10002
had the correct (major, minor) number on the wire, but newnfs truncated
this to (234, 2) and then the previous encoding shifted the major
number into oblivion as seen by ffs or old applications.

I first tried to fix this by translating on every ABI/API boundary, but
there are too many boundaries and too many sloppy translations by blind
truncation.  So use the old encoding for the low 32 bits so that sloppy
translations work no worse than before provided the high 32 bits are
not set.  Add some error checking for when bits are lost.  Keep not
doing any error checking for translations for almost everything in
compat/linux.

compat/freebsd32/freebsd32_misc.c:
Optionally check for losing bits after possibly-truncating assignments as
before.

compat/linux/linux_stats.c:
Depend on the representation being compatible with Linux's (or just with
itself for local use) and spell some of the translations as assignments in
a macro that hides the details.

fs/nfsclient/nfs_clcomsubs.c:
Essentially the same fix as in 1996, except there is now no possible
truncation in makedev() itself.  Also fix nearby style bugs.

kern/vfs_syscalls.c:
As for freebsd32.  Also update the sysctl description to include file
numbers, and change it to describe device ids as device numbers.

sys/types.h:
Use inline functions (wrapped by macros) since the expressions are now
a bit too complicated for plain macros.  Describe the encoding and
some of the reasons for it.  16-bit compatibility didn't leave many
reasonable choices for the 32-bit encoding, and 32-bit compatibility
doesn't leave many reasonable choices for the 64-bit encoding.  My
choice is to put the 8 new minor bits in the low 8 bits of the top 32
bits.  This minimizes discontiguities.

Reviewed by: kib (except for rewrite of the comment in linux_stats.c)

6 years agoRename the ThunderX CPU identification macros to include the X. This is the
andrew [Wed, 13 Jun 2018 12:17:11 +0000 (12:17 +0000)]
Rename the ThunderX CPU identification macros to include the X. This is the
name people know the product by, and is consistent with the later SoC ID
macros.

Sponsored by: DARPA, AFRL

6 years agoAdd more Cavium CPU part numbers.
andrew [Wed, 13 Jun 2018 11:58:41 +0000 (11:58 +0000)]
Add more Cavium CPU part numbers.

While here split the lists by vendor.

Sponsored by: DARPA, AFRL