]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
5 years agoSilence Clang Scan warning about use of unitialized variable.
se [Wed, 23 Jan 2019 10:05:27 +0000 (10:05 +0000)]
Silence Clang Scan warning about use of unitialized variable.

While the warning is a false positive, it is possible to clarify the code by
always initializing the variable. This does also allow to make the sending
of the "beep" control sequence depend on the validity of its parameters.

I have left the redundant assignment of 0 to the now initialized variables
in place since this makes the code simpler to understand and does not add
any run-time overhead (the compiler completely removes the "else if" test
and the assignments).

There was an embedded literal escape character in a string, which messes up
diplaying the source code on a terminal that interprets ANSI sequences. The
literal escape has been replaced by \e (non-standard, but supported by all
relevant compilers, and already used in other source files in base).

MFC after: 2 weeks

5 years agoFix systat's :only command parser for the multiple arguments case
gonzo [Wed, 23 Jan 2019 02:46:35 +0000 (02:46 +0000)]
Fix systat's :only command parser for the multiple arguments case

According to systat(1) :only option is supposed to accept multiple drives
but the parser for its arguments stops after first entry. Fix the parser
logic to accept multiple drives.

PR: 59220
Reported by: Andy Farkas <andyf@speednet.com.au>
MFC after: 1 week

5 years agolibbe(3): simplify import, allow replication streams
kevans [Wed, 23 Jan 2019 02:09:15 +0000 (02:09 +0000)]
libbe(3): simplify import, allow replication streams

Previously, we directly used libzfs_core's lzc_receive to import to a
temporary snapshot, then cloned the snapshot and setup the properties. This
failed when attempting to import replication streams with questionable
error.

libzfs's zfs_receive is a much better fit here, so we now use it instead
with the destination dataset and let libzfs take care of the dirty details.
be_import is greatly simplified as a result.

Reported by: Marie Helene Kvello-Aune <freebsd@mhka.no>
MFC after: 1 week

5 years agoAdd quirk to enable mic and headphones redirection on HP Spectre laptops.
wulf [Tue, 22 Jan 2019 22:39:46 +0000 (22:39 +0000)]
Add quirk to enable mic and headphones redirection on HP Spectre laptops.

Tested on HP AF006UR.

MFC after: 2 weeks

5 years agoRework CASE_IOC_IFGROUPREQ() to require a case before the macro.
brooks [Tue, 22 Jan 2019 17:39:26 +0000 (17:39 +0000)]
Rework CASE_IOC_IFGROUPREQ() to require a case before the macro.

This is more compatible with formatting tools and looks more normal.

Reported by: jhb (on a different review)
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18442

5 years agoSilence a CI warning regarding the use of strcpy().
se [Tue, 22 Jan 2019 13:11:15 +0000 (13:11 +0000)]
Silence a CI warning regarding the use of strcpy().

While this is a false positive (a sufficiently large buffer has been
allocated in the line above), the use of strdup() simplifies and clarifies
the code.

MFC after: 2 weeks

5 years agoRemove unused *_sysinit_flags() declarations.
kib [Tue, 22 Jan 2019 12:56:49 +0000 (12:56 +0000)]
Remove unused *_sysinit_flags() declarations.

Submitted by: Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after: 3 days

5 years agoAdd missing dependency to vmxnet3 Makefile and clean it up a bit otherwise.
pkelsey [Tue, 22 Jan 2019 04:36:19 +0000 (04:36 +0000)]
Add missing dependency to vmxnet3 Makefile and clean it up a bit otherwise.

MFC after: 1 week

5 years ago[ndis] Fix unregistered use of FPU by NDIS in kernel on amd64
gonzo [Tue, 22 Jan 2019 03:53:42 +0000 (03:53 +0000)]
[ndis] Fix unregistered use of FPU by NDIS in kernel on amd64

amd64 miniport drivers are allowed to use FPU which triggers "Unregistered use
of FPU in kernel" panic.

Wrap all variants of MSCALL with fpu_kern_enter/fpu_kern_leave.  To reduce
amount of allocations/deallocations done via
fpu_kern_alloc_ctx/fpu_kern_free_ctx maintain cache of fpu_kern_ctx elements.

Based on the patch by Paul B Mahol

PR: 165622
Submitted by: Vlad Movchan <vladislav.movchan@gmail.com>
MFC after: 1 month

5 years agopf tests: Check size validation in DIOCGETSRCNODES
kp [Tue, 22 Jan 2019 02:56:36 +0000 (02:56 +0000)]
pf tests: Check size validation in DIOCGETSRCNODES

Ensure that invalid sizes for DIOCGETSRCNODES do not cause panics.

MFC after:  1 week

5 years agoRemove unused function gsc_destroy()
pkelsey [Tue, 22 Jan 2019 02:53:59 +0000 (02:53 +0000)]
Remove unused function gsc_destroy()

gsc_destroy() is no longer needed as of r343287.

MFC after: 1 week

5 years agopf: Validate psn_len in DIOCGETSRCNODES
kp [Tue, 22 Jan 2019 02:13:33 +0000 (02:13 +0000)]
pf: Validate psn_len in DIOCGETSRCNODES

psn_len is controlled by user space, but we allocated memory based on it.
Check how much memory we might need at most (i.e. how many source nodes we
have) and limit the allocation to that.

Reported by: markj
MFC after: 1 week

5 years agoiwn(4): drop i_seq field initialization for A-MPDU frames.
avos [Tue, 22 Jan 2019 01:44:47 +0000 (01:44 +0000)]
iwn(4): drop i_seq field initialization for A-MPDU frames.

It is done by net80211 since r319460.

MFC after: 24 days
X-MFC-With: 343094

5 years agoonvert vmx(4) to being an iflib driver.
pkelsey [Tue, 22 Jan 2019 01:11:17 +0000 (01:11 +0000)]
onvert vmx(4) to being an iflib driver.

Also, expose IFLIB_MAX_RX_SEGS to iflib drivers and add
iflib_dma_alloc_align() to the iflib API.

Performance is generally better with the tunable/sysctl
dev.vmx.<index>.iflib.tx_abdicate=1.

Reviewed by: shurd
MFC after: 1 week
Relnotes: yes
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18761

5 years agoFix various resource leaks that can occur in the error paths of
pkelsey [Tue, 22 Jan 2019 00:56:44 +0000 (00:56 +0000)]
Fix various resource leaks that can occur in the error paths of
iflib_device_register() and iflib_pseudo_register().

Reviewed by: shurd
MFC after: 1 week
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18760

5 years agoReduce pf.conf parsing cost for configs that define N queues from O(N^2) to O(N)
pkelsey [Tue, 22 Jan 2019 00:50:24 +0000 (00:50 +0000)]
Reduce pf.conf parsing cost for configs that define N queues from O(N^2) to O(N)

The number of syscalls made during parsing of any config that
defines tables is also reduced, and incorrect warnings that HFSC
parent queue bandwidths were smaller than the sum of their child
bandwidths have been fixed.

Reviewed by: kp
MFC after: 1 week
Sponsored by: RG Nets
Differential Revision: https://reviews.freebsd.org/D18759

5 years agonfs: Zero the buffers exported by NFSSVC_DUMPCLIENTS and DUMPLOCKS.
markj [Mon, 21 Jan 2019 23:54:33 +0000 (23:54 +0000)]
nfs: Zero the buffers exported by NFSSVC_DUMPCLIENTS and DUMPLOCKS.

Note that these interfaces are available only to root.

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: rmacklem
MFC after: 1 day
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agoList caph_limit_stream() in the synopsis.
markj [Mon, 21 Jan 2019 20:56:29 +0000 (20:56 +0000)]
List caph_limit_stream() in the synopsis.

Fix typos while here.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

5 years agoOptimize RISC-V copyin(9)/copyout(9) routines.
markj [Mon, 21 Jan 2019 19:38:53 +0000 (19:38 +0000)]
Optimize RISC-V copyin(9)/copyout(9) routines.

The existing copyin(9) and copyout(9) routines on RISC-V perform only a
simple byte-by-byte copy.  Improve their performance by performing
word-sized copies where possible.

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

5 years agoDeduplicate common code in copyin()/copyout() with a macro.
markj [Mon, 21 Jan 2019 19:37:12 +0000 (19:37 +0000)]
Deduplicate common code in copyin()/copyout() with a macro.

No functional change intended.

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

5 years agofreebsd-update: Allow upgrade from pre-release builds
emaste [Mon, 21 Jan 2019 19:21:11 +0000 (19:21 +0000)]
freebsd-update: Allow upgrade from pre-release builds

Update r343122 to include -ALPHA, -BETA and -RC releases as
upgrade-able via freebsd-update.

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: delphij, des
Reviewed by: delphij
MFC with: r343122
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18881

5 years agofreebsd-update: Update /etc/passwd after password db changes
emaste [Mon, 21 Jan 2019 19:04:37 +0000 (19:04 +0000)]
freebsd-update: Update /etc/passwd after password db changes

Add -p to pwd_mkdb in order to ensure password db changes are also
included in /etc/passwd.

PR: 165954, 232921, 229487
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: jilles
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18827

5 years agocxgbe(4): Allow negative values in hw.cxgbe.fw_install and take them to
np [Mon, 21 Jan 2019 18:42:16 +0000 (18:42 +0000)]
cxgbe(4): Allow negative values in hw.cxgbe.fw_install and take them to
mean that the driver should taste the firmware in the KLD and use that
firmware's version for all its fw_install checks.

The driver gets firmware version information from compiled-in values by
default and this change allows custom (or older/newer) firmware modules
to be used with the stock driver.

There is no change in default behavior.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agofrebsd-update: fix --currently-running after r343122
emaste [Mon, 21 Jan 2019 18:41:57 +0000 (18:41 +0000)]
frebsd-update: fix --currently-running after r343122

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: Brandon Schneider
MFC with: r343122
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18896

5 years agohwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.
markj [Mon, 21 Jan 2019 18:07:02 +0000 (18:07 +0000)]
hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
MFC after: 1 day
Security: Kernel memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agocxgbe(4): Use a truncated firmware header for version checks. All the
np [Mon, 21 Jan 2019 17:58:06 +0000 (17:58 +0000)]
cxgbe(4): Use a truncated firmware header for version checks.  All the
version numbers are towards the begining of the header.

MFC after: 1 week
Sponsored by: Chelsio Communications

5 years agolinuxulator: fix stack memory disclosure in linux_sigaltstack
emaste [Mon, 21 Jan 2019 17:12:16 +0000 (17:12 +0000)]
linuxulator: fix stack memory disclosure in linux_sigaltstack

Most siginfo_to_lsiginfo callers already zeroed the l_siginfo_t before
callit it, but linux_waitid did not.  Instead of zeroing in the called
function to address linux_waitid (as in commit 2e6ebe70), just do it in
linux_waitid.

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: Andrew
MFC after: 1 day
Security: Kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agolinuxulator: fix stack memory disclosure in linux_sigaltstack
emaste [Mon, 21 Jan 2019 16:25:40 +0000 (16:25 +0000)]
linuxulator: fix stack memory disclosure in linux_sigaltstack

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: andrew
MFC after: 1 day
Security: Kernel memory disclosure
Sponsored by:   The FreeBSD Foundation

5 years agolinuxulator: fix stack memory disclosure in linux_ioctl_termio
emaste [Mon, 21 Jan 2019 16:21:03 +0000 (16:21 +0000)]
linuxulator: fix stack memory disclosure in linux_ioctl_termio

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: andrew
MFC after: 1 day
Security: Kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agolinuxulator: fix stack memory disclosure in linux_ioctl_v4l
emaste [Mon, 21 Jan 2019 16:19:02 +0000 (16:19 +0000)]
linuxulator: fix stack memory disclosure in linux_ioctl_v4l

admbugs: 765
Reported by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Reviewed by: andrew
MFC after: 1 day
Security: Kernel stack memory disclosure
Sponsored by: The FreeBSD Foundation

5 years agoCorrect a typo: was -> way.
gjb [Mon, 21 Jan 2019 15:27:58 +0000 (15:27 +0000)]
Correct a typo: was -> way.

Submitted by: Larry Hynes
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agoawg: fix soft reset failure with no link
kevans [Mon, 21 Jan 2019 14:35:36 +0000 (14:35 +0000)]
awg: fix soft reset failure with no link

U-Boot will leave the ephy reset de-asserted and the MAC soft reset will
fail on these boards with internal PHY and no link established. Toggle reset
again before proceeding to attach/init.

MFC after: 1 week

5 years agoFix duplicate wpa_supplicant(8) / hostapd(8) startup with devd(8)
avos [Mon, 21 Jan 2019 04:50:56 +0000 (04:50 +0000)]
Fix duplicate wpa_supplicant(8) / hostapd(8) startup with devd(8)

Do not invoke 'wlan_up' function from devd(8) on interface
creation event (an example to create such event:
'ifconfig wlan0 create wlandev rtwn0');
they're typically produced during 'service netif (re)start'
and result in duplicate interface initialization.

From the user side if WPA option is used, this result in messages like:
- /etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
or
- wpa_supplicant already running?  (pid=xxxx).
(for HOSTAP interfaces this race may result in startup failure).

As a side effect, wpa_supplicant(8) / hostapd(8) will not be
invoked when new wlan(4) interface is created manually and
corresponding configuration for it is present in rc.conf(5).

This change does not affect device attach / removal events.

MFC after: 5 days

5 years agoFix cmp(1) tests for "special" mode.
markj [Mon, 21 Jan 2019 03:57:49 +0000 (03:57 +0000)]
Fix cmp(1) tests for "special" mode.

Test failures don't seem to propagate up if atf_check is run in
a pipeline.  Thus, the tests continued to pass despite the bug reverted
in r343245.

MFC after: 1 week

5 years agoRevert r343117.
markj [Mon, 21 Jan 2019 03:47:20 +0000 (03:47 +0000)]
Revert r343117.

It breaks the special mode specified by passing "-" as one of the
input files.  Revert for now while we discuss a fix.

PR: 234885
Reported by: delphij
MFC after: now

5 years agodevd.conf(5): add otus(4) into wifi-driver-regex
avos [Mon, 21 Jan 2019 03:38:37 +0000 (03:38 +0000)]
devd.conf(5): add otus(4) into wifi-driver-regex

MFC after: 5 days

5 years agoiwm(4): Fix possible null pointer indirection
kevans [Mon, 21 Jan 2019 01:45:35 +0000 (01:45 +0000)]
iwm(4): Fix possible null pointer indirection

Obtained from: DragonFlyBSD (obtained from Haiku)
MFC after: 1 week

5 years agourtw(4): add length checks in Rx path.
avos [Mon, 21 Jan 2019 00:53:38 +0000 (00:53 +0000)]
urtw(4): add length checks in Rx path.

- Check if buffer can contain Rx descriptor before accessing it.
- Verify upper / lower bounds for frame length.
- Do not pass too short frames into ieee80211_find_rxnode().

While here:
- Move cleanup to the function end.
- Reuse IEEE80211_IS_DATA() macro.

MFC after: 1 week

5 years agoiwn(4): drop return code from iwn_*attach functions (they cannot fail)
avos [Mon, 21 Jan 2019 00:09:54 +0000 (00:09 +0000)]
iwn(4): drop return code from iwn_*attach functions (they cannot fail)

While here, add missing trace 'end' marker in iwn5000_attach().

MFC after: 1 week

5 years agorun(4): add more length checks in Rx path.
avos [Mon, 21 Jan 2019 00:03:35 +0000 (00:03 +0000)]
run(4): add more length checks in Rx path.

- Discard frames that are bigger than MCLBYTES (to prevent buffer overrun).
- Check buffer length before accessing its contents.
- Fix len <-> dmalen check - the last includes Rx Wireless information
structure size.
- Fix out-of-bounds read during Rx node search for ACK / CTS frames
(monitor mode only).

While here:
- Mark few suspicious places with comments.
- Move common cleanup to the function end.

MFC after: 1 week

5 years agocxgbe(4): Clear the reply-pending status of a hashfilter when the reply
np [Sun, 20 Jan 2019 23:30:16 +0000 (23:30 +0000)]
cxgbe(4): Clear the reply-pending status of a hashfilter when the reply
indicates an error.  Also, do not remove it twice from the hf list in
this case.

Submitted by: Krishnamraju Eraparaju @ Chelsio
MFC after: 1 week
Sponsored by: Chelsio Communicatons

5 years agoAdd more profile-enabled libraries to remove when WITHOUT_PROFILE is defined
gonzo [Sun, 20 Jan 2019 22:34:04 +0000 (22:34 +0000)]
Add more profile-enabled libraries to remove when WITHOUT_PROFILE is defined

PR: 230898
Submitted by: Herbert J. Skuhra <herbert@mailbox.org>
MFC after: 1 week

5 years agoDon't mess with BLOCKSIZE in shell startup files - it's set by login.conf(5);
trasz [Sun, 20 Jan 2019 22:08:49 +0000 (22:08 +0000)]
Don't mess with BLOCKSIZE in shell startup files - it's set by login.conf(5);
there's no need to even mention it in shell rc files.  Not that it's wrong;
just pointless and somewhat misleading.

Reviewed by: jilles
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D18809

5 years agoUnbreak mip64 build after r328437
gonzo [Sun, 20 Jan 2019 21:09:44 +0000 (21:09 +0000)]
Unbreak mip64 build after r328437

Add exit and getchar functions to beri/boot2 code. They are required by
panic_action functin introduced in r328437

5 years agoAdd KBD_BOOTPROTO quirk for Logitech G510s USB keyboard
gonzo [Sun, 20 Jan 2019 20:29:26 +0000 (20:29 +0000)]
Add KBD_BOOTPROTO quirk for Logitech G510s USB keyboard

PR: 232136
Submitted by: dgilbert@eicat.ca
MFC after: 1 week

5 years agoFix inconsistency in return values introduced by r343222
gonzo [Sun, 20 Jan 2019 19:55:54 +0000 (19:55 +0000)]
Fix inconsistency in return values introduced by r343222

Consistently return 1 or the case of missing arguments in both functions

PR: 219689
MFC after: 1 week
X-MFC-With: 343222

5 years agoFix crash in systat(4) when certain commands are called without arguments
gonzo [Sun, 20 Jan 2019 19:47:33 +0000 (19:47 +0000)]
Fix crash in systat(4) when certain commands are called without arguments

Add check for missing arguments to dsmatchselect and dsselect

PR: 219689
Submitted by: Marko Turk <mt@markoturk.info>
MFC after: 1 week

5 years agoRemove IEEE80211_AMPDU_AGE config option.
avos [Sun, 20 Jan 2019 15:17:56 +0000 (15:17 +0000)]
Remove IEEE80211_AMPDU_AGE config option.

It is noop since r297774.

5 years agosh: Send libedit "ferr" output to fd 2
jilles [Sun, 20 Jan 2019 14:25:25 +0000 (14:25 +0000)]
sh: Send libedit "ferr" output to fd 2

The libedit "fout" output must be sent to fd 2 since it contains prompts
that POSIX says must be sent to fd 2. However, the libedit "ferr" output
receives error messages such as from "bind" that make no sense to send to fd
1.

5 years agonet80211: resolve ioctl <-> detach race for ieee80211com structure
avos [Sun, 20 Jan 2019 13:39:18 +0000 (13:39 +0000)]
net80211: resolve ioctl <-> detach race for ieee80211com structure

Since r287197 ieee80211com is a part of drivers softc; as a result,
after detach all pointers to it (iv_ic, ni_ic) are invalid. Most
possible users (tasks, interrupt handlers) are blocked / removed
when device is stopped; however, ioctl handlers were not tracked
and may crash if ieee80211com structure is accessed.

Since ieee80211com pointer access from ieee80211vap structure is not
protected by lock (constant after interface creation) and used in
many other places just use reference counting for ioctl handlers;
on detach set 'detached' flag and wait until reference counter goes to 0.

For HEAD ieee80211vap size was changed (__FreeBSD_version bumped);
however, in stable branches I'm going to split / reuse the last
iv_spare field for KBI stability.

Tested with:
 - rsu(4), SIOCSIFCAP (-rxcsum) ioctl;
 - rtwn_pci(4), SIOCG80211 / IEEE80211_IOC_HTPROTMODE ioctl.

MFC after: 1 week

5 years ago[smbfs] Allow semicolon in mounts that support long names
gonzo [Sun, 20 Jan 2019 05:52:16 +0000 (05:52 +0000)]
[smbfs] Allow semicolon in mounts that support long names

Semicolon is a legal character in long names but not in 8.3 format.
Move it to respective character set.

PR: 140068
Submitted by: tom@uffner.com
MFC after: 3 weeks

5 years ago[ifconfig] Print more WPS attributes in verbose "list scan" output
gonzo [Sun, 20 Jan 2019 00:45:44 +0000 (00:45 +0000)]
[ifconfig] Print more WPS attributes in verbose "list scan" output

- Move WPS related defines to dedicated file
- Add handlers for more WPS attributes

PR: 217317
Submitted by: J.R. Oldroyd <fbsd@opal.com>
MFC after: 3 weeks

5 years agoixgbe: this statement may fall through warnings with gcc
tsoome [Sat, 19 Jan 2019 20:45:41 +0000 (20:45 +0000)]
ixgbe: this statement may fall through warnings with gcc

The recent gcc versions (7 and 8 at least) can check for switch case
statements for fall through (implicit-fallthrough). When fall through
is intentional, the default method for warning suppression is to place
comment /* FALLTHROUGH */ exactly before next case statement.

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

5 years agonet80211: drop m_pullup call from ieee80211_crypto_decap.
avos [Sat, 19 Jan 2019 16:04:26 +0000 (16:04 +0000)]
net80211: drop m_pullup call from ieee80211_crypto_decap.

For most wireless drivers Rx mbuf is allocated as one
contiguous chunk; only few are using chains for allocations -
but even then at least MCLBYTES (minus Rx descriptor size) is
available in the first mbuf.

In addition to the above, m_pullup was never called here - otherwise,
reallocation will break post-crypto_decap logic (ieee80211_decap,
ieee80211_deliver_data...), so just remove it; length check is left
in case if some truncated frame appears here.

PR: 234241
MFC after: 1 week

5 years ago[aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE
gonzo [Sat, 19 Jan 2019 05:31:48 +0000 (05:31 +0000)]
[aic7xxx] Use correct product name 29320LPE instead of non-existent 39320LPE

The PCI id belongs to Adaptec 29320LPE controller. The same fix also was
merged[1] to OpenBSD driver ~6 years ago.

[1] https://github.com/openbsd/src/commit/f997b5

PR: 172133
Submitted by: henning.petersen@t-online.de
MFC after:  1 week

5 years agodpaa: fix 32-bit build
jhibbits [Sat, 19 Jan 2019 05:20:31 +0000 (05:20 +0000)]
dpaa: fix 32-bit build

Book-E powerpc uses 64-bit vm_paddr_t, and 32-bit powerpc has 32-bit pointers,
so gcc errors with cast to pointer from integer of different size.  As this will
not actually be used in reality anyway, simply quiet the warning by casting
through uintptr_t.

MFC after: 3 weeks
MFC with: r343168

5 years agopowerpc/dpaa: Handle DMAP virtual addresses in DPAA
jhibbits [Sat, 19 Jan 2019 04:54:12 +0000 (04:54 +0000)]
powerpc/dpaa: Handle DMAP virtual addresses in DPAA

sendfile(2) appears to now use DMAP wherever possible.  These addresses are not
managed by pmap, so pmap_kextract() returns a 0 physical address, causing
failure.

This change fixes nginx running on P5020 SoC.

MFC after: 3 weeks

5 years agopowerpc: Fix opaque irq data initialization
jhibbits [Sat, 19 Jan 2019 04:47:19 +0000 (04:47 +0000)]
powerpc: Fix opaque irq data initialization

The powerpc_intr structure is not zero-initialized, so on an invariants
build would panic in the xics driver with an invalid pointer.  Also fix the
xics driver to share the private data setup code between xics_enable() and
xics_bind().

Reported by: Leonardo Bianconi

5 years agovmm(4): Mask Spectre feature bits on AMD hosts
cem [Fri, 18 Jan 2019 23:54:51 +0000 (23:54 +0000)]
vmm(4): Mask Spectre feature bits on AMD hosts

For parity with Intel hosts, which already mask out the CPUID feature
bits that indicate the presence of the SPEC_CTRL MSR, do the same on
AMD.

Eventually we may want to have a better support story for guests, but
for now, limit the damage of incorrectly indicating an MSR we do not yet
support.

Eventually, we may want a generic CPUID override system for
administrators, or for minimum supported feature set in heterogenous
environments with failover.  That is a much larger scope effort than
this bug fix.

PR: 235010
Reported by: Rys Sommefeldt <rys AT sommefeldt.com>
Sponsored by: Dell EMC Isilon

5 years agoFix top(1) long options handling
jhibbits [Fri, 18 Jan 2019 23:26:31 +0000 (23:26 +0000)]
Fix top(1) long options handling

getopt_long(3) requires the long options be terminated by a NULL block.
Without the terminator, an invalid long option results in a segmentation
fault.

Reported by: Brandon Bergren
MFC after: 1 week

5 years agoClarify error messages a bit.
marck [Fri, 18 Jan 2019 23:00:52 +0000 (23:00 +0000)]
Clarify error messages a bit.

X-Found-With: r343112
MFC after: 1 month

5 years agopsm(4): detect Lenovo top-button clickpads
wulf [Fri, 18 Jan 2019 22:20:29 +0000 (22:20 +0000)]
psm(4): detect Lenovo top-button clickpads

libinput has special handling for Lenovo ThinkPad *40 series, where it
treats clicks on the top button area as if they came from the TrackPoint:
https://wayland.freedesktop.org/libinput/doc/latest/t440-support.html

Detect these devices and set the corresponding evdev property.

Submitted by: Greg V <greg@unrelenting.technology>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D18676

5 years agoMake SIFTR work again after r342125 (D18443).
brooks [Fri, 18 Jan 2019 21:46:38 +0000 (21:46 +0000)]
Make SIFTR work again after r342125 (D18443).

Correct a logic error.

Only disable when already enabled or enable when disabled.

Submitted by: Richard Scheffenegger
Reviewed by: Cheng Cui
Obtained from: Cheng Cui
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18885

5 years agoUse a private definition of osockaddr rather then relying on type
brooks [Fri, 18 Jan 2019 21:30:06 +0000 (21:30 +0000)]
Use a private definition of osockaddr rather then relying on type
namespace polution in sys/socket.h.

Also remove support for operation on 4.3BSD.

PR: 224529
Differential Revision: https://reviews.freebsd.org/D14505

5 years ago[usb] Add HID_IGNORE quirks for multiple UPS devices
gonzo [Fri, 18 Jan 2019 21:00:54 +0000 (21:00 +0000)]
[usb] Add HID_IGNORE quirks for multiple UPS devices

Without HID_IGNORE quirk enabled these models appear in the system as a uhid
devices while NUT (Network UPS Tool) expects them to be ugen.

PR: 131521
Submitted by: Naoyuki Tai <ntai@smartfruit.com>, John Bayly <john.bayly@tipstrade.net>
MFC after: 1 week

5 years agoRemove leading slash from OLD_DIRS assignment in ObsoleteFiles.inc. The
dim [Fri, 18 Jan 2019 20:35:24 +0000 (20:35 +0000)]
Remove leading slash from OLD_DIRS assignment in ObsoleteFiles.inc.  The
"make delete-old" mechanism will already take care of such prefixes, and
this prevents a double leading slash from being displayed.

5 years agofreebsd-update.8: mandoc -Tlint fixes
emaste [Fri, 18 Jan 2019 18:22:47 +0000 (18:22 +0000)]
freebsd-update.8: mandoc -Tlint fixes

PR: 185389
Reported by: bcr
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

5 years agofreebsd-update: Use BASEDIR when checking for src component
emaste [Fri, 18 Jan 2019 17:41:45 +0000 (17:41 +0000)]
freebsd-update: Use BASEDIR when checking for src component

src could potentially be installed under the based dir
and not under the root or vice versa.

PR: 224048
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reviewed by: delphij
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18849

5 years agoi386/PAE busdma: allow more bounce pages.
kib [Fri, 18 Jan 2019 13:43:11 +0000 (13:43 +0000)]
i386/PAE busdma: allow more bounce pages.

If i386 has more than 4G of memory, allow the same number of busdma
bounce pages as for amd64.  In fact, in this case bouncing sometimes
is much heavier than on amd64.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D18854

5 years agox86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed.
kib [Fri, 18 Jan 2019 13:38:56 +0000 (13:38 +0000)]
x86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed.

Right now bus_addr_t and vm_paddr_t are always aliased to the same
underlying integer type on x86, which makes the interchange hard to
detect.  Shortly, i386 kernel would use uint64_t for vm_paddr_t to
enable automatic use of PAE paging structures if hardware allows it,
while bus_addr_t would be extended to 64bit only when PAE option is
specified.

Fix all places that were identified as using bus_addr_t while page
address was assumed.  This was performed by testing the complete PAE
merging patch on machine with > 4G of RAM enabled.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D18854

5 years agoMI VM: Make it possible to set size of superpage at boot instead of compile time.
kib [Fri, 18 Jan 2019 13:35:06 +0000 (13:35 +0000)]
MI VM: Make it possible to set size of superpage at boot instead of compile time.

In order to allow single kernel to use PAE pagetables on i386 if
hardware supports it, and fall back to classic two-level paging
structures if not, superpage code should be able to adopt to either 2M
or 4M superpages size.  There I make MI VM structures large enough to
track the biggest possible superpage, by allowing architecture to
define VM_NFREEORDER_MAX and VM_LEVEL_0_ORDER_MAX constants.
Corresponding VM_NFREEORDER and VM_LEVEL_0_ORDER symbols can be
defined as runtime values and must be less than the _MAX constants.
If architecture does not define _MAXs, it is assumed that _MAX ==
normal constant.

Reviewed by: markj
Tested by: pho (as part of the larger patch)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18853

5 years agonvdimm: initialize SPA uuids statically.
kib [Fri, 18 Jan 2019 10:54:36 +0000 (10:54 +0000)]
nvdimm: initialize SPA uuids statically.

The SPA ids are published numbers, so it's safe (if not a bit
annoying) to copy them into a source file.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18733

5 years agonvdimm: add a driver for the NVDIMM root device
kib [Fri, 18 Jan 2019 10:45:27 +0000 (10:45 +0000)]
nvdimm: add a driver for the NVDIMM root device

The NVDIMM root device is parent to the individual ACPI NVDIMM
devices.  Add a driver for the NVDIMM root device that can own
enumeration of NVDIMM devices as well as NVDIMM SPA ranges that the
system has.

Submitted by: D Scott Phillips <d.scott.phillips@intel.com>
Sponsored by: Intel Corporation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D18346

5 years agopf: fix pfsync breaking carp
kp [Fri, 18 Jan 2019 08:19:54 +0000 (08:19 +0000)]
pf: fix pfsync breaking carp

Fix missing initialisation of sc_flags into a valid sync state on clone which
breaks carp in pfsync.

This regression was introduce by r342051.

PR: 235005
Submitted by: smh@FreeBSD.org
Pointy hat to: kp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18882

5 years ago[ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command
gonzo [Fri, 18 Jan 2019 04:23:52 +0000 (04:23 +0000)]
[ata] Add workaround for KingDian S200 SSD crash on receiving TRIM command

- Add ADA_Q_NO_TRIM quirk to be used with the device that falsely advertise TRIM support
- Add ADA_Q_NO_TRIM entry for KingDian S200 SSD

PR: 222802
Submitted by: Bertrand Petit <bsdpr@phoe.frmug.org>
MFC after: 1 week

5 years agoAdd ypldap to the list of conditional obsolete files
gonzo [Fri, 18 Jan 2019 00:39:17 +0000 (00:39 +0000)]
Add ypldap to the list of conditional obsolete files

ypldap should be removed during delete-old if WITHOUT_NIS flag is enabled

PR: 230727
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after: 1 week

5 years agoFix descriptor/memory leak in compress(1) code
gonzo [Fri, 18 Jan 2019 00:26:25 +0000 (00:26 +0000)]
Fix descriptor/memory leak in compress(1) code

This is mostly a style fix since the code in question is not called multiple
times and doesn't have cummulative effect.

PR: 204953
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoioat(4): Set __result_use_check on ioat_acquire_reserve
cem [Thu, 17 Jan 2019 23:21:02 +0000 (23:21 +0000)]
ioat(4): Set __result_use_check on ioat_acquire_reserve

Even M_WAITOK callers must check for failure.  For example, if the device is
quiescing, either due to automatic error-recovery induced reset, or due to
administrative detach, the routine will return ENXIO and the acquire
reference will not be held.  So, there is no mode in which it is safe to
assume the routine succeeds without checking.

Sponsored by: Dell EMC Isilon

5 years agolibsa: add asprintf()
tsoome [Thu, 17 Jan 2019 22:00:02 +0000 (22:00 +0000)]
libsa: add asprintf()

asprintf() is a nice tool for string processing.

MFC after: 2 weeks

5 years agoloader should ignore active multi_vdev_crash_dump feature on zpool
tsoome [Thu, 17 Jan 2019 21:52:41 +0000 (21:52 +0000)]
loader should ignore active multi_vdev_crash_dump feature on zpool

Since the loader zfs reader does not need to read the dump zvol, we can
just enable the feature.

illumos issue #9051 https://www.illumos.org/issues/9051

MFC after: 2 weeks

5 years agofreebsd-update: Clarify unsupported release upgrade error message
emaste [Thu, 17 Jan 2019 21:38:57 +0000 (21:38 +0000)]
freebsd-update: Clarify unsupported release upgrade error message

Notify users that upgrading from -CURRENT or -STABLE is unsupported by
freebsd-update.

Also ensure --currently-running provides a correctly formatted release
(as done by -r).

PR: 234771
Submitted by: Gerald Aryeetey <aryeeteygerald_rogers.com>
Reported by: yuri
Reviewed by: bcran
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18803

5 years agoWorkaround for nscd(8) failure with large entries.
trasz [Thu, 17 Jan 2019 20:01:06 +0000 (20:01 +0000)]
Workaround for nscd(8) failure with large entries.

It fixes a case where eg a 2KB group entry would take several seconds
to complete with cache enabled in nsswitch.conf.

MFC after: 2 weeks
Sponsored by: Chalmers University of Technology
Differential Revision: https://reviews.freebsd.org/D18392

5 years agoAdd definitions for AMD Spectre/Meltdown CPUID information
cem [Thu, 17 Jan 2019 19:44:47 +0000 (19:44 +0000)]
Add definitions for AMD Spectre/Meltdown CPUID information

No functional change, aside from printing recognized bits in CPU
identification.

The bits are documented in 111006-B "Indirect Branch Control Extension"[1] and
124441 "Speculative Store Bypass Disable."[2]

Notably missing (left as future work):
  * Integration with hw.spec_store_bypass_disable and hw_ssb_active flag,
    which are currently Intel-specific
  * Integration with hw_ibrs_active global flag, which are currently
    Intel-specific
  * SSB_NO integration in hw_ssb_recalculate()
  * Bhyve integration (PR 235010)

[1]:
https://developer.amd.com/wp-content/resources/111006-B_AMD64TechnologyIndirectBranchControlExtenstion_WP_7-18Update_FNL.pdf

[2]:
https://developer.amd.com/wp-content/resources/124441_AMD64_SpeculativeStoreBypassDisable_Whitepaper_final.pdf

PR: 235010 (related, but does not fix)
MFC after: a week

5 years agoRevert r343095
kevans [Thu, 17 Jan 2019 18:51:56 +0000 (18:51 +0000)]
Revert r343095

This was intended to fix the soft reset timeout on boot for OrangePi One/R1
with internal PHY, but seems to cause other problems later on due to soft
resetting around some state changes that may or may not make the NIC
non-functional.

Reverting this for now while a better solution is sought out.

5 years agoRe-add new small tool trim(8) to delete contents for blocks
eugen [Thu, 17 Jan 2019 18:07:59 +0000 (18:07 +0000)]
Re-add new small tool trim(8) to delete contents for blocks
on devices using wear-leveling algorithms as a few weeks passed
after review and discussion of trim(8) ceased and
we still have no utility to perform the job.

Reviewed by: hackers@
MFC after: 2 weeks

5 years agoFix handling of rights on stdio streams.
markj [Thu, 17 Jan 2019 17:36:18 +0000 (17:36 +0000)]
Fix handling of rights on stdio streams.

- Limit rights on stdio before opening input files.  Otherwise, open()
  may return one of the standard descriptors and we end up limiting
  rights such that we cannot read from one of the input files.
- Use caph_limit_stdio(), which suppresses EBADF, to ensure that
  we don't emit an error if one of the stdio streams is closed.
- Don't bother further limiting rights on stdin when stdin isn't going
  to be used.  Doing so correctly requires checking for a number of
  edge cases, and it doesn't provide any significant benefit.

PR: 234885
Reviewed by: oshogbo
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18860

5 years agoRevert r343093 until I can address the issues raised by kib@.
des [Thu, 17 Jan 2019 16:50:50 +0000 (16:50 +0000)]
Revert r343093 until I can address the issues raised by kib@.

5 years agoTruely fix #if defined broken in -r343111
mckusick [Thu, 17 Jan 2019 16:26:59 +0000 (16:26 +0000)]
Truely fix #if defined broken in -r343111

Pointy-hat-to: mckusick
5 years agoProper definition of elast3.
mckusick [Thu, 17 Jan 2019 15:42:10 +0000 (15:42 +0000)]
Proper definition of elast3.

Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>

5 years agoFix #if defined broken in -r343111
mckusick [Thu, 17 Jan 2019 15:35:04 +0000 (15:35 +0000)]
Fix #if defined broken in -r343111

Pointy-hat-to: mckusick
5 years agojail(8): stop crashing with SIGSEGV inside run_command() function
eugen [Thu, 17 Jan 2019 14:09:55 +0000 (14:09 +0000)]
jail(8): stop crashing with SIGSEGV inside run_command() function
while processing not entirely correct jail.conf(5) file
having something like "ip4.addr = 127.0.0.1;" and no "ip4 = ...;"
so extrap variable stays NULL.

Reported by: marck
MFC after: 1 month

5 years agoCreate new EINTEGRITY error with message "Integrity check failed".
mckusick [Thu, 17 Jan 2019 06:35:45 +0000 (06:35 +0000)]
Create new EINTEGRITY error with message "Integrity check failed".

An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765

5 years agoFix conditional obsolete files entry for WITHOUT_EXAMPLES
gonzo [Thu, 17 Jan 2019 06:34:39 +0000 (06:34 +0000)]
Fix conditional obsolete files entry for WITHOUT_EXAMPLES

Add all the files under /usr/share/examples to the MK_EXAMPLES
section. OLD_DIRS entries are not removed if they're not empty so
prior to this change WITHOUT_EXAMPLES didn't have significant effect
on the updated system.

PR: 228484
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru> (original patch)
MFC after: 1 week

5 years agoAdd optional obsolete files for the installworld without sendmail
gonzo [Thu, 17 Jan 2019 06:22:14 +0000 (06:22 +0000)]
Add optional obsolete files for the installworld without sendmail

Add two more entries for WITHOUT_SENDMAIL install. The /var/spool/clientmqueue
entry would be deleted only if there are no files/dirs in it, so the
content generated during previous lifecycle of the system is safe

PR: 228484
Submitted by: Dmitry Wagin <dmitry.wagin@ya.ru>
MFC after: 1 week

5 years agoTrim whitespace at EoL, use tabs instead of spaces for indent.
kib [Thu, 17 Jan 2019 05:15:25 +0000 (05:15 +0000)]
Trim whitespace at EoL, use tabs instead of spaces for indent.

PR:  235004
Submitted by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 3 days

5 years agoRe-wrap long line after r341827.
kib [Thu, 17 Jan 2019 04:51:05 +0000 (04:51 +0000)]
Re-wrap long line after r341827.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

5 years ago[usb] Add quirk for SmartG2 USB memory key
gonzo [Wed, 16 Jan 2019 22:29:34 +0000 (22:29 +0000)]
[usb] Add quirk for SmartG2 USB memory key

PR: 167001
Submitted by: Daan Vreeken [PA4DAN] <Daan@vitsch.nl>
MFC after: 1 week

5 years agolibedit: Avoid out of bounds read in 'bind' command
jilles [Wed, 16 Jan 2019 21:59:18 +0000 (21:59 +0000)]
libedit: Avoid out of bounds read in 'bind' command

This is CVS revision 1.31 from NetBSD lib/libedit/chartype.c:
Make sure that argv is NULL terminated since functions like tty_stty rely
on it to be so (Gerry Swinslow)

This broke when the wide-character support was enabled in libedit. The
conversion from multibyte to wide-character did not supply the apparently
expected terminating NULL in the new argv array.

PR: 233343
Submitted by: Yuichiro NAITO
Obtained from: NetBSD
MFC after: 1 week

5 years ago[mv] Fix invalid condition in fdt_fixup_ranges
gonzo [Wed, 16 Jan 2019 21:13:50 +0000 (21:13 +0000)]
[mv] Fix invalid condition in fdt_fixup_ranges

Add parentheses to perform assignment before comparison. The prior
condition worked because fdt_parent_addr_cells returns 1 for the DTB
on which fdt_fixup_ranges is called and accidentally par_addr_cells
ends up to be set to the same value.

PR: 210705
Submitted by: David Binderman <dcb314@hotmail.com>
MFC after: 1 week

5 years agoRemove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
cy [Wed, 16 Jan 2019 20:46:39 +0000 (20:46 +0000)]
Remove redundant ipfilter version of pcap-bpf.h. As of r214535 it was
no longer needed.

MFC after: 1 week