]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agobootpd: validate hardware type
emaste [Wed, 19 Dec 2018 18:16:29 +0000 (18:16 +0000)]
bootpd: validate hardware type

Due to insufficient validation of network-provided data it may have been
possible for a malicious actor to craft a bootp packet which could cause
a stack buffer overflow.

admbugs: 850
Reported by: Reno Robert
Reviewed by: markj
Approved by: so
Security: FreeBSD-SA-18:15.bootpd
Sponsored by: The FreeBSD Foundation

5 years agoReplace uses of sbadaddr with stval.
markj [Wed, 19 Dec 2018 17:52:09 +0000 (17:52 +0000)]
Replace uses of sbadaddr with stval.

The sbadaddr register was renamed in version 1.10 of the privileged
architecture specification.  No functional change intended.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18594

5 years agoImplement cpu_halt() for RISC-V.
markj [Wed, 19 Dec 2018 17:45:16 +0000 (17:45 +0000)]
Implement cpu_halt() for RISC-V.

Submitted by: Mitchell Horne <mhorne063@gmail.com>
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D18595

5 years agoasmc: Add support for MacPro1,1
dab [Wed, 19 Dec 2018 16:45:37 +0000 (16:45 +0000)]
asmc: Add support for MacPro1,1

PR: 203431
Submitted by: jjr@alisa.org & holindho@saunalahti.fi
Reported by: jjr@alisa.org
MFC after: 1 week

5 years agoRemove a use of a negative array index from fxp(4).
markj [Wed, 19 Dec 2018 04:54:32 +0000 (04:54 +0000)]
Remove a use of a negative array index from fxp(4).

This fixes a warning seen when compiling amd64 GENERIC with clang 7.
Also remove the workaround added in r337324.  clang 7 and gcc 4.2
generate the same code with or without the code change.

Reviewed by: imp (previous version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18603

5 years agonet80211: fix out-of-bounds read in ieee80211_amrr(9).
avos [Wed, 19 Dec 2018 03:08:10 +0000 (03:08 +0000)]
net80211: fix out-of-bounds read in ieee80211_amrr(9).

ieee80211_alloc_node() does not initialize rateset tables; that's not
expected by rate control modules and will result in array access at
index -1 - where ni_essid[] array is located (zeroed at allocation, so
there are no user-visible consequences).

Just delay rate control initialization to the moment, when rateset
tables are initiaziled; nothing will use rates here anyway.

MFC after: 4 days

5 years agocxgbe/t4_tom: fixes for issues on the passive open side.
np [Wed, 19 Dec 2018 01:37:00 +0000 (01:37 +0000)]
cxgbe/t4_tom: fixes for issues on the passive open side.

- Fix PR 227760 by getting the TOE to respond to the SYN after the call
  to toe_syncache_add, not during it.  The kernel syncache code calls
  syncache_respond just before syncache_insert.  If the ACK to the
  syncache_respond is processed in another thread it may run before the
  syncache_insert and won't find the entry.  Note that this affects only
  t4_tom because it's the only driver trying to insert and expand
  syncache entries from different threads.

- Do not leak resources if an embryonic connection terminates at
  SYN_RCVD because of L2 lookup failures.

- Retire lctx->synq and associated code because there is never a need to
  walk the list of embryonic connections associated with a listener.
  The per-tid state is still called a synq entry in the driver even
  though the synq itself is now gone.

PR: 227760
MFC after: 2 weeks
Sponsored by: Chelsio Communications

5 years agoFix DDB's "show malloc" after r338899.
markj [Wed, 19 Dec 2018 00:17:22 +0000 (00:17 +0000)]
Fix DDB's "show malloc" after r338899.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agocyapa.4, isl.4: cross-reference and document use of chromebook_platform(4)
avg [Tue, 18 Dec 2018 21:43:33 +0000 (21:43 +0000)]
cyapa.4, isl.4: cross-reference and document use of chromebook_platform(4)

PR: 218632
Reported by: Denis Kozadaev <denis@tambov.ru>
MFC after: 1 week

5 years agoUse mbufq instead of ifqueue to queue mbufs.
glebius [Tue, 18 Dec 2018 19:38:13 +0000 (19:38 +0000)]
Use mbufq instead of ifqueue to queue mbufs.

5 years agoFix typo and formatting...
imp [Tue, 18 Dec 2018 19:05:57 +0000 (19:05 +0000)]
Fix typo and formatting...

5 years agoadd pre-commit review request for drm*.
imp [Tue, 18 Dec 2018 18:52:12 +0000 (18:52 +0000)]
add pre-commit review request for drm*.
Move dev/usb/wlan to sys/dev/usb/wlan as it was the odd-man-out.

5 years agoichwd: add a few assertions about tco_version
avg [Tue, 18 Dec 2018 17:17:53 +0000 (17:17 +0000)]
ichwd: add a few assertions about tco_version

Those should ensure correctness of ichwd_find_ich_lpc_bridge() and
ichwd_find_ich_lpc_bridge() as well as make it easier for both humans
and static analyzers to see the relation between tco_version and ich and
smb variables in ichwd_identify().

Reported by: Coverity
CID: 13963141396317
MFC after: 10 days

5 years agoUse caph_enter_casper() in ping(8).
markj [Tue, 18 Dec 2018 16:47:03 +0000 (16:47 +0000)]
Use caph_enter_casper() in ping(8).

Reported by: oshogbo
MFC with: r341837
Sponsored by: The FreeBSD Foundation

5 years agoconst poison the `new` pointer of __sysctl.
brooks [Tue, 18 Dec 2018 12:44:38 +0000 (12:44 +0000)]
const poison the `new` pointer of __sysctl.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18444

5 years agoiwi(4): do not leak node reference when IWI_FLAG_ASSOCIATED flag is set.
avos [Tue, 18 Dec 2018 05:08:56 +0000 (05:08 +0000)]
iwi(4): do not leak node reference when IWI_FLAG_ASSOCIATED flag is set.

MFC after: 6 days

5 years agoMFV r342175:
cy [Tue, 18 Dec 2018 01:12:30 +0000 (01:12 +0000)]
MFV r342175:

Update sqlite3-3.23.1 --> sqlite3-3.26.0 (3260000)

MFC after: 3 days
Security: https://blade.tencent.com/magellan/index_en.html
No known CVE was apparently registered.

5 years agoRemove UMS support code from radeonkms.
markj [Mon, 17 Dec 2018 21:48:20 +0000 (21:48 +0000)]
Remove UMS support code from radeonkms.

The code is unreachable since the entries of radeon_ioctls[] are not
associated with any device: we provide only the KMS entry points.
Moreover, r600_cp_dispatch_texture() contains an integer overflow bug
that can be triggered from userspace.[1]

Reported by: Anonymous of the Shellphish Grill Team[1]
Reviewed by: dumbbell
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18516

5 years agoCatch up with r338948.
markj [Mon, 17 Dec 2018 21:34:09 +0000 (21:34 +0000)]
Catch up with r338948.

MFC with: r342178

5 years agofix formatting and style in ig4iic_acpi_probe afetr r339754
avg [Mon, 17 Dec 2018 21:33:25 +0000 (21:33 +0000)]
fix formatting and style in ig4iic_acpi_probe afetr r339754

This includes removing stray whitespace, adding a line after the
variable declaration block and removing a redundant check.

MFC after: 1 week
X-MFC with: r339754

5 years agoRevert r336326.
markj [Mon, 17 Dec 2018 21:13:05 +0000 (21:13 +0000)]
Revert r336326.

In testing on a Dell Latitude 7480, having ig4.ko loaded during a
suspend caused the system to hang.  It turns out that ig4iic_intr() was
being called after the device entered D3, and entered an infinite loop
because a read of the I2C status register returned all ones, causing us
to attempt to read a byte from the data buffer until one of the status
bits clears.  This occured because ig4iic_pci0 shares an interrupt with
the VGA device on this laptop, so ig4iic_intr() gets called even when
there is no work to do.  This is exactly the problem fixed by r342170,
which resolves the hang for me and allows suspend/resume to work with
ig4.ko loaded.  So, re-enable autoloading of ig4.ko in the hope that
r342170 resolves the problem universally.

Reviewed by: gonzo
MFC after: 1 month (pending an MFC of r342170)
Differential Revision: https://reviews.freebsd.org/D18587

5 years agoImport sqlite3-3.26.0 (3260000)
cy [Mon, 17 Dec 2018 20:19:35 +0000 (20:19 +0000)]
Import sqlite3-3.26.0 (3260000)

Obtained from: https://www.sqlite.org/2018/sqlite-autoconf-3260000.tar.gz

5 years agoConditionalize installtion audit(4) tests on MK_AUDIT
asomers [Mon, 17 Dec 2018 18:35:32 +0000 (18:35 +0000)]
Conditionalize installtion audit(4) tests on MK_AUDIT

MK_AUDIT already controls auditd(8), praudit(1), etc.  It should also control
the audit test suite.

Submitted by: ngie
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/240

5 years agoaudit(4) tests: require /etc/rc.d/auditd
asomers [Mon, 17 Dec 2018 18:11:06 +0000 (18:11 +0000)]
audit(4) tests: require /etc/rc.d/auditd

These tests should be skipped if /etc/rc.d/auditd is missing, which could be
the case if world was built with WITHOUT_AUDIT set.  Also, one test case
requires /etc/rc.d/accounting.

Submitted by: ngie
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/240

5 years agoasmc: Add support for mid-2011 Macmini 5,2
dab [Mon, 17 Dec 2018 17:21:45 +0000 (17:21 +0000)]
asmc: Add support for mid-2011 Macmini 5,2

PR: 225911
Submitted by: trev <fbsdbugs4@sentry.org>
Reported by: trev <fbsdbugs4@sentry.org>
MFC after: 1 week

5 years agoadd support for marking interrupt handlers as suspended
avg [Mon, 17 Dec 2018 17:11:00 +0000 (17:11 +0000)]
add support for marking interrupt handlers as suspended

The goal of this change is to fix a problem with PCI shared interrupts
during suspend and resume.

I have observed a couple of variations of the following scenario.
Devices A and B are on the same PCI bus and share the same interrupt.
Device A's driver is suspended first and the device is powered down.
Device B generates an interrupt. Interrupt handlers of both drivers are
called. Device A's interrupt handler accesses registers of the powered
down device and gets back bogus values (I assume all 0xff). That data is
interpreted as interrupt status bits, etc. So, the interrupt handler
gets confused and may produce some noise or enter an infinite loop, etc.

This change affects only PCI devices.  The pci(4) bus driver marks a
child's interrupt handler as suspended after the child's suspend method
is called and before the device is powered down.  This is done only for
traditional PCI interrupts, because only they can be shared.

At the moment the change is only for x86.

Notable changes in core subsystems / interfaces:
- BUS_SUSPEND_INTR and BUS_RESUME_INTR methods are added to bus
  interface along with convenience functions bus_suspend_intr and
  bus_resume_intr;
- rman_set_irq_cookie and rman_get_irq_cookie functions are added to
  provide a way to associate an interrupt resource with an interrupt
  cookie;
- intr_event_suspend_handler and intr_event_resume_handler functions
  are added to the MI interrupt handler interface.

I added two new interrupt handler flags, IH_SUSP and IH_CHANGED, to
implement the new intr_event functions.  IH_SUSP marks a suspended
interrupt handler.  IH_CHANGED is used to implement a barrier that
ensures that a change to the interrupt handler's state is visible
to future interrupts.
While there, I fixed some whitespace issues in comments and changed a
couple of logically boolean variables to be bool.

MFC after: 1 month (maybe)
Differential Revision: https://reviews.freebsd.org/D15755

5 years agoadd a knob that disables detection of write protected disks
avg [Mon, 17 Dec 2018 16:01:37 +0000 (16:01 +0000)]
add a knob that disables detection of write protected disks

It has been reported that on some systems (with real hardware passed
through to a virtual machine) the WP detection causes USB disk probing
failures.

While here, also fix the selection of the next state in the case
of malloc failure in DA_STATE_PROBE_WP.  It was DA_STATE_PROBE_RC
unconditionally even when it should have been DA_STATE_PROBE_RC16.

PR: 225794
Reported by: David Boyd <David.Boyd49@twc.com>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D18496

5 years agoAllow ng_nat to be attached to a ethernet interface directly via ng_ether(4)
sobomax [Mon, 17 Dec 2018 16:00:35 +0000 (16:00 +0000)]
Allow ng_nat to be attached to a ethernet interface directly via ng_ether(4)
or the likes. Add new control message types: setdlt and getdlt to switch
from default DLT_RAW (no encapsulation) to DLT_EN10MB (ethernet).

Approved by: glebius
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D18535

5 years agoAdd removed CTM files to ObsoleteFiles.inc as a follow-up to r342126.
se [Mon, 17 Dec 2018 10:17:56 +0000 (10:17 +0000)]
Add removed CTM files to ObsoleteFiles.inc as a follow-up to r342126.

5 years agoloader: zfs reader should not probe partitionless disks (UEFI case)
tsoome [Mon, 17 Dec 2018 07:43:29 +0000 (07:43 +0000)]
loader: zfs reader should not probe partitionless disks (UEFI case)

With r342151 I did fix the BIOS version of zfs_probe_dev() from accessing
the whole disk, but the fix was not complete - we actually did not check
if the device name was really for whole disk. Since UEFI version
is only calling the zfs_probe_dev() with partitions and not with whole
disk, the UEFI loader was not able to find the zfs pools.

This update does correct the issue by calling archsw.arch_getdev() to
translate the device name back to dev_desc, and we have whole disk when both
partition and slice values are -1.

Reported by: alvisen_gmail.com
Differential Revision: https://reviews.freebsd.org/D18558

5 years agoWork around BIOS quirks on HPE Proliant MicroServer Gen10
grog [Mon, 17 Dec 2018 07:09:46 +0000 (07:09 +0000)]
Work around BIOS quirks on HPE Proliant MicroServer Gen10

PR: 221350
Submitted by: Bob Bishop
Reported by: Rafal Lukawiecki
Reviewed by: jhb
MFC after: 2 weeks

5 years agoAdd revision number for TP-Link TL-WN722N to prevent ambiguity between
avos [Mon, 17 Dec 2018 05:07:57 +0000 (05:07 +0000)]
Add revision number for TP-Link TL-WN722N to prevent ambiguity between
different chipsets.

MFC after: 3 days
X-MFC with: 341786

5 years agoOptionalObsoleteFiles: Fix deleting usr/tests/usr.sbin/sa
asomers [Sun, 16 Dec 2018 23:45:46 +0000 (23:45 +0000)]
OptionalObsoleteFiles: Fix deleting usr/tests/usr.sbin/sa

It's a directory, not a file.

Reported by: ngie
MFC after: 2 weeks
X-MFC-With: 300938

5 years agoConditionally install /etc/rc.d/audit* based on ${MK_AUDIT}
asomers [Sun, 16 Dec 2018 23:38:46 +0000 (23:38 +0000)]
Conditionally install /etc/rc.d/audit* based on ${MK_AUDIT}

/usr/sbin/audit(dist)?d are only installed if ${MK_AUDIT} == yes. Their
supporting scripts should only be installed in those instances as well.

Submitted by: ngie
Reviewed by: emaste
MFC after: 2 weeks
Pull Request: https://github.com/freebsd/freebsd/pull/242

5 years agoMake (no)ro an alias for (no)readonly
phk [Sun, 16 Dec 2018 18:10:55 +0000 (18:10 +0000)]
Make (no)ro an alias for (no)readonly

5 years agoloader: zfs reader should not probe partitionless disks
tsoome [Sun, 16 Dec 2018 08:58:14 +0000 (08:58 +0000)]
loader: zfs reader should not probe partitionless disks

First of all, normal setups can not boot such pools as the tools
do not support installing boot programs.

Secondly, for proper pool configuration detection, we need to checks all
four label copies on disk, 2 from front and 2 from the end of the disk,
but zfs label does not contain the size of the disk - so we depend on
firmware to report the correct disk size or use information from the
partition table.

Without partition table, we only can rely on firmware to report and support
disk IO properly.

There is a specific case: 8TB disks are reported by BIOS to have 4294967295
sectors (0x00000000ffffffff), the sectors reported by OS is 15628053168
(0x00000003a3812ab0), so the reported size is less than actual but is hitting
32-bit max. Unfortuantely the real limit must be even lower because probing
this disk in this system will wnd up with hung system.

UEFI boot of this system seems not to be affected.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18558

5 years agoAdd a missing leading / in a filename.
cy [Sun, 16 Dec 2018 04:06:53 +0000 (04:06 +0000)]
Add a missing leading / in a filename.

MFC after: 3 days

5 years agoDocument new required MI behaviour of pmap_enter(9) for CoW.
kib [Sun, 16 Dec 2018 01:51:38 +0000 (01:51 +0000)]
Document new required MI behaviour of pmap_enter(9) for CoW.

Reviewed by: markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18568

5 years agoperiodic/weekly/340.noid: do not use sysrc(8) that depends
eugen [Sat, 15 Dec 2018 23:20:08 +0000 (23:20 +0000)]
periodic/weekly/340.noid: do not use sysrc(8) that depends
on bsdinstall(8) and may be non-functional
for system built WITHOUT_BSDINSTALL. (*)

Also, add a check for jails sharing whole tree with host (path=/)
and do not skip it.

Reported by: Andre.Albsmeier@siemens.com (*)
MFC after: 1 week

5 years agoRepair build post-r342139
cy [Sat, 15 Dec 2018 22:02:02 +0000 (22:02 +0000)]
Repair build post-r342139

5 years agoRemove, the now very outdated, timed.
gnn [Sat, 15 Dec 2018 21:34:40 +0000 (21:34 +0000)]
Remove, the now very outdated, timed.

Submitted by: Kyle Spiers ksspiers at gmail
Reviewed by: bcr,brooks,bz,sbruno
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D18505

5 years agoClarify panic in set_rootvnode().
mckusick [Sat, 15 Dec 2018 19:18:58 +0000 (19:18 +0000)]
Clarify panic in set_rootvnode().
Check for panic in vfs_mountroot_shuffle().

Sponsored by: Netflix

5 years agoUnder UFS/FFS the VFS_ROOT() function will return an error if the inode
mckusick [Sat, 15 Dec 2018 19:04:50 +0000 (19:04 +0000)]
Under UFS/FFS the VFS_ROOT() function will return an error if the inode
check-hash fails. Panic'ing is not an appropriate response. So, check
for an error return from VFS_ROOT() and when an error is reported,
unwind and return the error.

Reported by:  Gary Jennejohn (gj)
Sponsored by: Netflix

5 years agoEnsure that the inode check-hash is not left zeroed out in the case where
mckusick [Sat, 15 Dec 2018 18:49:30 +0000 (18:49 +0000)]
Ensure that the inode check-hash is not left zeroed out in the case where
the check-hash fails. Prior to the fix in -r342133 the inode with the
zeroed out check-hash was written back to disk causing further confusion.

Reported by:  Gary Jennejohn (gj)
Sponsored by: Netflix

5 years agoReorder ffs_verify_dinode_ckhash() so that it checks the inode check-hash
mckusick [Sat, 15 Dec 2018 18:35:46 +0000 (18:35 +0000)]
Reorder ffs_verify_dinode_ckhash() so that it checks the inode check-hash
before copying in the inode so that the mode and link-count are not set
if the check-hash fails. This change ensures that the vnode will be properly
unwound and recycled rather than being held in the cache.

Initialize the file mode is zero so that if the loading of the inode
fails (for example because of a check-hash failure), the vnode will be
properly unwound and recycled.

Reported by:  Gary Jennejohn (gj)
Sponsored by: Netflix

5 years agoMust set ip->i_effnlink = ip->i_nlink to avoid a soft updates
mckusick [Sat, 15 Dec 2018 17:58:42 +0000 (17:58 +0000)]
Must set ip->i_effnlink = ip->i_nlink to avoid a soft updates
"panic: softdep_update_inodeblock: bad link count" when releasing
a partially initialized vnode after an inode check-hash failure.

Reported by:  Gary Jennejohn <gljennjohn@gmail.com>
Reported by:  Peter Holm (pho)
Sponsored by: Netflix

5 years agoFsck would find, report, and offer to fix inode check-hash failures.
mckusick [Sat, 15 Dec 2018 17:32:47 +0000 (17:32 +0000)]
Fsck would find, report, and offer to fix inode check-hash failures.
If requested to fix the inode check-hash it would confirm having done
it, but then fail to make the fix. The same code is used in fsdb which,
unlike fsck, would actually fix the inode check-hash.

The discrepancy occurred because fsck has two ways to fetch inodes.
The inode by number function ginode() and the streaming inode
function getnextinode() used during pass1. Fsdb uses the ginode()
function which correctly does the fix, while fsck first encounters
the bad inode check-hash in pass1 where it is using the getnextinode()
function that failed to make the correction. This patch corrects
the getnextinode() function so that fsck now correctly fixes inodes
with incorrect inode check-hashs.

Reported by:  Gary Jennejohn <gljennjohn@gmail.com>
Sponsored by: Netflix

5 years agoRevert r331567 CC Cubic: fix underflow for cubic_cwnd()
hiren [Sat, 15 Dec 2018 17:01:16 +0000 (17:01 +0000)]
Revert r331567 CC Cubic: fix underflow for cubic_cwnd()

This change is causing TCP connections using cubic to hang. Need to dig more to
find exact cause and fix it.

Reported by: tj at mrsk dot me, Matt Garber (via twitter)
Discussed with: sbruno (previously), allanjude, cperciva
MFC after: 3 days

5 years agoRemove CTM from 13-CURRENT after the release of FreeBSD-12.0.
se [Sat, 15 Dec 2018 16:53:15 +0000 (16:53 +0000)]
Remove CTM from 13-CURRENT after the release of FreeBSD-12.0.

The removal (and creation of a port) has been pre-announced in UPDATING
1 month ago. Packages are available for all supported FreeBSD vesions.

I did not think that another entry in UPDATING is required to note the
actual removal.

No MFC is planned - CTM shall be kept in base for all releases up to 12.x.

Reviewed by: rgrimes
Approved by: imp, bcr (manpages)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D17935

5 years agoFix bugs in plugable CC algorithm and siftr sysctls.
brooks [Sat, 15 Dec 2018 15:06:22 +0000 (15:06 +0000)]
Fix bugs in plugable CC algorithm and siftr sysctls.

Use the sysctl_handle_int() handler to write out the old value and read
the new value into a temporary variable. Use the temporary variable
for any checks of values rather than using the CAST_PTR_INT() macro on
req->newptr. The prior usage read directly from userspace memory if the
sysctl() was called correctly. This is unsafe and doesn't work at all on
some architectures (at least i386.)

In some cases, the code could also be tricked into reading from kernel
memory and leaking limited information about the contents or crashing
the system. This was true for CDG, newreno, and siftr on all platforms
and true for i386 in all cases. The impact of this bug is largest in
VIMAGE jails which have been configured to allow writing to these
sysctls.

Per discussion with the security officer, we will not be issuing an
advisory for this issue as root access and a non-default config are
required to be impacted.

Reviewed by: markj, bz
Discussed with: gordon (security officer)
MFC after: 3 days
Security: kernel information leak, local DoS (both require root)
Differential Revision: https://reviews.freebsd.org/D18443

5 years agoAdd new USB id in rtwn_usb(4) (RTL8812AU)
avos [Sat, 15 Dec 2018 14:58:45 +0000 (14:58 +0000)]
Add new USB id in rtwn_usb(4) (RTL8812AU)

PR: 234029
Submitted by: <hakotani000@gmail.com>
MFC after: 4 days

5 years agoUpdate clang, llvm, lld, lldb, compiler-rt and libc++ version number to
dim [Sat, 15 Dec 2018 14:08:41 +0000 (14:08 +0000)]
Update clang, llvm, lld, lldb, compiler-rt and libc++ version number to
7.0.1 release r349250.  There were no functional changes since the 7.0.1
rc3 import.

PR: 230240, 230355
Relnotes: yes
MFC after: 2 months
X-MFC-With: r341825

5 years agoMake fsck(8) use pread(2). This cuts the number of syscalls by half.
trasz [Sat, 15 Dec 2018 11:36:20 +0000 (11:36 +0000)]
Make fsck(8) use pread(2). This cuts the number of syscalls by half.

Reviewed by: kib, mckusick
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17586

5 years agoAdd kern.rpc.gss.client_max, to make it possible to bump it easily.
trasz [Sat, 15 Dec 2018 11:32:11 +0000 (11:32 +0000)]
Add kern.rpc.gss.client_max, to make it possible to bump it easily.
This can drastically lower the load on gssd(8) on large NFS servers.

Submitted by: Per Andersson <pa at chalmers dot se>
Reviewed by: rmacklem@
MFC after: 2 weeks
Sponsored by: Chalmers University of Technology
Differential Revision: https://reviews.freebsd.org/D18393

5 years agoImprove R_AARCH64_TLSDESC relocation.
mmel [Sat, 15 Dec 2018 10:38:07 +0000 (10:38 +0000)]
Improve R_AARCH64_TLSDESC relocation.
The original code did not support dynamically loaded libraries and used
suboptimal access to TLS variables.
New implementation removes lazy resolving of TLS relocation - due to flaw
in TLSDESC design is impossible to switch resolver function at runtime
without expensive locking.

Due to this, 3 specialized resolvers are implemented:
 - load time resolver for TLS relocation from libraries loaded with main
   executable (thus with known TLS offset).
 - resolver for undefined thread weak symbols.
 - slower lazy resolver for dynamically loaded libraries with fast path for
   already resolved symbols.

PR: 228892, 232149, 233204, 232311
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18417

5 years agoRevert accidentally included changes in r342108
cem [Sat, 15 Dec 2018 05:47:22 +0000 (05:47 +0000)]
Revert accidentally included changes in r342108

If you're curious, please follow along in https://reviews.freebsd.org/D18537 .

Sorry for the noise.

5 years agoefirt: When present, attempt to use EFI runtime services to shutdown
cem [Sat, 15 Dec 2018 05:46:04 +0000 (05:46 +0000)]
efirt: When present, attempt to use EFI runtime services to shutdown

PR: maybe related to 233998 (inconclusive at this time)
Submitted by: byuu <byuu AT tutanota.com> (previous version)
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D18506

5 years agopowerpcspe: Don't require FPU_EMU for powerpcspe IEEE emulation
jhibbits [Sat, 15 Dec 2018 04:53:02 +0000 (04:53 +0000)]
powerpcspe: Don't require FPU_EMU for powerpcspe IEEE emulation

Build only the necessary fpu_emu files for supporting the SPE IEEE-754
emulation exception handler.

MFC after: 1 week

5 years ago[mv_pci] Do not attempt to attach disabled PCI ports
gonzo [Sat, 15 Dec 2018 02:35:48 +0000 (02:35 +0000)]
[mv_pci] Do not attempt to attach disabled PCI ports

Fail probe for PCI port if the respective FDT node is not enabled

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

5 years agomake_dtb.sh: Use $CPP instead of assuming that cpp is in $PATH
arichardson [Fri, 14 Dec 2018 23:53:28 +0000 (23:53 +0000)]
make_dtb.sh: Use $CPP instead of assuming that cpp is in $PATH

This fixes building in CheriBSD with a strict tmp path since we don't
bootstrap a cpp but pass the full path to clang-cpp instead.

While touching this file also fix all shellcheck warnings in make_dtb.sh.

Reviewed By: manu
Differential Revision: https://reviews.freebsd.org/D18376

5 years agoFix error check for ACPI_ID_PROBE in the TPM2.0 driver
mw [Fri, 14 Dec 2018 22:22:43 +0000 (22:22 +0000)]
Fix error check for ACPI_ID_PROBE in the TPM2.0 driver

Updated API does not return pointer, so adjust the
TPM2.0 driver accordingly.

Reported by: jhb
Obtained from: Semihalf
Sponsored by: Stormshield

5 years ago[twsi] Make extres/clk part conditional based on the EXT_RESOURCES option value
gonzo [Fri, 14 Dec 2018 21:17:42 +0000 (21:17 +0000)]
[twsi] Make extres/clk part conditional based on the EXT_RESOURCES option value

This should fix kernel build for ARMADA38X and possibly some other ARM configs

Approved by: manu

5 years agoAllow bootstrapping libnv on macOS and Linux
arichardson [Fri, 14 Dec 2018 21:16:04 +0000 (21:16 +0000)]
Allow bootstrapping libnv on macOS and Linux

MacOS/Linux do not define struct cmsgcred but we need to bootstrap libnv
when building on non-FreeBSD systems. Since they are not used during
bootstrap we can just omit these two functions there.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D18472

5 years agoAdd some more checking to the RISC-V page fault handler.
markj [Fri, 14 Dec 2018 21:07:12 +0000 (21:07 +0000)]
Add some more checking to the RISC-V page fault handler.

- Panic immediately if witness says we're holding non-sleepable locks.
  This helps ensure that we don't recurse on the pmap lock in
  pmap_fault_fixup().
- Panic if the kernel faults on a user address without setting an
  onfault handler.
- Panic if the fault occurred in a critical section or interrupt
  handler, like we do on other platforms.
- Fix some style issues in trap_pfault().

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18561

5 years agoAvoid needless TLB invalidations in pmap_remove_pages().
markj [Fri, 14 Dec 2018 21:04:30 +0000 (21:04 +0000)]
Avoid needless TLB invalidations in pmap_remove_pages().

pmap_remove_pages() is called during process termination, when it is
guaranteed that no other CPU may access the mappings being torn down.
In particular, it unnecessary to invalidate each mapping individually
since we do a pmap_invalidate_all() at the end of the function.

Also don't call pmap_invalidate_all() while holding a PV list lock, the
global pvh lock is sufficient.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18562

5 years agoAssume that pmap_l1() will return a PTE.
markj [Fri, 14 Dec 2018 21:03:01 +0000 (21:03 +0000)]
Assume that pmap_l1() will return a PTE.

pmaps on RISC-V always have an L1 page table page, so we don't need to
check for this when performing lookups.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18563

5 years agoAdd a QEMU config for RISC-V.
markj [Fri, 14 Dec 2018 21:00:41 +0000 (21:00 +0000)]
Add a QEMU config for RISC-V.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18560

5 years agoEnable witness(4) in the RISC-V GENERIC config.
markj [Fri, 14 Dec 2018 20:57:57 +0000 (20:57 +0000)]
Enable witness(4) in the RISC-V GENERIC config.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18559

5 years agoatomic_cmpset return value is also an int.
imp [Fri, 14 Dec 2018 19:48:42 +0000 (19:48 +0000)]
atomic_cmpset return value is also an int.

5 years agoatomic_fcmpset* return int, not the type of *.
imp [Fri, 14 Dec 2018 19:14:51 +0000 (19:14 +0000)]
atomic_fcmpset* return int, not the type of *.

fcmpset returns true/false as a int, so make the return types and
variables match the int to be consistent with other arch.

Reviewed by: cognet@
Differential Revision: https://reviews.freebsd.org/D18557

5 years agoClean up the riscv pmap_bootstrap() implementation.
markj [Fri, 14 Dec 2018 18:50:32 +0000 (18:50 +0000)]
Clean up the riscv pmap_bootstrap() implementation.

- Build up phys_avail[] in a single loop, excluding memory used by
  the loaded kernel.
- Fix an array indexing bug in the aforementioned phys_avail[]
  initialization.[1]
- Remove some unneeded code copied from the arm64 implementation.

PR: 231515 [1]
Reviewed by: jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18464

5 years agoallwinner: aw_pwm: Read value at attach
manu [Fri, 14 Dec 2018 18:39:17 +0000 (18:39 +0000)]
allwinner: aw_pwm: Read value at attach

The booloaded might have configured the pwm controller so read the values.

5 years agopwm(8): Add percentage value support for duty cycle
manu [Fri, 14 Dec 2018 18:38:10 +0000 (18:38 +0000)]
pwm(8): Add percentage value support for duty cycle

5 years agopwm: Convert period and duty to unsigned int
manu [Fri, 14 Dec 2018 18:37:26 +0000 (18:37 +0000)]
pwm: Convert period and duty to unsigned int

We don't need a 64 bits value to store nanoseconds

Discused with: ian, jhibbits

5 years agoAdd support for the nForce MCP89 adapter.
markj [Fri, 14 Dec 2018 18:16:35 +0000 (18:16 +0000)]
Add support for the nForce MCP89 adapter.

PR: 234015
Submitted by: Andrejs Bogdanovs <sinchiroca86@gmail.com>
MFC after: 1 week

5 years agoFix TPM driver compilation from r342084
mw [Fri, 14 Dec 2018 17:43:35 +0000 (17:43 +0000)]
Fix TPM driver compilation from r342084

Include recent ACPI_ID_PROBE API change.

5 years agoIntroduce driver for TPM 2.0 in CRB and FIFO (TIS) modes
mw [Fri, 14 Dec 2018 16:14:36 +0000 (16:14 +0000)]
Introduce driver for TPM 2.0 in CRB and FIFO (TIS) modes

It was written basing on:
TCG PC Client Platform TPM Profile (PTP) Specification Version 22, Revision 1.03.
It only supports Locality 0. Interrupts are only supported in FIFO mode.

The driver in FIFO mode was tested on x86 with Infineon SLB9665 discrete TPM chip.
Driver in both modes was also tested on qemu with swtpm running on host.

Submitted by: Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D18048

5 years agoCompilation failure on ppc and mips due to Revision 342066.
kadesai [Fri, 14 Dec 2018 10:49:48 +0000 (10:49 +0000)]
Compilation failure on ppc and mips due to Revision 342066.
Adding extra memset on chain frame.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoarm64: allwinner: axp81x: Fix double invertion for FLDO1
manu [Fri, 14 Dec 2018 10:26:17 +0000 (10:26 +0000)]
arm64: allwinner: axp81x: Fix double invertion for FLDO1

This fix booting on A64 boards when disabling the unused regulators at boot.
We did disable all the regulator handled by register 0x13 which of course contain
mandatory regulators for the board to be up.

Reported by: Mark Millard <marklmi@yahoo.com>
X-MFC-With: r340848

5 years agoichwd: add Sunrise Point-LP ID
avg [Fri, 14 Dec 2018 09:30:43 +0000 (09:30 +0000)]
ichwd: add Sunrise Point-LP ID

Submitted by: Tetsuya Uemura <t_uemura@macome.co.jp>
Tested by: Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after: 2 weeks
Relnotes: maybe

5 years agoichwd: add support for clearing No Reboot bit in TCOv4
avg [Fri, 14 Dec 2018 09:28:20 +0000 (09:28 +0000)]
ichwd: add support for clearing No Reboot bit in TCOv4

This is based on a patch developed by
Tetsuya Uemura <t_uemura@macome.co.jp>.
Many thanks!

Submitted by: Tetsuya Uemura <t_uemura@macome.co.jp> (earlier version)
Tested by: Tetsuya Uemura <t_uemura@macome.co.jp>
MFC after: 2 weeks

5 years agong_bpf.4: fix EXAMPLES: do not activate promiscuous mode
eugen [Fri, 14 Dec 2018 09:24:14 +0000 (09:24 +0000)]
ng_bpf.4: fix EXAMPLES: do not activate promiscuous mode

PR: 102719
MFC after: 3 days

5 years agoDriver version upgrade 07.708.02.00-fbsd
kadesai [Fri, 14 Dec 2018 08:06:39 +0000 (08:06 +0000)]
Driver version upgrade 07.708.02.00-fbsd

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will increase debug level as current logging level has
kadesai [Fri, 14 Dec 2018 08:05:49 +0000 (08:05 +0000)]
This patch will increase debug level as current logging level has
very minimal prints and even few important messages will not get logged.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoChange IOC INIT wait time to 180 secs to keep it inline with timeout
kadesai [Fri, 14 Dec 2018 08:05:01 +0000 (08:05 +0000)]
Change IOC INIT wait time to 180 secs to keep it inline with timeout
used by internal DCMDs.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for NVME PRPs creation by driver for fastpath
kadesai [Fri, 14 Dec 2018 08:04:16 +0000 (08:04 +0000)]
This patch will add support for NVME PRPs creation by driver for fastpath
capable IOs. NVME specification supports specific type of scatter gather list
called as PRP (Physical Region Page) for IO data buffers. Since NVME drive is
connected behind SAS3.5 tri-mode adapter, MegaRAID driver/firmware has to convert
OS SGLs in native NVMe PRP format. For IOs sent to firmware, MegaRAID firmware
does this job of OS SGLs to PRP translation and send PRPs to backend NVME device.
For fastpath IOs, driver will do this OS SGLs to PRP translation.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for new DCMD to get PD information and a single data...
kadesai [Fri, 14 Dec 2018 08:03:28 +0000 (08:03 +0000)]
This patch will add support for new DCMD to get PD information and a single data structure
to specify LD and JBOD.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoTo improve RAID 1/10 Write performance, OS drivers need to issue the
kadesai [Fri, 14 Dec 2018 08:02:44 +0000 (08:02 +0000)]
To improve RAID 1/10 Write performance, OS drivers need to issue the
required Write IOs as Fast Path IOs (after the appropriate checks
allowing Fast Path to be used) to the appropriate physical drives
(translated from the OS logical IO) and wait for all Write IOs to complete.

Design: A write IO on RAID volume will be examined if it can be sent in
Fast Path based on IO size and starting LBA and ending LBA falling on to
a Physical Drive boundary. If the underlying RAID volume is a RAID 1/10,
driver issues two fast path write IOs one for each corresponding physical
drive after computing the corresponding start LBA for each physical drive.
Both write IOs will have the same payload and are posted to HW such that
replies land in the same reply queue.

If there are no resources available for sending two IOs, driver will send
the original IO from upper layer to RAID volume through the Firmware.

When both IOs are completed by HW, the resources will be released
and SCSI IO completion handler will be called.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoDetect sequential Write IOs and pass the hint that it is part of sequential
kadesai [Fri, 14 Dec 2018 08:01:49 +0000 (08:01 +0000)]
Detect sequential Write IOs and pass the hint that it is part of sequential
stream to help HBA Firmware do the Full Stripe Writes. For read IOs on
certain RAID volumes like Read Ahead volumes,this will help driver to
send it to Firmware even if the IOs can potentially be sent to
hardware directly (called fast path) bypassing firmware.

Design: 8 streams are maintained per RAID volume as per the combined
firmware/driver design. When there is no stream detected the LRU stream
is used for next potential stream and LRU/MRU map is updated to make this
as MRU stream. Every time a stream is detected the MRU map
is updated to make the current stream as MRU stream.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add new interface to support more than 256 JBODs.
kadesai [Fri, 14 Dec 2018 08:00:45 +0000 (08:00 +0000)]
This patch will add new interface to support more than 256 JBODs.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for divert bitmap in RAID map. Divert bitmap is supported for
kadesai [Fri, 14 Dec 2018 08:00:01 +0000 (08:00 +0000)]
This patch will add support for divert bitmap in RAID map. Divert bitmap is supported for
SAS3.5 adapters only.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for new Dynamic RaidMap to have different sizes
kadesai [Fri, 14 Dec 2018 07:59:09 +0000 (07:59 +0000)]
This patch will add support for new Dynamic RaidMap to have different sizes
for different number of supported VDs for SAS3.5 MegaRAID adapters.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agoThis patch will add support for next generation(SAS3.5) of Tri mode(SAS, SATA, NVMe)
kadesai [Fri, 14 Dec 2018 07:57:00 +0000 (07:57 +0000)]
This patch will add support for next generation(SAS3.5) of Tri mode(SAS, SATA, NVMe)
MegaRAID adapters.

Submitted by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed by:  Kashyap Desai <Kashyap.Desai@broadcom.com>
Approved by:  ken
MFC after:  3 days
Sponsored by:   Broadcom Inc

5 years agovfs: mostly depessimize NDINIT_ALL
mjg [Fri, 14 Dec 2018 03:55:08 +0000 (03:55 +0000)]
vfs: mostly depessimize NDINIT_ALL

1) filecaps_init was unnecesarily a function call
2) an asignment at the end was preventing tail calling of cap_rights_init

Sponsored by: The FreeBSD Foundation

5 years agoDo not complain when /dev/crypto does not exist.
jkim [Fri, 14 Dec 2018 01:06:34 +0000 (01:06 +0000)]
Do not complain when /dev/crypto does not exist.

Now the new devcrypto engine is enabled since r342009, many users started
seeing "Could not open /dev/crypto: No such file or directory".  Disable
the annoying error message as it is not very useful anyway.

Note the patch was submitted upstream.

https://github.com/openssl/openssl/pull/7896

5 years agoMFV: r342049
jkim [Fri, 14 Dec 2018 00:40:38 +0000 (00:40 +0000)]
MFV: r342049

Merge ACPICA 20181213.

5 years agoCast error message in efi_main.c to CHAR16* to avoid build error
bcran [Thu, 13 Dec 2018 23:49:20 +0000 (23:49 +0000)]
Cast error message in efi_main.c to CHAR16* to avoid build error

5 years agoPrint an error message in efi_main.c if we can't allocate memory for the heap
bcran [Thu, 13 Dec 2018 23:20:58 +0000 (23:20 +0000)]
Print an error message in efi_main.c if we can't allocate memory for the heap

With the default Qemu parameters, only 128MB RAM gets given to a VM. This causes
the loader to be unable to allocate the 64MB it needs for the heap. This change
makes the cause of the error more obvious.

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

5 years agodtrace: fix userspace access on boxes with SMAP
mjg [Thu, 13 Dec 2018 20:09:38 +0000 (20:09 +0000)]
dtrace: fix userspace access on boxes with SMAP

dtrace has its own routines which were not updated after SMAP support got
implemented. Use ifunc just like for other routines.

This in particular fixes ustack().

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18542

5 years agonda(4) fix check for Dataset Management support
chuck [Thu, 13 Dec 2018 13:25:37 +0000 (13:25 +0000)]
nda(4) fix check for Dataset Management support

In the nda(4) driver, only set DISKFLAG_CANDELETE (a.k.a. can support
BIO_DELETE) if the drive supports Dataset Management. There are reports
that without this check, VMWare Workstation does not work reliably.

Fix is to check the ONCS field in the NVMe Controller Data structure for
support. This check previously existed but did not survive the
big-endian changes.

Reported by: yuripv@yuripv.net
Reviewed by: imp, mav, jimharris
Approved by: imp (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18493