openbsd
6 years agoVMD: vioscsi - add support for REPORT_LUNS opcode
ccardenas [Tue, 16 Jan 2018 06:10:45 +0000 (06:10 +0000)]
VMD: vioscsi - add support for REPORT_LUNS opcode

ok mlarkin@

6 years agoAdd tests that unmount a file system while it is busy. On a vnd
bluhm [Mon, 15 Jan 2018 23:58:43 +0000 (23:58 +0000)]
Add tests that unmount a file system while it is busy.  On a vnd
device "cp -r" and "rm -rf" are working in the background while
"umount -f" or "mount -ur" are executed.  Then "fsck -f" is used
to verify that the file system is clean.
Currently this triggers a bug quite reliably.  After the mount point
has been changed to read-only, the file system check shows that not
everything was flushed and synced properly.

6 years agoDon't try to open HISTFILE if the variable is unset.
jca [Mon, 15 Jan 2018 22:30:38 +0000 (22:30 +0000)]
Don't try to open HISTFILE if the variable is unset.

str_val returns null, not NULL, if the variable isn't set.  The
erroneous check means that we later tried to open("").

ok millert@ tb@ anton@ benno@

6 years agoSwitch the inteldrm(4) i2c code over to the Linux code base. This gives us
kettenis [Mon, 15 Jan 2018 22:24:17 +0000 (22:24 +0000)]
Switch the inteldrm(4) i2c code over to the Linux code base.  This gives us
several quirks that wre absent in the old OpenBSD-specific reimplementation.
Fixes several issues with external connectors on several generations of
hardware.

ok deraadt@, benno@

6 years agomask out (ie. ignore) the bit which will be MAP_STACK in the future,
deraadt [Mon, 15 Jan 2018 21:30:49 +0000 (21:30 +0000)]
mask out (ie. ignore) the bit which will be MAP_STACK in the future,
so diffs in snapshots can exercise the change in a less disruptive way
idea with sthen, ok kettenis tom others

6 years agoWe have no deprecated regress variables in our tree. Remove the
bluhm [Mon, 15 Jan 2018 20:38:47 +0000 (20:38 +0000)]
We have no deprecated regress variables in our tree.  Remove the
compatibility layer.

6 years agoRevert my changes in r1.60 back to nicm@'s latest for now.
brynet [Mon, 15 Jan 2018 19:45:51 +0000 (19:45 +0000)]
Revert my changes in r1.60 back to nicm@'s latest for now.

Fixes "file *|grep" breakage reported by espie@

ok nicm, deraadt

6 years agotabs vs spaces
mlarkin [Mon, 15 Jan 2018 18:57:59 +0000 (18:57 +0000)]
tabs vs spaces

6 years agoAnother redundant check, GitHub issue 1219.
nicm [Mon, 15 Jan 2018 15:30:03 +0000 (15:30 +0000)]
Another redundant check, GitHub issue 1219.

6 years agoSome unused code, GitHub issue 1219.
nicm [Mon, 15 Jan 2018 15:27:03 +0000 (15:27 +0000)]
Some unused code, GitHub issue 1219.

6 years agoStop pretending we support building ksh without EDIT/HISTORY support
jca [Mon, 15 Jan 2018 14:58:05 +0000 (14:58 +0000)]
Stop pretending we support building ksh without EDIT/HISTORY support

ok anton@

6 years agoImprove defense against branch predictor target injection (Spectre "variant 2")
kettenis [Mon, 15 Jan 2018 14:11:16 +0000 (14:11 +0000)]
Improve defense against branch predictor target injection (Spectre "variant 2")
attacks.  OpenBSD/armv7 is already in pretty good shape as we have always
been flushing the branch predictor cache on context switches.  This diff adds
additional flushes to page faults in kernel address space.  The impact on
performance should be minimal as these page faults should only happen when
userland (deliberately or accidentally) tries to access kernel addres space
which would lead to a fatal signal (SIGSEGV or SIGBUS).

Loosely based on changes made by Marc Zyngier in Linux and based on
information in Arm Trusted Firmware Security Advisory TFV 6.

Note that for Cortex-A15 (and Cortex-A72) you will need firmware that sets
the ACTRL[0] bit for this diff to be effective.  Also note that with this
diff Cortex-A57 is still vulnerable.

ok jsg@

6 years agoThere was an issue that dynamic path MTU discovery together with
bluhm [Mon, 15 Jan 2018 13:48:31 +0000 (13:48 +0000)]
There was an issue that dynamic path MTU discovery together with
ARP or ND timeout could delete local routes.  Put an assert into
arptfree() and nd6_free() so this cannot happen again.
OK mpi@

6 years agoEnable traceroute test for incoming route-to rule.
bluhm [Mon, 15 Jan 2018 12:27:45 +0000 (12:27 +0000)]
Enable traceroute test for incoming route-to rule.

6 years agoWhen pf(4) forwards incoming packets with route-to or reply-to,
bluhm [Mon, 15 Jan 2018 12:25:03 +0000 (12:25 +0000)]
When pf(4) forwards incoming packets with route-to or reply-to,
decrement the time-to-live or hop-limit field to prevent routing
loops.  Sending an ICMP time exceeded error makes traceroute work.
For outgoing packets ip_forward() has already done this.
OK visa@ sashan@

6 years agoAdd s_server and s_client -tlsextdebug messages
inoguchi [Mon, 15 Jan 2018 11:02:07 +0000 (11:02 +0000)]
Add s_server and s_client -tlsextdebug messages

ok sthen@ jsing@

6 years agoSpacing, no object change.
mpi [Mon, 15 Jan 2018 09:54:48 +0000 (09:54 +0000)]
Spacing, no object change.

6 years agofix parsing of RDATA for TXT records
eric [Mon, 15 Jan 2018 08:48:40 +0000 (08:48 +0000)]
fix parsing of RDATA for TXT records

ok gilles@

6 years agosync
jsg [Mon, 15 Jan 2018 07:47:46 +0000 (07:47 +0000)]
sync

6 years agoAdd some AVX512 CPUID flags.
mlarkin [Mon, 15 Jan 2018 06:53:02 +0000 (06:53 +0000)]
Add some AVX512 CPUID flags.

discussed with sf and kettenis

6 years agoVMD: vioscsi refactor
ccardenas [Mon, 15 Jan 2018 04:26:58 +0000 (04:26 +0000)]
VMD: vioscsi refactor

Each opcode is now handled in the respective function (vioscsi_handle_xxx)
which allows more functionality to be added easier.

No functional changes confirmed by guest testing.

ok mlarkin@

6 years agoLink ed regress to build.
bluhm [Sun, 14 Jan 2018 22:04:47 +0000 (22:04 +0000)]
Link ed regress to build.

6 years agoRun the tests provided in /usr/src/bin/ed/test with the regress
bluhm [Sun, 14 Jan 2018 22:01:48 +0000 (22:01 +0000)]
Run the tests provided in /usr/src/bin/ed/test with the regress
framework.  Three ed tests are currently failing for unknown reasons.
They are marked as disabled for now.
from Sergey Bronnikov

6 years agoAdd two more ARM EABI aliases that I missed in the previous libc minor
kettenis [Sun, 14 Jan 2018 21:47:10 +0000 (21:47 +0000)]
Add two more ARM EABI aliases that I missed in the previous libc minor
bump.

"just go  ahead -- crank" deraadt@

6 years agoMake cpu_ucode_debug non static so it can be changed from ddb.
bluhm [Sun, 14 Jan 2018 20:15:37 +0000 (20:15 +0000)]
Make cpu_ucode_debug non static so it can be changed from ddb.
OK patrick@

6 years agounifdef BRACE_EXPAND; ok jca@
anton [Sun, 14 Jan 2018 16:04:21 +0000 (16:04 +0000)]
unifdef BRACE_EXPAND; ok jca@

6 years agoPrefetched sets are stored by root, but are read by an unprivileged
rpe [Sun, 14 Jan 2018 12:12:52 +0000 (12:12 +0000)]
Prefetched sets are stored by root, but are read by an unprivileged
user during the actual install phase. Add a check to the selection
of the prefetch area to ensure the unprivleged user can read files
from there.

Move the selection logic to its own function prefetcharea_fs_list()
which returns a unique list of candidate filesystems, or with rc=1.
While at it, remove /var/tmp from the potential list of candidates
because it's a symbolic link to /tmp since 2014.

Change install_files() to loop over the candidates and check if it
can read a test file, otherwise clean up and skip this filesystem.

Problem found by benno@ whose upgrade failed due to /usr/obj being
owned by build:wobj and permissions that prevented the unprivileged
user to read the prefetched set files from there.

discussed with and OK benno@ halex@ tb@

6 years agoPass our currently configured SSID to iwm(4) scan commands.
stsp [Sun, 14 Jan 2018 11:51:34 +0000 (11:51 +0000)]
Pass our currently configured SSID to iwm(4) scan commands.

This makes connecting to silly "hidden" networks work, which was a long
standing problem with iwm(4). My past observations where other SSIDs were
filtered from scan results while associated can no longer be reproduced.

ok robert phessler

6 years agoFix after recent mutex change.
mpi [Sun, 14 Jan 2018 09:32:09 +0000 (09:32 +0000)]
Fix after recent mutex change.

6 years agoUnlocking the TCP stack resulted in smaller TCP segments sent out
bluhm [Sun, 14 Jan 2018 00:53:11 +0000 (00:53 +0000)]
Unlocking the TCP stack resulted in smaller TCP segments sent out
early on some machines.  Use the TCP_NOPUSH socket option to get
reliable regress results and syslogd(8) debug messages for grep.

6 years agoUse signed values to compare absolute difference. The variables
bluhm [Sun, 14 Jan 2018 00:33:09 +0000 (00:33 +0000)]
Use signed values to compare absolute difference.  The variables
fid and cfid are signed, so the FID_TO_VCO_FID() macro creates
signed results.  Keep the sign when passing to abs() although the
implicit conversions created the same binary.
OK deraadt@

6 years agoAdd descriptions for HAVE_B64_NTOP and HAVE_B64_PTON so autoheader
millert [Sat, 13 Jan 2018 20:40:43 +0000 (20:40 +0000)]
Add descriptions for HAVE_B64_NTOP and HAVE_B64_PTON so autoheader
will run.  OK florian@

6 years agoMake things work when using the official device tree bindings used by the
kettenis [Sat, 13 Jan 2018 18:08:20 +0000 (18:08 +0000)]
Make things work when using the official device tree bindings used by the
Linux kernel.

6 years agotweak previous;
jmc [Sat, 13 Jan 2018 17:13:12 +0000 (17:13 +0000)]
tweak previous;

6 years agoIn ext2fs_write(), clear the buffer on uiomove() failure unless it
millert [Sat, 13 Jan 2018 15:57:58 +0000 (15:57 +0000)]
In ext2fs_write(), clear the buffer on uiomove() failure unless it
was cleared on alloc just like we do in ffs_write().

6 years agoAdd comment describing why we need to clear the buffer if uiomove()
millert [Sat, 13 Jan 2018 15:56:02 +0000 (15:56 +0000)]
Add comment describing why we need to clear the buffer if uiomove()
fails, adapted from FreeBSD.  Also avoid clearing the buffer if it
was cleared when allocated.  OK deraadt@ otto@

6 years agoAdjust comment to reflect '%F' addition.
tb [Sat, 13 Jan 2018 15:43:39 +0000 (15:43 +0000)]
Adjust comment to reflect '%F' addition.

6 years agoDefine and use IPL_MPFLOOR in our common mutex implementation.
mpi [Sat, 13 Jan 2018 15:18:11 +0000 (15:18 +0000)]
Define and use IPL_MPFLOOR in our common mutex implementation.

ok kettenis@, visa@

6 years agoIn vldcp(8) fix a race between vldcpread() and vldcp_rx_intr() which
stsp [Sat, 13 Jan 2018 15:10:02 +0000 (15:10 +0000)]
In vldcp(8) fix a race between vldcpread() and vldcp_rx_intr() which
was overlooked by my previous fix.

Keep SPL at TTY in vldcpread() while manipulating the rx queue head.
Otherwise we could end up in a situation where:
1: vldcpread() reads rx_head
2: vldcpread() calls splx()
3: vldcp_rx_intr() fires, finds rx link is down, and sets rx_head = rx_tail
4: vlcdpread() resumes and sets rx_head to the value it read in step 1
-> same interrupt storm problem as described in my previous commit

ok kettenis@ mpi@

6 years agoAllow printf '%F' format specifier.
tb [Sat, 13 Jan 2018 15:09:49 +0000 (15:09 +0000)]
Allow printf '%F' format specifier.

ok millert

6 years agoAdd a linux compatible request_firmware() wrapper around loadfirmware(9).
jsg [Sat, 13 Jan 2018 14:15:07 +0000 (14:15 +0000)]
Add a linux compatible request_firmware() wrapper around loadfirmware(9).
ok deraadt@ kettenis@

6 years agoadd kqueue support to drm(4) by making the drm_sysfs_hotplug_event()
robert [Sat, 13 Jan 2018 13:03:42 +0000 (13:03 +0000)]
add kqueue support to drm(4) by making the drm_sysfs_hotplug_event()
available on OpenBSD well and by notifying listeners of a device
state change using EVFILT_DEVICE and NOTE_CHANGE.

drm_sysfs_hotplug_event() gets called when a state change of the device
occured, like an hdmi cable has been plugged, this in the future will
be used by the modesetting xorg driver to notify desktop environments
via randr events to update their screen configuration

ok kettenis@

6 years agointroduce a filter called EVFILT_DEVICE that can be used to notify
robert [Sat, 13 Jan 2018 12:58:40 +0000 (12:58 +0000)]
introduce a filter called EVFILT_DEVICE that can be used to notify
listeners of device state changes.
currently only supports NOTE_CHANGE that will be used by drm(4)

ok kettenis@

6 years agocoordinate again: polishing
bru [Sat, 13 Jan 2018 11:54:01 +0000 (11:54 +0000)]
coordinate again: polishing

6 years agoAdd a barrier at the end of pmap_map_early() such that the new mapping is
kettenis [Sat, 13 Jan 2018 10:58:50 +0000 (10:58 +0000)]
Add a barrier at the end of pmap_map_early() such that the new mapping is
guaranteed to be available after pmap_map_early() returns.  Fixes a hang
seen with the in-progress SMP work.

ok patrick@

6 years agocatch up with how formatting of long links was changed
schwarze [Sat, 13 Jan 2018 05:21:06 +0000 (05:21 +0000)]
catch up with how formatting of long links was changed
in both groff and mandoc

6 years agoRemove the implicit display feature of .Lk because it was inconsistent
schwarze [Sat, 13 Jan 2018 05:20:10 +0000 (05:20 +0000)]
Remove the implicit display feature of .Lk because it was inconsistent
across output devices, counter-intuitive, and resulted in ugly
output for many real-world manual pages.  Always format even long
links in-line.  I already committed a similar change to groff.

OK jmc@, bentley@, and the original author
of the feature, Werner Lemberg <wl@gnu.org>.

6 years agoremove unused parameter from the static function print_expansions();
schwarze [Sat, 13 Jan 2018 02:06:54 +0000 (02:06 +0000)]
remove unused parameter from the static function print_expansions();
patch from Michael W. Bombardieri <mb at ii dot net>;
OK tb@

6 years agoclarify authorship; prodded by and ok markus@
naddy [Sat, 13 Jan 2018 00:24:09 +0000 (00:24 +0000)]
clarify authorship; prodded by and ok markus@

6 years agohave carp use standard detach hooks instead of getting special handling
dlg [Fri, 12 Jan 2018 23:47:24 +0000 (23:47 +0000)]
have carp use standard detach hooks instead of getting special handling

if_deactivate looked for carp parent interfaces and called carp_ifdetach
to have children interfaces unplug themselves. this diff has the
carp interfaces register detach hooks on the parent instead. the
effect is the same, but using the standard every other interface
uses.

while im here i shuffle the order the hooks carp_set_ifp are
estabilshed so it will fail if they arent allocated.

ok visa@ mpi@

6 years agounbreak configurations using carppeers
dlg [Fri, 12 Jan 2018 23:29:37 +0000 (23:29 +0000)]
unbreak configurations using carppeers

ip_carp.c r1.322 removed the ability to receive carp protocol packets
on !IFT_CARP interfaces. however, carppeers cause the carp protocol
packets to be directed to a unicast address on another interface,
which definitely is not mapped back to a carp interface.

this brings back the ability to get carp packets on parent interfaces.
it is a bit different to a backout because it only allows carp
parents to be ethernet interfaces.

mpi@ told me carp regress tests were failing.

6 years agoAdd MULTIPROCESSOR basics for arm64. Enough to build and run a kernel with
kettenis [Fri, 12 Jan 2018 22:20:28 +0000 (22:20 +0000)]
Add MULTIPROCESSOR basics for arm64.  Enough to build and run a kernel with
option MULTIPROCESSOR on a single CPU.

ok patrick@

6 years agoDon't bother ucode updates in ramdisk. We don't have the files....
deraadt [Fri, 12 Jan 2018 20:14:20 +0000 (20:14 +0000)]
Don't bother ucode updates in ramdisk.  We don't have the files....
ok patrick

6 years agoapostrophe fix;
jmc [Fri, 12 Jan 2018 20:13:06 +0000 (20:13 +0000)]
apostrophe fix;

6 years agosync
deraadt [Fri, 12 Jan 2018 17:43:05 +0000 (17:43 +0000)]
sync

6 years agoDo not collect top-bit-set characters in case they need to be replaced.
nicm [Fri, 12 Jan 2018 16:43:47 +0000 (16:43 +0000)]
Do not collect top-bit-set characters in case they need to be replaced.

6 years agoSimplify character replacement on non-UTF-8 terminals and make a common
nicm [Fri, 12 Jan 2018 16:41:00 +0000 (16:41 +0000)]
Simplify character replacement on non-UTF-8 terminals and make a common
function.

6 years agoSimplify UTF-8 states down into one state.
nicm [Fri, 12 Jan 2018 16:32:12 +0000 (16:32 +0000)]
Simplify UTF-8 states down into one state.

6 years agoUse correct size in allocarray() call.
kettenis [Fri, 12 Jan 2018 14:53:37 +0000 (14:53 +0000)]
Use correct size in allocarray() call.

ok patrick@

6 years agoRuntime services may (and do) use device mappings on some UEFI implementations.
kettenis [Fri, 12 Jan 2018 14:52:55 +0000 (14:52 +0000)]
Runtime services may (and do) use device mappings on some UEFI implementations.
Skip these mappings during the remap-pahse as they are likely to be in
a different 512G bloch as memory and SetVirtualAddressMap() shouldn't need
them.  But do assign a new virtual address and let efi(4) create a mapping.
Add a PMAP_DEVICE flag such that pmap_enter() can continue to be used
to create these mappings.

ok patrick@

6 years agoSome more tweaks to NOTES
jca [Fri, 12 Jan 2018 14:20:57 +0000 (14:20 +0000)]
Some more tweaks to NOTES

- it's safe to assume that there's no plan to write "an `agent' to
  execute unreadable/setuid/setgid shell scripts"
- the BUG-REPORTS file has been removed
- update the entry for FPATH, ksh93 also documents the described behavior
- kill entry about octal and hex notation in arithmetic expressions
  (supported)
- typos

Feedback from Klemens Nanni

6 years agoFix tyops
jca [Fri, 12 Jan 2018 14:04:49 +0000 (14:04 +0000)]
Fix tyops

6 years agoAdd tests for [[:foo:]] character classes in globs
jca [Fri, 12 Jan 2018 13:54:10 +0000 (13:54 +0000)]
Add tests for [[:foo:]] character classes in globs

6 years agoAdd basic tests for octal and hex notation in arithmetic expansions
jca [Fri, 12 Jan 2018 11:13:29 +0000 (11:13 +0000)]
Add basic tests for octal and hex notation in arithmetic expansions

POSIX requires only decimal, octal and hex, tests for the $((x#number))
notation could be useful too.

6 years agoConstrain alloc_pages() to the dma_constraint range. Avoids a
jsg [Fri, 12 Jan 2018 11:03:15 +0000 (11:03 +0000)]
Constrain alloc_pages() to the dma_constraint range.  Avoids a
"Non dma-reachable buffer" panic when trying to use it from ttm code on
a machine with 8GB of physmem and a radeon.

ok kettenis@ dlg@ visa@ deraadt@

6 years agoCorrectly iterate over all extended signatures.
patrick [Fri, 12 Jan 2018 10:33:07 +0000 (10:33 +0000)]
Correctly iterate over all extended signatures.

Found by markus@
With sf@

6 years agoImprove error message if creating socket parent directory fails, from
nicm [Fri, 12 Jan 2018 10:22:02 +0000 (10:22 +0000)]
Improve error message if creating socket parent directory fails, from
Thomas Adam for GitHub issue 1215.

6 years agoImprove logging for layout cells.
nicm [Fri, 12 Jan 2018 10:16:03 +0000 (10:16 +0000)]
Improve logging for layout cells.

6 years agoUnify <machine/mutex.h> a bit further.
mpi [Fri, 12 Jan 2018 09:19:32 +0000 (09:19 +0000)]
Unify <machine/mutex.h> a bit further.

`mtx_owner' becomes the first field of 'struct mutex' on i386/amd64/arm64.

ok visa@

6 years agoIBRS -> IBRS,IBPB in identifycpu lines
mlarkin [Fri, 12 Jan 2018 08:21:30 +0000 (08:21 +0000)]
IBRS -> IBRS,IBPB in identifycpu lines

6 years agorevert previous changes to enable dwiic on Dell precision as it seems
mlarkin [Fri, 12 Jan 2018 08:11:47 +0000 (08:11 +0000)]
revert previous changes to enable dwiic on Dell precision as it seems
to cause issues on Dell XPS 15 9560. Will investigate and recommit later
if a better fix can be found.

6 years agoCheck that mpls has been enabled on the input interface, lost in rev 1.66
jca [Fri, 12 Jan 2018 06:57:56 +0000 (06:57 +0000)]
Check that mpls has been enabled on the input interface, lost in rev 1.66

While here fix under MPLS_DEBUG.  ok dlg@

6 years agoAlign cases in conversion switch vertically. Normalize logic inside cases
tb [Fri, 12 Jan 2018 06:22:31 +0000 (06:22 +0000)]
Align cases in conversion switch vertically. Normalize logic inside cases
and drop an unnecessary test for intdata in '%c'.

reads ok to halex, ok millert

6 years agoAdjust references for sysctl(3) to sysctl(2)
deraadt [Fri, 12 Jan 2018 04:36:44 +0000 (04:36 +0000)]
Adjust references for sysctl(3) to sysctl(2)

6 years agosysctl(3) can now be renamed to sysctl(2)
deraadt [Fri, 12 Jan 2018 04:36:12 +0000 (04:36 +0000)]
sysctl(3) can now be renamed to sysctl(2)

6 years agomove gif_encap from gif_output to gif_start.
dlg [Fri, 12 Jan 2018 02:25:27 +0000 (02:25 +0000)]
move gif_encap from gif_output to gif_start.

the main win is the simplification of bpf in the ouput path.

ok visa@

6 years agodocument bpfattach and bpfdetach.
dlg [Fri, 12 Jan 2018 02:19:47 +0000 (02:19 +0000)]
document bpfattach and bpfdetach.

6 years agorestrict carp to configuring ethernet interfaces as carpdevs.
dlg [Fri, 12 Jan 2018 00:36:13 +0000 (00:36 +0000)]
restrict carp to configuring ethernet interfaces as carpdevs.

previously the driver only cared that a carp interface wasnt configured
as a carpdev. because the code only really works on ethernet, it makes
sense to restrict it.

ok visa@ mpi@

6 years agoImprove the handling of coordinate inputs and filters.
bru [Thu, 11 Jan 2018 23:50:49 +0000 (23:50 +0000)]
Improve the handling of coordinate inputs and filters.

Single-touch and multi-touch coordinate inputs are treated more uniformly,
and the hysteresis filters have a more consistent implementation.  If
possible, pointer control will be assigned to touches with coordinate
updates that pass the default hysteresis filter (the function has been
moved to wsmouse.c).  The "strong" variant of hysteresis has been
improved, the new version won't double the threshold when a movement
changes the orientation on an axis.

There is an additional change in wstpad_configure, which ensures that a
zero size disables an edge area even if the coordinate limits are
misconfigured.

6 years agocast the result of the ternary operators in __swapXX to the right type
dlg [Thu, 11 Jan 2018 23:13:37 +0000 (23:13 +0000)]
cast the result of the ternary operators in __swapXX to the right type

ok kettenis@
let's try it deraadt@

6 years agoComments
rpe [Thu, 11 Jan 2018 22:44:44 +0000 (22:44 +0000)]
Comments

6 years agoUpdate the Intel microcode once the root filesystem has been mounted.
patrick [Thu, 11 Jan 2018 22:31:09 +0000 (22:31 +0000)]
Update the Intel microcode once the root filesystem has been mounted.
This depends on the intel-firmware package that contains newer Intel
microcode which will be installed automatically by fw_update(1).

The update should happen much earlier since updating the microcode can
add or remove not only feature flags but also whole features.  For now
only update feature flags that are relevant to Spectre.

Initial diff from sf@
Tested by bluhm@
ok deraadt@

6 years agoInstall the intel firmware package which contains microcode updates
patrick [Thu, 11 Jan 2018 22:07:23 +0000 (22:07 +0000)]
Install the intel firmware package which contains microcode updates
if we match Intel CPUs in dmesg(8).

"do it do it" deraadt@

6 years agoCreate a second hash that maps all possible drivers to a default regex
patrick [Thu, 11 Jan 2018 22:04:39 +0000 (22:04 +0000)]
Create a second hash that maps all possible drivers to a default regex
to match in dmesg(8).  This is helpful if we want to install firmware
depending on dmesg(8) output that does not follow the typical driver
scheme.

From espie@
"do it do it" deraadt@

6 years ago- change [] tests to [[]]
rpe [Thu, 11 Jan 2018 21:09:26 +0000 (21:09 +0000)]
- change [] tests to [[]]
- change -a, -o to &&, || inside [[]]
- remove unecessary quoting inside [[]]
- remove X"" constructs inside [[]]
- remove \ (line continuation) in case of &&, || and pipes
- replace backticks with $()

discussed with and OK aja@
OK tb

6 years agoChange the shebang line from /bin/sh to /bin/ksh in all base rc.d
rpe [Thu, 11 Jan 2018 19:52:12 +0000 (19:52 +0000)]
Change the shebang line from /bin/sh to /bin/ksh in all base rc.d
daemon scripts.

discussed with and OK aja@
OK tb

6 years agoExtract the control channel number from the chanspec information and
patrick [Thu, 11 Jan 2018 19:33:34 +0000 (19:33 +0000)]
Extract the control channel number from the chanspec information and
apply the channel to the node, like iwm(4) does, when supplying the
scan response to the net80211 stack.  Our stack uses this information
for node selection so it's elementary for it to be correct.

Tested by jcs@

6 years agofix parsing of long TXT records, this prevents 'smtpctl spf walk' from
gilles [Thu, 11 Jan 2018 19:20:41 +0000 (19:20 +0000)]
fix parsing of long TXT records, this prevents 'smtpctl spf walk' from
producing bogus entries with some SPF records.

ok ajacoutot@

6 years agoPostpone secondary CPUs until after mounthook activities. This is
patrick [Thu, 11 Jan 2018 18:58:17 +0000 (18:58 +0000)]
Postpone secondary CPUs until after mounthook activities.  This is
useful for loading CPU microcode from the disk before the CPUs are
let go.

Tested by visa@ on sgi, loongson and octeon
"don't see immediate issues" kettenis@
ok deraadt@

6 years agoThe PCI bwfm(4) chips have no TX rings in the traditional sense, as on
patrick [Thu, 11 Jan 2018 16:09:19 +0000 (16:09 +0000)]
The PCI bwfm(4) chips have no TX rings in the traditional sense, as on
the actual rings we only share messages.  Sending a TX packet means
putting a message on the ring which contains a pktid (which for us maps
to an mbuf) and the physical address of the mbuf.  On jcs@'s macbook he
seems to run out of TX pktids pretty quickly during a speedtest.  This
would mean that there are 2048 TX packets in flight that we either want
to send out or that have not been "acked" by the firmware yet.  Either
way, recover from that situation when we hit that arbitrary limit by
restarting the queue after we free'd a packet from the TX pktid list.

Tested by jcs@

6 years agoAdvance data pointer after exporting SA type to userland. Otherwise
bluhm [Thu, 11 Jan 2018 16:02:31 +0000 (16:02 +0000)]
Advance data pointer after exporting SA type to userland.  Otherwise
ipsecctl(8) may display bundled SA incorrectly.
from markus@

6 years agoAdd size for free.
visa [Thu, 11 Jan 2018 15:49:34 +0000 (15:49 +0000)]
Add size for free.

OK mpi@

6 years agoRemove arbitary length limits for -s, -b and -w. Based on a diff from kshe.
tb [Thu, 11 Jan 2018 14:53:42 +0000 (14:53 +0000)]
Remove arbitary length limits for -s, -b and -w. Based on a diff from kshe.
schwarze suggested using asprintf, which led to a substantial cleanup.

ok schwarze, help & ok millert

6 years agosync
kevlo [Thu, 11 Jan 2018 09:27:20 +0000 (09:27 +0000)]
sync

6 years agoAdd support for Huawei E3372.
kevlo [Thu, 11 Jan 2018 09:26:36 +0000 (09:26 +0000)]
Add support for Huawei E3372.

ok phessler@

6 years agoAdd tests for incoming route-to and outgoing reply-to rules. Disable
bluhm [Thu, 11 Jan 2018 03:23:16 +0000 (03:23 +0000)]
Add tests for incoming route-to and outgoing reply-to rules.  Disable
the cases that currently fail.

6 years agocarp_ourether gets passed the parent interface, not the carp interface.
dlg [Thu, 11 Jan 2018 00:14:15 +0000 (00:14 +0000)]
carp_ourether gets passed the parent interface, not the carp interface.

6 years agoget rid of struct carp_if by moving the srpl into struct ifnet if_carp.
dlg [Wed, 10 Jan 2018 23:50:39 +0000 (23:50 +0000)]
get rid of struct carp_if by moving the srpl into struct ifnet if_carp.

currently carp uses a struct carp_if to hold an srp list head, which
is accessed by both if_carp in struct ifnet, and via the if input
handlers list.

this gets rid of some indirection by making if_carp itself the list
head, rather than a pointer to the list head via a struct carp_if.
it also makes accessing the list consistent by only using if_carp
to get to it.

ok mpi@

6 years agoImplement FUCKWIT for arm64; unmap the kernel almost entirely while userland
kettenis [Wed, 10 Jan 2018 23:27:18 +0000 (23:27 +0000)]
Implement FUCKWIT for arm64; unmap the kernel almost entirely while userland
is running.  This provides protection against meltown on cores that are
vilnerable (just Cortex-A75 so far) but also seems to be an essential to
protect against spectre-like attacks against the kernel.

This implementation only exposes a single treampoline page that does not
contain any kernel virtual addresses and also hides the real virtual address
of the exception vectors, which helps on cores vulnerable to "variant 3a"
(Cortex-A57, Cortex-A72).  The implementation is inspired by the work done
by Will Deacon for Linux, but there are no knobs to turn it off.  The
overhead is fairly limited: around 3-4% slowdown on Cortex-A57.

ok patrick@, deraadt@

6 years agoMark sosplice task mp safe, do not grab kernel lock for tcp output.
bluhm [Wed, 10 Jan 2018 18:14:34 +0000 (18:14 +0000)]
Mark sosplice task mp safe, do not grab kernel lock for tcp output.
OK mpi@