Commit Graph

295045 Commits

Author SHA1 Message Date
riastradh b4749e24a2 entropy(9): Call entropy_softintr while bound to CPU.
It looks like We tripped on the new assertion in entropy_account_cpu
when there was pending entropy on cpu0 running lwp0 when xc_broadcast
ran -- since xc_broadcast calls the function directly rather than
calling it through softint_schedule, it's not called via the softint
lwp which would satisfy the assertion.
2022-03-24 12:58:56 +00:00
andvar e394a08199 s/interger/integer/ and s/Compensatin/Compensation/ in comments. 2022-03-24 12:12:00 +00:00
wiz 0362f707fc zlib: Fix a bug that can crash deflate on some input when using Z_FIXED.
5c44459c3b

This bug was reported by Danilo Ramos of Eideticom, Inc. It has
lain in wait 13 years before being found! The bug was introduced
in zlib 1.2.2.2, with the addition of the Z_FIXED option. That
option forces the use of fixed Huffman codes. For rare inputs with
a large number of distant matches, the pending buffer into which
the compressed data is written can overwrite the distance symbol
table which it overlays. That results in corrupted output due to
invalid distances, and can result in out-of-bound accesses,
crashing the application.

The fix here combines the distance buffer and literal/length
buffers into a single symbol buffer. Now three bytes of pending
buffer space are opened up for each literal or length/distance
pair consumed, instead of the previous two bytes. This assures
that the pending buffer cannot overwrite the symbol table, since
the maximum fixed code compressed length/distance is 31 bits, and
since there are four bytes of pending space for every three bytes
of symbol space.
2022-03-24 10:13:01 +00:00
yamaguchi fa8d826915 ixl(4): Added Intel V710 for 5000BaseT support 2022-03-24 08:54:16 +00:00
yamaguchi 34f970493a regen 2022-03-24 08:48:18 +00:00
yamaguchi b5afc66767 Added Intel V710 for 5000BaseT 2022-03-24 08:46:49 +00:00
yamaguchi 358c38bd6e Change description about Intel X710 10GBaseT device 2022-03-24 08:44:04 +00:00
andvar a960b269de s/interupt/interrupt/ in comments.
also add missing RCS ID in bcm53xx_reg.h and fix one more typo in there.
2022-03-24 08:08:04 +00:00
yamaguchi 52bf376d8b vioif(4): adopt ether_set_ifflags_cb 2022-03-24 08:02:21 +00:00
yamaguchi f490bf1198 vioif(4): register MAC address to a device 2022-03-24 07:57:10 +00:00
yamaguchi 1c9fb8cec4 vioif(4): fix missing error handling 2022-03-24 07:51:14 +00:00
yamaguchi 273426bfec vioif(4): do not schedule packet processing while stopping the device 2022-03-24 07:47:50 +00:00
manu b33073320a Add initial support for Intel GPIO chips 2022-03-24 02:24:24 +00:00
gutteridge 9d5e1357c3 popen.3: minor spelling, grammar, style, and xref tweaks 2022-03-24 01:55:15 +00:00
gutteridge b4afe916c2 fork.2: add _exit(2) xref and spell "ID" consistently 2022-03-24 01:52:48 +00:00
riastradh 7bd5abd309 mips/cavium: Fix membars around establishing interrupt handlers. 2022-03-23 23:24:21 +00:00
riastradh d3d9ac4a56 viornd(4): Process host entropy in softint context.
Samples added to the entropy pool in hard interrupt context are only
buffered, never processed directly, and if they fill the buffer, the
sample is dropped -- this serves to encourage taking timing samples
in hard interrupt context because it's cheap, and we have no idea how
many samples we really need for full entropy so it's safer to err on
the side of `as many as we can get'.

But for viornd(4), we assume the host has full entropy so we only
need a single 32-byte sample, and we want to avoid dropping it so we
get full entropy ASAP.  Entering the sample in a soft interrupt
rather than hard interrupt achieves this.
2022-03-23 23:23:25 +00:00
riastradh 2b8e15f8fa entropy(9): Include <sys/lwp.h> and <sys/proc.h> explicitly.
Now that we use curlwp, struct lwp::l_pflag, and LP_BOUND, let's not
rely on side-loads from other .h files.
2022-03-23 23:20:52 +00:00
riastradh 8f575ec770 entropy(9): Bind to CPU temporarily to avoid race with lwp migration.
More fallout from the IPL_VM->IPL_SOFTSERIAL change.

In entropy_enter, there is a window when the lwp can be migrated to
another CPU:

	ec = entropy_cpu_get();
	...
	pending = ec->ec_pending + ...;
	...
	entropy_cpu_put();

	/* lwp migration possible here */

	if (pending)
		entropy_account_cpu(ec);

If this happens, we may trip over any of several problems in
entropy_account_cpu because it assumes ec is the current CPU's state
in order to decide whether we have anything to contribute from the
local pool to the global pool.

No need to do this in entropy_softintr because softints are bound to
the CPU anyway.
2022-03-23 23:18:17 +00:00
macallan c2e6ca5ced allow com at dino to actually attach 2022-03-23 17:35:41 +00:00
christos 728043b76b revert changes from 2022a for now until I figure out what's wrong. 2022-03-23 14:02:05 +00:00
andvar a41f6947a1 fix few typos for word "previous(ly)" in comments. 2022-03-23 13:06:06 +00:00
andvar adbc140349 fix few typos in comments, mainly s/paramenters/parameters/. 2022-03-23 11:08:27 +00:00
rillig fa858d4c6e make: clean up comments and code for setting debug flags
No binary change.
2022-03-22 23:37:09 +00:00
andvar 43aafb237c fix typos in comments. 2022-03-22 21:45:13 +00:00
macallan 959db5f04d bump MSGBUFSIZE 2022-03-22 18:32:51 +00:00
christos e19b521a1d new tzcode 2022-03-22 17:49:30 +00:00
christos e1e5793746 welcome to tzcode-2022a
Changes to code

    Fix bug when mktime gets confused by truncated TZif files with
    unspecified local time.  (Problem reported by Almaz Mingaleev.)

    Fix bug when 32-bit time_t code reads malformed 64-bit TZif data.
    (Problem reported by Christos Zoulas.)

    When reading a version 2 or later TZif file, the TZif reader now
    validates the version 1 header and data block only enough to skip
    over them, as recommended by RFC 8536 section 4.  Also, the TZif
    reader no longer mistakenly attempts to parse a version 1 TZIf
    file header as a TZ string.

    zdump -v now outputs "(localtime failed)" and "(gmtime failed)"
    when local time and UT cannot be determined for a timestamp.
2022-03-22 17:48:39 +00:00
riastradh 352837cfca autoconf(9): Enter more timing samples into entropy pool.
Previously, we sampled the time of each _failed_ config_search.  I'm
not sure why -- there was no explanation in the comment or the commit
message introducing this in rev. 1.230.2.1 on tls-earlyentropy.

With this change, we sample the time of _every_ search including the
successful ones -- and also measure the time to attach which often
includes things like probing device registers, triggering device
reset and waiting for it to post, &c.
2022-03-21 22:20:32 +00:00
jmcneill edd5c599d8 hdaudio: Obsolete HDAUDIO_ENABLE_DISPLAYPORT and HDAUDIO_ENABLE_HDMI
Enable display port and HDMI devices by default rather than making this
a compile time option.
2022-03-21 09:20:04 +00:00
jmcneill 3e8c9d8ae9 hdaudio: pci: PCIe config space fixes and Intel PCH snoop support
The HD audio specification does not cover PCI config space, and this
driver was unconditionally writing to a vendor specific register. Reduce
scope of config space accesses based on PCI IDs.

With this cleaned up, add support for Intel PCH devices which require
some additional vendor specific configuration to bypass no snoop mode.
2022-03-21 09:12:09 +00:00
riastradh eae1841cdb entropy(9): Make rnd_lock_sources work while cold.
x86 uses entropy_extract verrrrrry early.  Fixes mistake in previous
that did not manifest in my testing on aarch64, which does not use it
so early.
2022-03-21 00:25:04 +00:00
andvar fd282dc1a1 s/Multilik/Multilink/ 2022-03-20 20:37:59 +00:00
andvar ff48331b5e s/circut/circuit/ and s/circiut/circuit/ in comments and acronyms file. 2022-03-20 20:19:34 +00:00
andvar 51cdba346e s/initialiase/initialise/ in comments. 2022-03-20 19:26:27 +00:00
andvar 01fcbd4710 fix typos in debug/panic messages: isued->issued, initialiased->initialised. 2022-03-20 18:56:29 +00:00
kre 896f0a3aa5 Updated to tzdata2022agtz which is a 2022a fork with backzone zones
moved back into the main data repo (restoring old data)
2022-03-20 18:22:20 +00:00
kre bf2397dc69 Merge tzdata2022agtz 2022-03-20 18:20:19 +00:00
riastradh dd68197b35 entropy(9): Improve entropy warning messages and documentation.
- For the main warning message, use less jargon, say `security', and
  cite the entropy(7) man page for further reading.  Document this in
  rnd(4) and entropy(7).

- For the debug-only warning message, say `entropy' only once and omit
  it from the rnd(4) man page -- it's not very important unless you're
  debugging the kernel in which case you probably know what you're
  doing enough to not need the text explained in the man page.
2022-03-20 18:19:57 +00:00
kre e4971af455 Note tzdata 2022a (using tzdata2022agtz upstream fork) 2022-03-20 18:04:52 +00:00
kre bd24288b0f Import tzdata2022agtz
not from ftp://ftp.iana.org/tz/releases/tzdata2022agtz.tar.gz
   (2022a comes from ftp://ftp.iana.org/tz/releases/tzdata2022a.tar.gz)

Note that 2022agtz is mechanically derived from 2022a by moving back
zone data from the "backzone" file that had been removed as "redundant"
(because differences to some other zone are all prior to 1970) so that
this pre 1970 data is restored.   It isn't necessarily correct in all
cases, but it is usually better than using some other zone's data which
is just as likely to be incorrect for where it applies, and more so elsewhere.

Summary of changes in tzdata2022a (2022-03-15 23:02:01 -0700):
  * Palestine will spring forward on 2022-03-27, not 2022-03-26.
  * From 1992 through spring 1996, Ukraine's DST transitions were at
    02:00 standard time, not at 01:00 UTC.
  * Chile's Santiago Mean Time and its LMT precursor have been adjusted
    eastward by 1 second to align with past and present law.
  * Changes to commentary.
2022-03-20 17:59:48 +00:00
riastradh 89444d3fe8 entropy(9): Fix premature optimization deadlock in entropy_request.
- For synchronous queries from /dev/random, which are waiting for
  entropy to be ready, wait for concurrent access -- e.g., concurrent
  rnd_detach_source -- to finish, and make sure to request entropy
  from all sources (unless we're interrupted by a signal).

- When invoked through softint context (e.g., cprng_fast_intr ->
  cprng_strong -> entropy_extract), don't wait, because we're
  forbidden from waiting anyway.

- For entropy_bootrequest, wait but don't bother failing on signal
  because this only happens in kthread context, not in userland
  process context, so there can't be signals.

Nix rnd_trylock_sources; use the same entropy_extract flags
(ENTROPY_WAIT, ENTROPY_SIG) for rnd_lock_sources.
2022-03-20 14:30:56 +00:00
riastradh 8ef4287173 Revert "entropy(9): Nix rnd_trylock_sources."
Not a premature optimization after all -- this is necessary because
entropy_request can run in softint context, where the cv_wait_sig in
rnd_lock_sources is forbidden.  Need to do this another way.
2022-03-20 14:05:41 +00:00
riastradh e98aa0c66a entropy(9): Nix rnd_trylock_sources.
This was a premature optimization that turned out to be bogus.  It's
not harmful to request more than we need from drivers, so let's not
go out of our way to avoid that.
2022-03-20 13:44:18 +00:00
riastradh 718cd90794 ualea(4): Enter the data under the softc lock.
This avoids a race with a concurrent ualea_get updating sc_needed,
which could lead to hang when requesting more entropy.

ualea(4) now survives

sysctl -w kern.entropy.depletion=1
cat </dev/random >/dev/null &
cat </dev/random >/dev/null &

without hanging for longer (even if yanked and reinserted in the
middle, although the detach path is not relevant to the bug this
change fixes).
2022-03-20 13:18:30 +00:00
riastradh f7b53447aa entropy(9): Fix another new race in entropy_account_cpu.
The consolidation xcall can preempt entropy_enter, between when it
unlocks the per-CPU state and when it calls entropy_account_cpu, with
the effect of setting ec->ec_pending=0.

Previously this was impossible because we called entropy_account_cpu
with the per-CPU state still locked, but that doesn't work now that
the global entropy lock is an adaptive lock which might sleep which
is forbidden while the per-CPU state is locked.
2022-03-20 13:18:11 +00:00
riastradh 5798170187 entropy(9): Shuffle some assertions around.
Tripped over (diff || E->pending == ENTROPY_CAPACITY*NBBY), not sure
why yet, printing values will help.

No functional change intended.
2022-03-20 13:17:44 +00:00
riastradh 260710e2b4 entropy(9): Lock the per-CPU state in entropy_account_cpu.
This was previously called with the per-CPU state locked, which
worked fine as long as the global entropy lock was a spin lock so
acquiring it would never sleep.  Now it's an adaptive lock, so it's
not safe to take with the per-CPU state lock -- but we still need to
prevent reentrant access to the per-CPU entropy pool by interrupt
handlers while we're extracting from it.  So now the logic for
entering a sample is:

- lock per-CPU state
- entpool_enter
- unlock per-CPU state
- if anything pending on this CPU and it's time to consolidate:
  - lock global entropy state
  - lock per-CPU state
  - transfer
  - unlock per-CPU state
  - unlock global entropy state
2022-03-20 13:17:32 +00:00
riastradh 450311ec18 entropy(9): Factor out logic to lock and unlock per-CPU state.
No functional change intended.
2022-03-20 13:17:09 +00:00
riastradh 961b7b01fb ualea(4): Simplify xfer error branches.
- Avoid going into a loop in case the transfer fails repeatedly --
  just give up immediately if it fails.

- Assert result size is reasonable; no need to assume usbdi(9) is
  malicious.  If it can return ux_actlen > ux_length, that's a bug in
  usbdi(9) that we should fix.
2022-03-20 13:13:10 +00:00