Commit Graph

276618 Commits

Author SHA1 Message Date
pgoyette
9dd096f8e8 Add missing dependency.
Fixes builds with VM_SWAP but no other users of rijndael crypto code.
2020-05-10 22:28:09 +00:00
riastradh
8e0e0222cd Teach cpuctl(8) about ARMv8.5-RNG RNDR/RNDRRS support. 2020-05-10 21:42:05 +00:00
riastradh
54f539984b Print RNDR support in verbose CPU feature identification. 2020-05-10 21:41:19 +00:00
riastradh
dfffd336d6 Fix ID_AA64ISAR0_EL1_RNDR field definition for RNDR support.
ARMv8.5 ARM, p. D13-3232
2020-05-10 21:40:38 +00:00
christos
95c1f4af32 prefix errors with the program name and use stderr. 2020-05-10 19:54:49 +00:00
maya
b47e7497df Don't add getentropy.c to the build (remove symbol from libc)
Still being discussed in tech-userlevel. If we wait any longer someone
is going to try the excuse that the discussion is entirely pointless, since
removing symbols is too hard.
2020-05-10 19:36:49 +00:00
christos
baffecd911 Add SIGPIPE to the list of dhcpcd affected signals since we sigignore it. 2020-05-10 17:58:16 +00:00
skrll
62da6573ee Rename curbrk to __curbrk, and make it and __minbrk hidden 2020-05-10 14:34:31 +00:00
skrll
ef7a9d8de1 Don't futz with tpidr_el0 in {set,long}jmp as it breaks TLS as seen in
qemu
2020-05-10 14:05:59 +00:00
rillig
eb99d6c61c usr.bin/make: fix typo in dollar test 2020-05-10 13:03:40 +00:00
rillig
18fc19e9ea usr.bin/make: sort test cases alphabetically 2020-05-10 12:42:11 +00:00
rillig
c34ad787e6 usr.bin/make: add tests for surprising dollar removal 2020-05-10 12:34:01 +00:00
skrll
698fd2a973 Update for trap.h 2020-05-10 11:06:14 +00:00
skrll
1a2d1811f5 Provide a trap.h (currently empty) 2020-05-10 11:04:09 +00:00
skrll
fab263653b Trailing whitespace 2020-05-10 06:42:38 +00:00
maxv
e4eb677baa Pass -Wno-unused-command-line-argument for LLVM, discussed on
tech-toolchain@.
2020-05-10 06:38:24 +00:00
maxv
58bf70bc5a Reintroduce cpu_rng_early_sample(), but this time with embedded detection
for RDRAND/RDSEED, because TSC is not very strong.
2020-05-10 06:30:57 +00:00
maxv
7939ebec17 Respect the convention for the hypervisor information: return the highest
hypervisor leaf in 0x40000000.EAX.
2020-05-10 06:24:16 +00:00
riastradh
5b75316950 Make rndctl -E/-C reset entropy accounting.
If we don't trust a source, it's unreasonable to trust any entropy it
previously provided, and we don't have any way to undo only the
effects of that source, so just zero our estimate of the entropy in
the pool and start over.

(However, keep the samples already in the pool -- just treat them as
though they had zero entropy and start gathering more.)
2020-05-10 02:56:12 +00:00
riastradh
cdc9c12fff Rename things so the symbol better matches the sysctl name.
No functional change intended, except that the symbol that was
previously `uvm_swap_encryption' is now `uvm_swap_encrypt', backing
the sysctl knob `vm.swap_encrypt'.
2020-05-10 02:38:10 +00:00
riastradh
4fe11140e4 Mark experimental-default-off knobs clearly as such. 2020-05-10 02:32:32 +00:00
riastradh
f96b491d2f Document vm.swap_encrypt. 2020-05-10 02:31:29 +00:00
riastradh
3d1d29c849 Tweak kern.arandom documentation. 2020-05-10 02:30:33 +00:00
riastradh
2bd92f80a9 Fix comments. 2020-05-10 01:29:40 +00:00
riastradh
d5f6e51db3 Use a temporary pool to consolidate entropy atomically.
There was a low-probability race with the entropy consolidation
logic: calls to entropy_extract at the same time as consolidation is
happening might witness partial contributions from the CPUs when
needed=256, say 64 bits at a time.

To avoid this, feed everything from the per-CPU pools into a
temporary pool, and then feed the temporary pool into the global pool
under the lock at the same time as we update needed.
2020-05-10 00:08:12 +00:00
riastradh
2e4a8ba1a5 Avoid overflow if a very large number of pages are swapped at once.
Unlikely, but let's make sure we don't hit this ever.
2020-05-09 22:00:48 +00:00
riastradh
373ada04c3 Implement swap encryption.
Enabled by sysctl -w vm.swap_encrypt=1.  Key is generated lazily when
we first need to swap a page.  Key is chosen independently for each
swap device.  The ith swap page is encrypted with AES256-CBC using
AES256_k(le32enc(i) || 0^96) as the initialization vector.  Can be
changed at any time; no need for compatibility with on-disk formats.
Costs one bit of memory per page in each swapdev, plus a few hundred
bytes per swapdev to store the expanded AES key.

Shoulda done this decades ago!  Plan to enable this by default;
performance impact is unlikely to matter because it only happens when
you're already swapping anyway.  Much easier to set up than cgd, so
we can rip out all the documentation about carefully setting up
random-keyed cgd at the right time.
2020-05-09 21:50:39 +00:00
maxv
0b594a3992 Improve the CPUID emulation of basic leaves:
- Hide DCA and PQM, they cannot be used in guests.
 - On Intel, explicitly handle each basic leaf until 0x16.
 - On AMD, explicitly handle each basic leaf until 0x0D.
2020-05-09 16:18:57 +00:00
thorpej
790ddc0b33 Make the uvm_voaddr structure more compact, only occupying 2 pointers
worth of space, by encoding the type in the lower bits of the object
pointer.
2020-05-09 15:13:19 +00:00
nia
866a00cd61 Define OPENSSL_CPUID_OBJ in general CPPFLAGS instead of CRYPTOCPPFLAGS
This is used in various parts of the distribution, defining it here
avoids future problems with CPU-specific features not being detected.
2020-05-09 13:16:41 +00:00
nia
bd2e44e0b4 Ensure that -DOPENSSL_CPUID_OBJ is passed when compiling AES EVP bits
This way CPUs that support AES-NI actually get detected properly ;_;

(... just one part of the puzzle)
2020-05-09 12:20:50 +00:00
maxv
d6eec10312 A kernel without USER_LDT returns ENOSYS, not ENOTSUP. 2020-05-09 09:08:41 +00:00
maxv
7bac369b0f On Intel CPUs, CPUID leaf 0xB, too, provides topology information, so
filter it correctly, to avoid inconsistencies if the host has SMT.

This fixes HaikuOS which fetches SMT information from there and would
panic because of the inconsistencies.
2020-05-09 08:39:07 +00:00
skrll
fe2a0db7f4 No need to .import __cerror as SYS.h does it 2020-05-09 08:25:33 +00:00
bouyer
a7cb2d7d63 Also set x86_delay to xen_delay, unbreaks PVH 2020-05-09 08:01:38 +00:00
riastradh
998f36ada6 Prune dead branch. 2020-05-09 06:12:32 +00:00
ad
8122ec364a Run Solaris cyclics from statclock() so dtrace isn't locked out by IPL_SCHED
(assuming the machine has a separate statclock() which almost all don't).
2020-05-08 22:10:08 +00:00
ad
3187bd1ecb Fix the TSC timecounter (on the systems I have access to):
- Make the early i8254-based calculation of frequency a bit more accurate.

- Keep track of how far the HPET & TSC advance between HPET attach and
  secondary CPU boot, and use to compute an accurate value before attaching
  the timecounter.  Initial idea from joerg@.

- When determining skew and drift between CPUs, make each measurement 1000
  times and pick the lowest observed value.  Increase the error threshold to
  1000 clock cycles.

- Use the frequency computed on the boot CPU for secondary CPUs too.

- Remove cpu_counter_serializing().
2020-05-08 22:01:54 +00:00
ad
fb830ea6a0 cpu_counter: only need to clear %eax (zero extends). 2020-05-08 21:58:03 +00:00
ad
1e794454cb KNF 2020-05-08 21:43:54 +00:00
bouyer
47b51ceda1 strlcpy() the command line only if it's present. 2020-05-08 17:28:33 +00:00
jakllsch
2c4e3451c6 if_skreg.h: remove duplicate or triplicate identical #defines 2020-05-08 16:43:17 +00:00
riastradh
5729ed03ee Omit needless comment.
We've already committed part of the write, so ERESTART is definitely
not appropriate at this point.
2020-05-08 16:05:36 +00:00
riastradh
7460c1de67 Simplify loops by putting interrupt test at end. 2020-05-08 15:57:24 +00:00
riastradh
1b74d9d4a1 No need for a private pool cache. kmem serves just fine. 2020-05-08 15:55:05 +00:00
riastradh
9dc4826f31 Make variable unused outside kern_entropy.c static. 2020-05-08 15:54:11 +00:00
riastradh
06842eef47 Simplify /dev/random without reference to entropy_depletion. 2020-05-08 15:53:26 +00:00
jakllsch
7fa17fb73d Use sysctl_teardown() upon detach of mskc(4). 2020-05-08 14:56:49 +00:00
jmcneill
b75afbe843 Try to get the starting bus number from _CRS before falling back to _BBN.
There are apparently cases where the first bus in _CRS does not match the
value of _BBN, and the consensus is that _CRS should take precedence.
2020-05-08 14:44:23 +00:00
jmcneill
b878b4012e expose acpi_pcidev_pciroot_bus 2020-05-08 14:42:38 +00:00