MFC r361827:
USB HID descriptors may push/pop the current state to allow
description of items residing in a so-called union. FreeBSD currently
only supports 4 such push levels.
If the push level is not restored within the processing of the same
HID item, an invalid memory location may be used for subsequent HID
item processing.
Verify that the push level is always valid when processing HID items.
Reported by: Andy Nguyen (Google)
Sponsored by: Mellanox Technologies
MFC r361581:
Implement helper function, usbd_get_max_frame_length(), which allows kernel
device drivers to correctly predict the default USB transfer frame length.
[rpi] Inherit framebuffer BPP value from the VideoCore firmware
Instead of using hardcoded bpp of 24, obtain current/configured value
from VideoCore. This solves certain problems with Xorg/Qt apps that
require bpp of 32 to work properly. The mode can be forced by setting
framebuffer_depth value in config.txt
Patch systat -zarc to display cumulative rate and round down large numbers by SI units
Introduce sysputpage() to display large page size with human readable format.
Using UI units allows to fit larger numbers in columns.
Stop calling v_page_size - this is a value that doesn't change at runtime.
Renamed WINDOW *wnd to *wd to avoid conflict with global *wnd variable.
Use bit-shift to convert page size to byte.
Kyle Evans [Sat, 6 Jun 2020 01:56:30 +0000 (01:56 +0000)]
MFC r361763: lualoader: drop the filename and word "LUA" from errors
The filename is nearly always wrong since it's /boot/lua/loader.lua, which
is not useful for diagnostics. The actual errmsg will include a lua filename
if this is relevant.
Dropping "LUA" while we're here because that's almost universally
irrelevant to whatever error follows, unless the error states that it's
actually a lua problem.
Both of these are minor nits that just detract from identifying the
pertinent information.
MFC r361346: Retain only mutually supported TCP options after simultaneous SYN
When receiving a parallel SYN in SYN-SENT state, remove all the
options only we supported locally before sending the SYN,ACK.
This addresses a consistency issue on parallel opens.
Also, on such a parallel open, the stack could be coaxed into
running with timestamps enabled, even if administratively disabled.
This does NOT contain the merge of the change to BBR since at this
time that code does not exist in stable/12, and there is no plan to
merge BBR(v1) to stable/12.
Andriy Gapon [Fri, 5 Jun 2020 07:37:52 +0000 (07:37 +0000)]
fix up r361823, libprocstat zfs support, on powerpc
This fixes a build failure:
In file included from .../zfs_context.h:104,
from .../libprocstat/zfs_defs.c:53:
.../vm/vm_page.h:204: error: field 'md' has incomplete type
In this branch, on powerpc, struct md_page is visible only if either AIM
or BOOKE is defined.
This is a direct commit.
Andriy Gapon [Fri, 5 Jun 2020 06:34:04 +0000 (06:34 +0000)]
MFC r361363,r361434: libprocstat: fix ZFS support
First of all, znode_phys_t hasn't been used for storing file attributes
for a long time now. Modern ZFS versions use a System Attribute table
with a flexible layout. But more importantly all the required
information is available in znode_t itself.
It's not easy to include zfs_znode.h in userland without breaking code
because the most interesting parts of the header are kernel-only. And
hardcoding field offsets is too fragile. So, I created a new
compilation unit that includes zfs_znode.h using some mild kludges to
get it and its dependencies to compile in userland. The compilation
unit exports interesting field offsets and does not have any other code.
Kyle Evans [Fri, 5 Jun 2020 02:56:42 +0000 (02:56 +0000)]
MFC r361318, r361331-r361332
r361318:
ls: fix a --color regression from r337956
The regression is in-fact that I flipped the default from never to auto. The
incorrect impression was based on an alias that I failed to notice,
installed by the Linux distribution that I used for testing compatibility
here. Users that want the old default should be doing so with a shell alias
as is done elsewhere, rather than making this decision in ls(1).
Many thanks to rgrimes for pointing out the alias that I clearly overlooked
that resulted in this; if you despised colors in your terminal from this,
consider buying him a beer at the next venue that you see him at.
r361331:
ls(1): actually restore proper behavior
Highlights:
- CLICOLOR in the environment should imply --color=auto to maintain
compatibility with historical behavior
- -G should set CLICOLOR and imply --color=auto
The manpage has been updated to draw the connection between -G and --color;
the former is in-fact a sort of compromise between --color=always and
--color=auto, where we'll output color regardless of the environment lacking
CLICOLOR/COLORTERM assuming stdout is a tty.
r361332:
ls: fix WITHOUT_LS_COLORS build
*sigh* references to colorflags should be gated by COLORLS.
At least one user has landed in a scenario where logo files appear to be
misnamed, and we failed to find them. Our fallback for missing logodefs is
orb/orbbw, based on the color status. In a scenario where we can't locate
the logos, though, this is not ideal. Add in one more layer of fallback
to properly just don't draw any logo if the fan has been jam packed with
foreign material.
MFC rS361348: DCTCP: update alpha only once after loss recovery.
In mixed ECN marking and loss scenarios it was found, that
the alpha value of DCTCP is updated two times. The second
update happens with freshly initialized counters indicating
to ECN loss. Overall this leads to alpha not adjusting as
quickly as expected to ECN markings, and therefore lead to
excessive loss.
Andriy Gapon [Thu, 4 Jun 2020 13:03:13 +0000 (13:03 +0000)]
MFC r361273: iwm: improve rfkill handling
Previously the driver handled the bit within itself, but did not expose
the state change to net80211 and interface layers.
This change uses net80211 KPI for rfkill signaling.
The code is modeled after similar code in iwn and wpi.
Dimitry Andric [Wed, 3 Jun 2020 16:51:30 +0000 (16:51 +0000)]
Disable clang's -fintegrated-cc1 stage by default
In bug 246630, it was found that part of the rescue binary could be
compiled to very slightly different (but still equivalent) machine code,
depending on the number of simultaneous make jobs (via the -j option).
This turned out to be caused by the upstream change that made clang's
first stage compiler (i.e. the -cc1 stage) run as part of the initial
clang process invocation, instead of forking and exec'ing a new clang
process.
We are currently investigating the root cause for the difference in
output, but while that is ongoing, disable the integrated cc1 stage for
now to work around it. You can always turn it on explicitly by using the
-fintegrated-cc1 option, or turn it off with -fno-integrated-cc1.
Direct commit to stable/{11,12}, so this can hopefully end up in the
upcoming 11.4-RELEASE.
Alexander Motin [Tue, 2 Jun 2020 20:42:25 +0000 (20:42 +0000)]
MFC 361400: Do not try to fill socket send buffer to the last byte.
Setting so_snd.sb_lowat to at least 1/8 of the socket buffer size allows
send thread more actively use PDUs coalescing, that dramatically reduces
TCP lock congestion and number of context switches, when the socket is
full and PDUs are small.
Changes since 20180512 are mostly portability related
hence the large gap in versions imported.
There are however some bug fixes, and a rework of filemon handling.
In NetBSD make/filemon/filemon_ktrace.c allows use of fktrace
and elimination of filemon(4) which has not had the TLC it needs.
FreeBSD filemon(4) is in much better shape, so bmake/filemon/filemon_dev.c
allows use of that, with a bit less overhead than the ktrace model.
Summary of changes from ChangeLog
o str.c: empty string does not match % pattern
plus unit-test changes
o var.c: import handling of old sysV style modifier using '%'
o str.c: refactor brk_string
o meta.c: meta_oodate, CHECK_VALID_META is too aggressive for CMD
a blank command is perfectly valid.
o meta.c: meta_oodate, check for corrupted meta file
earlier and more often.
* meta.c: meta_compat_parent check for USE_FILEMON
patch from Soeren Tempel
o meta.c: fix compat mode, need to call meta_job_output()
o job.c: extra fds for meta mode not needed if using filemon_dev
o meta.c: avoid passing NULL to filemon_*() when meta_needed()
returns FALSE.
o filemon/filemon_{dev,ktrace}.c: allow selection of
filemon implementation. filemon_dev.c uses the kernel module
while filemon_ktrace.c leverages the fktrace api available in
NetBSD. filemon_ktrace.c can hopefully form the basis for
adding support for other tracing mechanisms such as strace on
Linux.
o meta.c: when target is out-of-date per normal make rules
record value of .OODATE in meta file.
o parse.c: don't pass NULL to realpath(3)
some versions cannot handle it.
o parse.c: ParseDoDependency: free paths rather than assert
o parse.c: ParseVErrorInternal use .PARSEDIR
and apply if relative, and then use .PARSEFILE
for consistent result.
o parse.c: ParseVErrorInternal use .CURDIR if .PARSEDIR
is relative
o var.c: avoid SEGFAULT in .unexport-env
when MAKELEVEL is not set
o var.c: add :q
o dir.c: cleanup caching of stats
Jilles Tjoelker [Sat, 30 May 2020 13:39:56 +0000 (13:39 +0000)]
MFC r361112,r361117: sh: Fix double INTON with vfork
The shell maintains a count of the number of times SIGINT processing has
been disabled via INTOFF, so SIGINT processing resumes when all disables
have enabled again (INTON).
If an error occurs in a vfork() child, the processing of the error enables
SIGINT processing again, and the INTON in vforkexecshell() causes the count
to become negative.
As a result, a later INTOFF may not actually disable SIGINT processing. This
might cause memory corruption if a SIGINT arrives at an inopportune time.
Note that various places such as errors in non-special builtins
unconditionally reset the count to 0, so the problem might still not always
be visible.
Andriy Gapon [Fri, 29 May 2020 07:38:57 +0000 (07:38 +0000)]
MFC r361364: net80211: post RTM_IFINFO notification after toggling IFF_DRV_RUNNING
This is useful when a wireless driver is stopped or started in response
to events like an RF Kill button press. Applications like
wpa_supplicant depend on such events to have a correct view of interface
state.
Warner Losh [Thu, 28 May 2020 23:23:49 +0000 (23:23 +0000)]
MFC r358308:
Before issing the REMOVE_DEVICE command to the firmware, make sure that all
commands have completed.
It's not OK to force complete any pending commands before we send the
REMOVE_DEVICE. Instead, make sure that all pending commands are complete before
sending that. By trying to second guess the firmware here, we run the risk of
completing commands twice, which leads to corruption.
This removes the forced completion of commands introduced in r218811. So it's a
partial backout of that commit, but replaces it with a more rebust
mechanism. Either these commands will complete due to the TARGET RESET, or they
will timeout and be aborted, but they will all complete.
Add assert that all commands are complete to REMOVE_DEVICE completion
routine. We attempt to assure this programatically, so we shouldn't have any
commands in the queue because we've waited for them all. Any commands that make
it into our action routine after we mark the target in removal will complete
immediately with an error.
When we're removing a target that's not a volume, advertise up the stack that
it's actually gone, as opposed to having a transient selection error we should
retry. Do this both in the action routine, and when we get a notification of an
aborted command. We don't do this for volumes because the driver tries hard not
to advertise to the OS a volume has disappeared.
Apply these changes to both mpr and mps since they are based on quite similar
designs.
Cy Schubert [Wed, 27 May 2020 17:49:32 +0000 (17:49 +0000)]
MFC r361272:
Silence the once per second CTRL-EVENT-SCAN-FAILED errors when the WiFi
radio is disabled through the communication device toggle key (also known
as the RF raidio kill button). Only the CTRL-EVENT-DISCONNECTED will be
issued.
Kyle Evans [Tue, 26 May 2020 19:34:05 +0000 (19:34 +0000)]
loader: fix userboot's ability to detect a guest's interpreter
Some time after r338418, I believe with -Os/-Oz -ffunction-sections
-fdata-sections, the bootprog_interp variable that held our "$Interpreter:"
marker started getting strip from all loaders, with exception to userboot
since it used bootprog_interp to determine what flavor of userboot it was.
At some point, it had been brought to my attention that this was no longer
working and I had worked up some potential solutions to use the variable
that involved printing it out. My vague recollection is that this was
rejected, and I forgot to explore the alternatives; I cannot find records of
this discussion anymore.
Fast forward to present day, Andrew reported that it was non-functional and
offered (effectively) this patch (sans comment) to stop the compiler from
optimizing it out by assigning it to a volatile variable. This removes
concerns about user-facing change while retaining the interpreter marker.
Furthermore, it could certainly be uglier.
Andriy Gapon [Tue, 26 May 2020 05:55:46 +0000 (05:55 +0000)]
MFC r360956: zfs allow/unallow should work with numeric uid/gid
And that should work even (especially) if there is no matching user or
group name. This change allows to see and modify delegations for
deleted groups and users.
The change is originally by Xin Li.
illumos report: https://www.illumos.org/issues/6037
OpenZFS (ZoL) PR: https://github.com/openzfs/zfs/pull/10280
Andriy Gapon [Tue, 26 May 2020 05:54:00 +0000 (05:54 +0000)]
MFC r360657: acpi_video: support systems without non-essential methods
Only _BCL and _BCM methods seem to be essential to the driver's
operation. If _BQC is missing then we can assume that the current
brightness is whatever we set by the last _BCM invocation. If _DCS or
_DGS is missing then we can make assumptions as well.
The change is based on a patch suggested by Anthony Jenkins
<Scoobi_doo@yahoo.com> in PR 207086.
Dimitry Andric [Mon, 25 May 2020 16:06:30 +0000 (16:06 +0000)]
Regenerate llvm config headers to correctly enable zlib support
During the initial upgrade to 10.0.0 in r357120, I generated these
headers once, but they were missing zlib-related settings at that time.
These should have been regenerated again during the merge of the final
10.0.0 release.
Direct commit to stable/{11,12}, since head has gotten 10.0.1 in the
mean time, with up-to-date generated headers.
Cy Schubert [Mon, 25 May 2020 13:16:35 +0000 (13:16 +0000)]
MFC r360221-r360223
r360221:
In preparation for update to sqlite3-3.31.1 (3310100),
recommit r357201: MFV r357163, which was reverted by r357522
due to segfault under PowerPc.
Tested by: Mark Millard <marklmi at yahoo.com>
With to be committed PowerPC patch
r360223:
Fix PowerPC segfault.
The segfault fix was originally developed by our upstream, sqlite.org,
to address S/390 and Sparc segfaults, both of which are big endian.
Our PowerPC is also big endian, which this patch also fixes.
Reported by: Mark Millard <marklmi at yahoo.com>
Tested by: Mark Millard <marklmi at yahoo.com>
Obtained from: https://www.sqlite.org/src/vinfo/04885763c4cd00cb?diff=1
https://sqlite.org/forum/forumpost/672291a5b2
Cy Schubert [Sun, 24 May 2020 16:47:27 +0000 (16:47 +0000)]
MFC r361344: MFV r361322:
Update unbound 1.9.6 --> 1.10.1.
Bug Fixes:
- CVE-2020-12662 Unbound can be tricked into amplifying an incoming
query into a large number of queries directed to a target.
- CVE-2020-12663 Malformed answers from upstream name servers can be
used to make Unbound unresponsive.
Before this change, swapon(8) implied that -F works as a standalone option,
which is not the case and would produce a usage message. This change extends
the description of the -F option to mention that -a is required with it.
MFC r361248:
Update SYNOPSIS section to be consistent regarding -u, -i, and -I.
Apparently, when the -u, -i and -I options where added to sed(1), it was
forgotten to add them to both lines in the SYNOPSIS section. They were only
added to the second line, although they apply to both.
With the updated SYNOPSIS, it is now allowed (and consistent) to run:
sed -i BAK s/foo/bar/g some_file
PR: 240556
Submitted by: Oliver Fromme
MFC after: 5 days
Alan Somers [Fri, 22 May 2020 22:13:55 +0000 (22:13 +0000)]
MFC r360829:
fusefs: fix two small bugs in the tests' expectations
These two errors have been present since the tests' introduction.
Coincidentally every test (I think there's only one) that cares about that
field also works when the field's value is 0.
Alan Somers [Fri, 22 May 2020 19:09:43 +0000 (19:09 +0000)]
MFC r360807:
Fix the sys.geom.class.multipath.misc.fail_on_error test on stable/12
This test uses a gnop feature (delay probability) that isn't available on
stable/12. But it's unnecessary; the test works fine without it. Removing
it simplifies the test and, once MFCed, will allow it to pass on stable/12.
10601 Pool allocation classes
https://www.illumos.org/issues/10601
illumos port of ZoL Pool allocation classes. Includes at least these two
commits: 441709695 Pool allocation classes misplacing small file blocks cc99f275a Pool allocation classes
10757 Add -gLp to zpool subcommands for alt vdev names
https://www.illumos.org/issues/10757
Port from ZoL of d2f3e292d Add -gLp to zpool subcommands for alt vdev names
Note that a subsequent ZoL commit changed -p to -P a77f29f93 Change full path subcommand flag from -p to -P
Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Portions contributed by: HÃ¥kan Johansson <f96hajo@chalmers.se>
Portions contributed by: Richard Yao <ryao@gentoo.org>
Portions contributed by: Chunwei Chen <david.chen@nutanix.com>
Portions contributed by: loli10K <ezomori.nozomu@gmail.com>
Author: Don Brady <don.brady@delphix.com>
11541 allocation_classes feature must be enabled to add log device
https://www.illumos.org/issues/11541
After the allocation_classes feature was integrated, one can no longer add a
log device to a pool unless that feature is enabled. There is an explicit check
for this, but it is unnecessary in the case of log devices, so we should handle
this better instead of forcing the feature to be enabled.
Author: Jerry Jelinek <jerry.jelinek@joyent.com>
FreeBSD notes.
I faithfully added the new -g, -L, -P flags, but only -g does something:
vdev GUIDs are displayed instead of device names. -L, resolve symlinks,
and -P, display full disk paths, do nothing at the moment.
The use of special vdevs is backward compatible for read-only access, so
root pools should be bootable, but exercise caution.
MFV r354383: 10592 misc. metaslab and vdev related ZoL bug fixes
https://www.illumos.org/issues/10592
This is a collection of recent fixes from ZoL: 8eef997679b Error path in metaslab_load_impl() forgets to drop ms_sync_lock 928e8ad47d3 Introduce auxiliary metaslab histograms 425d3237ee8 Get rid of space_map_update() for ms_synced_length 6c926f426a2 Simplify log vdev removal code 21e7cf5da89 zdb -L should skip leak detection altogether df72b8bebe0 Rename range_tree_verify to range_tree_verify_not_present 75058f33034 Remove unused vdev_t fields
10701 Correct lock ASSERTs in vdev_label_read/write
illumos/illumos-gate@58447f688d5e308373ab16a3b129bc0ba0fbc154
https://github.com/illumos/illumos-gate/commit/58447f688d5e308373ab16a3b129bc0ba0fbc154
https://www.illumos.org/issues/10701
Port of ZoL commit: 0091d66f4e Correct lock ASSERTs in vdev_label_read/write
At a minimum, this fixes a blown assert during an MMP test run when running on
a DEBUG build.
11770 additional mmp fixes
illumos/illumos-gate@4348eb901228d2f8fa50bb132a34248e8662074e
https://github.com/illumos/illumos-gate/commit/4348eb901228d2f8fa50bb132a34248e8662074e
https://www.illumos.org/issues/11770
Port a few additional MMP fixes from ZoL that came in after our
initial MMP port. 4ca457b065 ZTS: Fix mmp_interval failure ca95f70dff zpool import progress kstat
(only minimal changes from above can be pulled in right now) 060f0226e6 MMP interval and fail_intervals in uberblock
Note from the committer (me).
I do not have any use for this feature and I have not tested it. I only
did smoke testing with multihost=off.
Please be aware.
I merged the code only to make future merges easier.
Since r354804 libzpool depends on libzfs for get_system_hostid symbol.
Except for zstreamdump, all binaries linked with libzpool were already
linked with libzfs. So, zstreamdump is the only fall-out.
Andriy Gapon [Fri, 22 May 2020 12:25:57 +0000 (12:25 +0000)]
MFC r354333,r354359: zfs: enable SPA_PROCESS on the kernel side
The purpose of this change is to group kernel threads specific to a
particular ZFS pool under a kernel process. There can be many dozens of
threads per pool. This change improves observability of those threads.
This change consists of several subchanges:
1. illumos taskq_create_proc can now pass its process parameter to
taskqueue. Also, use zfsproc instead of NULL for taskq_create. Caveat:
zfsproc might not be initialized yet. But in that case it is still NULL,
so not worse than before.
2. illumos sys/proc.h: kthread id is stored in t_did field, not t_tid.
3. zfs: enable SPA_PROCESS on the kernel side. The change is a bit hairy
as newproc() is implemented privately to spa.c. I couldn't think of a
better way to populate process name than to poke inside the argument for
the process routine.
4. illumos thread_create: allow assigning thread to process other than
zfsproc.
5. zfs: expose spa_proc to other users, assign sync and quiesce threads
to it.
Pool-specific threads created using (relatively new) zthr mechanism are
still assigned to the zfskern process rather than to a respective
zpool-xxx process. I am going to address this a bit later.
Andriy Gapon [Fri, 22 May 2020 12:06:53 +0000 (12:06 +0000)]
MFC r361001: sound/hda: newer AMD devices still require the same PCIe snoop
So, replicate the ATI vendor snoop configuration for the AMD vendor.
I think that this should fix a number of cases where users currently
have to resort to polling or disabling MSI.
Andriy Gapon [Fri, 22 May 2020 12:05:01 +0000 (12:05 +0000)]
MFC r360779: gpioiic_attach: fix a NULL pointer crash on hints-based systems
The attach method uses GPIO_GET_BUS() to get a "newbus" device
that provides a pin. But on hints-based systems a GPIO controller
driver might not be fully initialized yet and it does not know gpiobus
hanging off it. Thus, GPIO_GET_BUS() cannot be called yet.
The reason is that controller drivers typically create a child gpiobus
using gpiobus_attach_bus() and that leads to the following call chain:
gpiobus_attach_bus() -> gpiobus_attach() ->
bus_generic_attach(gpiobus) -> gpioiic_attach().
So, gpioiic_attach() is called before gpiobus_attach_bus() returns.
I observed this bug with nctgpio driver on amd64.
I think that the problem was introduced in r355276.
The fix is to avoid calling GPIO_GET_BUS() from the attach method.
Instead, we know that on hints-based systems only the parent gpiobus can
provide the pins.
Nothing is changed for FDT-based systems.
Andriy Gapon [Fri, 22 May 2020 11:57:48 +0000 (11:57 +0000)]
MFC r360242: acpi_iicbus: set device description in the probe method
Kernel prints the device announcement before the attach method is
called, so if the correct description is not set by the probe method,
then the announcement would have an incorrect one.
Andriy Gapon [Fri, 22 May 2020 11:41:08 +0000 (11:41 +0000)]
MFC r358380,r358382: dsl_dataset_promote_sync: populate 'oldname' before using it
It's very unlikely that zfsvfs_update_fromname() and
zvol_rename_minors() ever did anything during the promote operation as
the old name was not initialized.