Commit Graph

232792 Commits

Author SHA1 Message Date
Konstantin Belousov
3621ba1ede Add Intel Spec Store Bypass Disable control.
Speculative Store Bypass (SSB) is a speculative execution side channel
vulnerability identified by Jann Horn of Google Project Zero (GPZ) and
Ken Johnson of the Microsoft Security Response Center (MSRC)
https://bugs.chromium.org/p/project-zero/issues/detail?id=1528.
Updated Intel microcode introduces a MSR bit to disable SSB as a
mitigation for the vulnerability.

Introduce a sysctl hw.spec_store_bypass_disable to provide global
control over the SSBD bit, akin to the existing sysctl that controls
IBRS. The sysctl can be set to one of three values:
0: off
1: on
2: auto

Future work will enable applications to control SSBD on a per-process
basis (when it is not enabled globally).

SSBD bit detection and control was verified with prerelease microcode.

Security:	CVE-2018-3639
Tested by:	emaste (previous version, without updated microcode)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-05-21 21:08:19 +00:00
Konstantin Belousov
9be4bbbb21 Add definition for Intel Speculative Store Bypass Disable MSR bits
Security:	CVE-2018-3639
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-05-21 21:07:13 +00:00
Konstantin Belousov
2320153fcc Preserve other bits in IA32_SPEC_CTL MSR when changing the IBRS and
STIBP states.

Tested by:	emaste (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2018-05-21 21:05:55 +00:00
Andriy Gapon
a23a4e68fa uchcom: extend hardware support to version 0x30
This change adds support for a UBS<->RS232 adapter based on CH340 (or an
analogue) that I own.  The device seems to have a newer internal version
(0x30) and the existing code incorrectly configures line control for it
resulting in garbled transmission.  The changes are based on what I
learned in Linux drivers for the same hardware.

Additional changes:
- use UCHCOM_REG_LCR1 / UCHCOM_REG_LCR2 instead of explicit 0x18 and
  0x25
- use NULL instead of 0 where a pointer is expected

Reviewed by:	hselasky
MFC after:	3 weeks
Differential Revision: https://reviews.freebsd.org/D15498
2018-05-21 21:04:31 +00:00
Andriy Gapon
dad3e656eb uchcom: remove UCHCOM_REG_BREAK2 alias of UCHCOM_REG_LCR1
Also, add definitions for more bits of UCHCOM_REG_LCR1 as seen in the
Linux driver.  UCHCOM_LCR1_PARENB definition was different from that in
the Linux driver and clashed with newly added UCHCOM_LCR1_RX.  I took a
liberty to change UCHCOM_LCR1_PARENB to the Linux definition as it was
unused in the driver anyway.  This change should make
uchcom_cfg_set_break() easier to understand.

Approved by:	hselasky
MFC after:	2 weeks
2018-05-21 21:02:10 +00:00
Andriy Gapon
40e7b06492 uchcom: reject parity and double stop bits as unsupported
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 21:00:13 +00:00
Andriy Gapon
7acd73fd1e uchcom: add a hardware configuration tweak seen in Linux code
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:59:15 +00:00
Andriy Gapon
1d33c9a55f uchcom: add DPRINTF-s to aid debugging of the driver
Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:58:06 +00:00
Andriy Gapon
d759c295c1 uchcom: report detected product based on USB product ID
Product IDs are specified in vendor documents.  The previously used
device ID is not.  This is a cosmetic change.  No functionality depends
on those IDs.

Reviewed by:	hselasky
MFC after:	2 weeks
2018-05-21 20:57:14 +00:00
Jean-Sébastien Pédron
b554075d14 teken: Rename the "Set Cursor Style" sequence to match vt100.net docs
This fixes inconsistencies with the rest of the `sequences` file.

No functional changes.

Requested by:	ed
2018-05-21 20:35:16 +00:00
Andriy Gapon
27dca831a6 stop and restart kernel event timers in the suspend / resume cycle
I have a system that is very unstable after resuming from suspend-to-RAM
but only if HPET is used as the event timer.  The theory is that SMM
code / firmware could be enabling HPET for its own uses and unexpected
interrupts cause a trouble for it.  Originally I wanted to solve the
problem in hpet_suspend() method, but that was insufficient as the event
timer could get reprogrammed again.

So, it's better, for my case and in general, to stop the event timer(s)
before entering the hardware suspend.

MFC after:	4 weeks
Differential Revision: https://reviews.freebsd.org/D15413
2018-05-21 20:23:04 +00:00
Konstantin Belousov
5988464ec4 Fix grammar.
Submitted by:	alc
MFC after:	1 week
2018-05-21 19:15:05 +00:00
Konstantin Belousov
0a4b04a616 Add missed barrier for pm_gen/pm_active interaction.
When we issue shootdown IPIs, we first assign zero to pm_gens to
indicate the need to flush on the next context switch in case our IPI
misses the context, next we read pm_active. On context switch we set
our bit in pm_active, then we read pm_gen. It is crucial that both
threads see the memory in the program order, otherwise invalidation
thread might read pm_active bit as zero and the context switching
thread might read pm_gen as zero.

IA32 allows CPU for both reads to see zero. We must use the barriers
between write and read. The pm_active bit set is already locked, so
only the invalidation functions need it.

I never saw it in real life, or at least I do not have a good
reproduction case. I found this during code inspection when hunting
for the Xen TLB issue reported by cperciva.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D15506
2018-05-21 18:41:16 +00:00
Edward Tomasz Napierala
733efc21c4 Add a somewhat ugly hack that makes OSX serial device node names
human-readable.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 17:33:52 +00:00
Edward Tomasz Napierala
c7ad27069e Fix typo.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 16:50:27 +00:00
Edward Tomasz Napierala
ac4a7f30d2 Improve description strings for USB device-mode serial ports.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 16:33:13 +00:00
Andrey V. Elsukov
4bb8a5b0c9 Remove check for matching the rulenum, ruleid and rule pointer from
dyn_lookup_ipv[46]_state_locked(). These checks are remnants of not
ready to be committed code, and they are there by accident.
Due to the race these checks can lead to creating of duplicate states
when concurrent threads in the same time will try to add state for two
packets of the same flow, but in reverse directions and matched by
different parent rules.

Reported by:	lev
MFC after:	3 days
2018-05-21 16:19:00 +00:00
Andrew Turner
78921ae879 Restrict the faulting addresses we call pmap_fault from to just those that
may fault due to superpage mappings being changed.

Sponsored by:	DARPA, AFRL
2018-05-21 16:14:53 +00:00
Matt Macy
f42a83f2a6 inpcb: revert deferred inpcb free pending further review 2018-05-21 16:13:43 +00:00
Mark Johnston
13679ebac9 Don't pass a section cookie to CK for non-preemptible epoch sections.
They're only useful when multiple threads may share an epoch record,
and that can't happen with non-preemptible sections.

Reviewed by:	mmacy
Differential Revision:	https://reviews.freebsd.org/D15507
2018-05-21 16:03:51 +00:00
Edward Tomasz Napierala
d01c1c8bfe Use USB Vendor Identifiers and Product Identifiers provided by V-USB
(https://github.com/obdev/v-usb/blob/master/usbdrv/USB-IDs-for-free.txt).
Previously we were using an invalid (not assigned to us) VID.

Reviewed by:	hselasky@
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2018-05-21 15:06:19 +00:00
Michael Tuexen
c692df45fc Only fillin data srucuture when actually stored. 2018-05-21 14:53:22 +00:00
Michael Tuexen
d3132db2b5 Do the appropriate accounting when ip_output() fails. 2018-05-21 14:52:18 +00:00
Michael Tuexen
95844fce7d Make clear why there is an assignment, which is not necessary. 2018-05-21 14:51:20 +00:00
Ed Maste
3b9b6b1704 Pair CURVNET_SET and CURVNET_RESTORE in a block
Per vnet(9), CURVNET_SET and CURVNET_RESTORE cannot be used as a single
statement for a conditional and CURVNET_RESTORE must be in the same
block as CURVNET_SET (or a subblock).

Reviewed by:	andrew
Sponsored by:	The FreeBSD Foundation
2018-05-21 13:08:44 +00:00
Emmanuel Vadot
785724755a release: arm64: Use loader.efi as bootaa64.efi for RPI3 and PINE64
boot1.efi have some trouble to read MBR partitions, it needs them to be
aligned a certain way while loader.efi can cope with them either way.
We want to switch to loader.efi as the main efi loader everywhere, it seems
that arm64 using MBR partition will be the guinea pig.

Tested On: RPI3, Pine64
Reviewed by:	imp
Approved by:	gjb
2018-05-21 11:58:02 +00:00
Ed Maste
15f8acc53f Revert r333968, it broke all archs but i386 and amd64 2018-05-21 11:56:07 +00:00
Eitan Adler
6ffc72df9d top(1): fix build
Remove 'top.local.hs'. This was not noticed since
/srv/obj/fbsd/srv/src/freebsd/svn/head/amd64.amd64/usr.bin/top/top.local.h
existed locally on my machine despite "make clean". Only fully removing
the objdir allowed me to observe the error directly.

Pointyhat to:	me
2018-05-21 09:43:50 +00:00
Eitan Adler
3c9ec0a580 top(1): clean up some "const" related warnings
This leaves at WARNS=6:
35 warnings in top.c
88 warnings in machine.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:32:52 +00:00
Eitan Adler
1b7645c629 top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces
the number of warnings at WARNS=6
- use "static" where possible
- sprinkle const where possible

This leaves at WARNS=6:
35 warnings in top.c
88 warnings in machine.c
7 warnings in commands.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:25:21 +00:00
Eitan Adler
dfa5eb70ae Add missing va_end
Reported by:	andrew
2018-05-21 09:21:42 +00:00
Eitan Adler
00157b4c04 Revert r333969 which contained one too many changes 2018-05-21 09:20:26 +00:00
Eitan Adler
bfb79c2ccc top(1): modernize a bit; reduce warnings
- Replace caddr_t with "void *". This reduces
the number of warnings at WARNS=6
- use "static" where possible
- sprinkle const where possible

This leaves at WARNS=6:
35 warnings in top.c
72 warnings in machine.c
5 warnings in commands.c

all of which are either "incompatible-pointer-types-discards-qualifiers"
or "cast-qual"
2018-05-21 09:18:01 +00:00
Matt Macy
ed6bb714b2 in(6)_mcast: Expand out vnet set / restore macro so that they work in a conditional block
Reported by:	zec at fer.hr
2018-05-21 08:34:10 +00:00
Matt Macy
06b15160e1 ensure that vnet is set when doing in_leavegroup 2018-05-21 07:12:06 +00:00
Mateusz Guzik
edacda736b amd64: annotate pti with __read_frequently 2018-05-21 05:20:23 +00:00
Eitan Adler
9aeb8f9999 top(1): add myself as a MAINTAIENR
also fix some nits
2018-05-21 05:00:19 +00:00
Eitan Adler
b3b6732412 top(1): remove prime.c
This file was not connected to the build, and is better served by
primes(6) anyways.
2018-05-21 04:51:43 +00:00
Eitan Adler
ad8ffc3fc2 top(1): fix MIPS
I missed where the parentheses were.

Reported by:	imp
2018-05-21 04:47:13 +00:00
Eitan Adler
5ef89dbfa7 top(1): further unconditionally assume we're on FreeBSD 2018-05-21 04:40:20 +00:00
Eitan Adler
419fab3b14 top(1): clean up in prep for const poisoning
- sprinkle "const" in a few obvious places
- remove "(void)" in front of lack-of-error-checked functions
2018-05-21 04:32:14 +00:00
Eitan Adler
47ffa267d7 top(1): further unconditionally assume we're on FreeBSD 2018-05-21 04:02:45 +00:00
Eitan Adler
1d6a4ba350 top(1): build with WARNS=3
This fixes everything but
-Wincompatible-pointer-types-discards-qualifiers
2018-05-21 03:58:15 +00:00
Eitan Adler
a5ca08ed94 top(1): fix several more warnings 2018-05-21 03:36:16 +00:00
Matt Macy
fd04260d3f ck: simplify interface with libkvm consumers by defining ck_queue types
as their queue.h equivalents if !_KERNEL
2018-05-21 01:53:23 +00:00
Eitan Adler
986a5bafb1 top(1): fix build on arches where size_t != ull 2018-05-21 01:39:26 +00:00
Marius Strobl
dd5dbb3199 - Unbreak booting sparc64 kernels after the metadata unification in
r329190; sparc64 kernels are always 64-bit but with that revision
  in place, the loader was treating them as 32-bit ones.
- In order to reduce the likelihood of this kind of breakage in the
  future, #ifdef out md_load() on sparc64 and make md_load_dual() -
  which is currently local to metadata.c anyway - static.
- Make md_getboothowto() - also local to metadata.c - static.
- Get rid of the unused DTB pointer on sparc64.
2018-05-21 01:20:19 +00:00
Eitan Adler
fcfaa4734c top(1): pull function declarations and externs into headers 2018-05-21 01:16:26 +00:00
Eitan Adler
4e33a6b507 top(1): fix "variable without declaration" warning
This is only shown at WARNS=6, but since we don't yet build at WARNS=2
its hidden.
2018-05-21 01:05:32 +00:00
Eitan Adler
666cf87393 top(1): clean much of WARNS=3 issues
There is still one glaring issue: new_message is not a protoype, but
can't be trivially converted since it uses K&R style var-args.
2018-05-21 00:53:42 +00:00