openbsd
22 months agoAdd a small blurb on @SECLEVEL=n
tb [Sun, 11 Dec 2022 20:53:27 +0000 (20:53 +0000)]
Add a small blurb on @SECLEVEL=n

22 months agoBalance a getifaddrs() with a freeifaddrs(); plugs a leak seen by
otto [Sun, 11 Dec 2022 10:47:37 +0000 (10:47 +0000)]
Balance a getifaddrs() with a freeifaddrs(); plugs a leak seen by
florian@ and myself.  ok florian@

22 months agoUse evcount_percpu() with platform interrupt counters on octeon.
visa [Sun, 11 Dec 2022 05:31:05 +0000 (05:31 +0000)]
Use evcount_percpu() with platform interrupt counters on octeon.

22 months agoCut two cycles from k_tlb_inv() on octeon.
visa [Sun, 11 Dec 2022 05:07:25 +0000 (05:07 +0000)]
Cut two cycles from k_tlb_inv() on octeon.

"If it works, go for it!" miod@

22 months agoRemove unused experimental ICMP6 redirect low water bits
kn [Sat, 10 Dec 2022 23:45:51 +0000 (23:45 +0000)]
Remove unused experimental ICMP6 redirect low water bits

Dead since introduction in 2001 with icmp6.c r1.31:
    implement upper limit to icmp6 redirects (experimental, turned off)
    negative value to {mtudisc,redirect}_{hi,lo}wat will turn off the limitation.
    sync with kame.

icmp6_redirect_lowat was always -1 and never hit the empty conditional.

icmp6_redirect_hiwat never existed.

icmp6_mtudisc_{hi,lo}wat are exposed as net.inet6.icmp6.mtudisc_{hi,lo}wat
sysctl(2)s, so don't touch those for now.

OK mvs

22 months agoReuse off variable from previous line; no object change
kn [Sat, 10 Dec 2022 22:40:58 +0000 (22:40 +0000)]
Reuse off variable from previous line;  no object change

22 months agozap 68 trailing spaces from a single line
kn [Sat, 10 Dec 2022 22:16:24 +0000 (22:16 +0000)]
zap 68 trailing spaces from a single line

22 months ago`dp' was just allocated with M_ZERO flag, so the following bzero(3) is not
mvs [Sat, 10 Dec 2022 21:29:10 +0000 (21:29 +0000)]
`dp' was just allocated with M_ZERO flag, so the following bzero(3) is not
required.

ok kn@

22 months agoMerge nd6_option_init() into nd6_options()
kn [Sat, 10 Dec 2022 21:26:21 +0000 (21:26 +0000)]
Merge nd6_option_init() into nd6_options()

All call-sites call nd6_options() directly after nd6_option_init().
Fold them to simplify the logic and do less pointing around.

Feedback OK bluhm florian

22 months agoIncrease transfer completion timeout to 100ms. This is what Linux has
kettenis [Sat, 10 Dec 2022 18:43:48 +0000 (18:43 +0000)]
Increase transfer completion timeout to 100ms.  This is what Linux has
and we need a longer timeout for the USB Type-C PD chips.

ok tobhe@

22 months agoex_range: fix handling of escaped backslashes.
millert [Sat, 10 Dec 2022 16:06:18 +0000 (16:06 +0000)]
ex_range: fix handling of escaped backslashes.
If there are two consecutive backslashes, skip past both so the
second is not mistakenly treated as an escape character.
This is consistent with how escaped backslashes are treated
in ex_substitute() and global().  From Bosco G. G.

22 months agoalpha: switch to clockintr
cheloha [Sat, 10 Dec 2022 15:02:29 +0000 (15:02 +0000)]
alpha: switch to clockintr

- Add missing tick_nsec initialization to cpu_initclocks().
- Set stathz = hz, profhz = stathz; we don't have any control over the
  interrupt clock on alpha so everything has the same frequency.
- Set schedhz = 16 to imitate current schedclock() dispatch frequency.

Bringup help from claudio@.  Tested by miod@ (2-CPU DS25).

Link: https://marc.info/?l=openbsd-tech&m=166776333303245&w=2
ok mlarkin@

22 months agoMake the accepted log grep pattern more strict in order to not pick up any log
anton [Sat, 10 Dec 2022 12:17:46 +0000 (12:17 +0000)]
Make the accepted log grep pattern more strict in order to not pick up any log
entries from sshd causing intermittent failures.

Discussed with bluhm@ back in August this year.

22 months agobio chain test: compress some error printing
tb [Sat, 10 Dec 2022 10:56:16 +0000 (10:56 +0000)]
bio chain test: compress some error printing

22 months agobio chain test: deduplicate chain walking code
tb [Sat, 10 Dec 2022 10:45:39 +0000 (10:45 +0000)]
bio chain test: deduplicate chain walking code

22 months agobio chain test: handle walking of empty chains
tb [Sat, 10 Dec 2022 10:42:13 +0000 (10:42 +0000)]
bio chain test: handle walking of empty chains

Rework the loops walking the chains to be correct for empty chains as well.
This simplifies the checking at the cost of slightly more initialization
and will allow further refactoring in a subsequent check.

22 months agoMitigate Spectre-BHB by using core-specific trampoline vectors. On some cores
patrick [Sat, 10 Dec 2022 10:13:58 +0000 (10:13 +0000)]
Mitigate Spectre-BHB by using core-specific trampoline vectors.  On some cores
Spectre-BHB can be mitigated by using a loop that branches a number of times.
For cores where this does not suffice, or where Spectre-V2 needs to be handled
as well, try and call into a new PSCI function that mitigates both Spectre-V2
and Spectre-BHB.  Some newer machines, which might not be in anyone's hands
yet, have an instruction (CLRBHB) that clears the BHB.  If ECBHB is set, the
BHB isn't vulnerable.  If we have CSV2_3/HCXT, it's not vulnerable at all.

No visible performance dropoff on a MacchiatoBin (4xA72) or Lenovo x13s (4xA78C+
4xX1C), but around 2-3% on a LX2K (16xA72) and RK3399 (4xA53+2xA72).

ok kettenis@

22 months agoFix comments, no binary change.
aoyama [Sat, 10 Dec 2022 02:41:56 +0000 (02:41 +0000)]
Fix comments, no binary change.

22 months agoSimplify early kernel bootstrap a bit more. Just map the entire 64MB memory
kettenis [Fri, 9 Dec 2022 22:31:31 +0000 (22:31 +0000)]
Simplify early kernel bootstrap a bit more.  Just map the entire 64MB memory
block that the bootloader allocates for us (minus the first 2MB).  This means
we can get rid of a bunch of code in pmap_bootstrap().  It also makes sure
that we don't accidentally enter mappings that cover secure memory just
beyond where the kernel was loaded.

ok patrick@

22 months agoAdd detection for Spectre-BHB related CLRBHB, ECBHB and CSV2_3/HCXT
patrick [Fri, 9 Dec 2022 21:23:24 +0000 (21:23 +0000)]
Add detection for Spectre-BHB related CLRBHB, ECBHB and CSV2_3/HCXT
feature bits.

ok kettenis@

22 months agofix double word and Ar -> Dv;
jmc [Fri, 9 Dec 2022 21:19:53 +0000 (21:19 +0000)]
fix double word and Ar -> Dv;

22 months agoFix typo: SCTX -> SCXT
patrick [Fri, 9 Dec 2022 20:37:39 +0000 (20:37 +0000)]
Fix typo: SCTX -> SCXT

ok kettenis@

22 months agoresolvd: fix leaks of line and fp
tb [Fri, 9 Dec 2022 18:22:35 +0000 (18:22 +0000)]
resolvd: fix leaks of line and fp

In case asprintf() fails or the iov overflows, the file and the line read
would be leaked.

also noted by otto
ok deraadt millert

22 months agoiovcnt can be zero, writev does not like that and O_CREATE is
otto [Fri, 9 Dec 2022 18:11:24 +0000 (18:11 +0000)]
iovcnt can be zero, writev does not like that and O_CREATE is
not needed, we just renamed sucessfully to that file.
ok deraadt@ florian@

22 months agoSwitch nd_opts from a union to just a struct.
claudio [Fri, 9 Dec 2022 17:32:53 +0000 (17:32 +0000)]
Switch nd_opts from a union to just a struct.
The ND6 option handling in the kernel got a lot simpler since only
the tgt and src lladdr option are inspected by the kernel. The magic
of assigning options via one side of the union and accessing them
via the other is total overkill and actually quite error prone.
OK florian@

22 months agobio chain test: add a consistency check for chain lengths
tb [Fri, 9 Dec 2022 17:23:05 +0000 (17:23 +0000)]
bio chain test: add a consistency check for chain lengths

22 months agodocument changes to uvm_map_protect() for setting the UVM_ET_STACK in
deraadt [Fri, 9 Dec 2022 17:16:36 +0000 (17:16 +0000)]
document changes to uvm_map_protect() for setting the UVM_ET_STACK in
some cases (setrlimit, atomically, only kernel reachable, ...)

22 months agobn/Makefile: tidy up and simplify
tb [Fri, 9 Dec 2022 09:56:41 +0000 (09:56 +0000)]
bn/Makefile: tidy up and simplify

22 months agoAllow overriding default run-regress-* targets
tb [Fri, 9 Dec 2022 09:30:54 +0000 (09:30 +0000)]
Allow overriding default run-regress-* targets

Overriding a default run-regress-* target with custom commands is already
possible and done by many tests. The fact that it currently works depends
on behavior in the BUGs section of make.1, however. The fix is not to add
commands if the target is already defined with commands.

tested by anton
correct fix from espie, ok anton

22 months agobio chain test: make two errors noisy
tb [Fri, 9 Dec 2022 07:53:06 +0000 (07:53 +0000)]
bio chain test: make two errors noisy

22 months agobio chain test: ensure the length of empty chains is 0
tb [Fri, 9 Dec 2022 07:47:59 +0000 (07:47 +0000)]
bio chain test: ensure the length of empty chains is 0

22 months agobio chain test: various minor readability tweaks
tb [Fri, 9 Dec 2022 07:46:54 +0000 (07:46 +0000)]
bio chain test: various minor readability tweaks

Align initialization in walk_backward() with walk_forward(), fix grammar
in a comment and move initialization of oldhead_len in a place consistent
with the other length initializations in that function

22 months agoSome TCP timer units have changed from slowhz to msec and their
bluhm [Fri, 9 Dec 2022 00:24:44 +0000 (00:24 +0000)]
Some TCP timer units have changed from slowhz to msec and their
type from short to int.  Also switch local variables holding temporary
timer values from short to int.
OK yasuoka

22 months agoWarn if no host keys for hostbased auth can be loaded. From bz#3507, ok djm@
dtucker [Fri, 9 Dec 2022 00:22:29 +0000 (00:22 +0000)]
Warn if no host keys for hostbased auth can be loaded.  From bz#3507, ok djm@

22 months agoAdd some server debugging for hostbased auth.
dtucker [Fri, 9 Dec 2022 00:17:40 +0000 (00:17 +0000)]
Add some server debugging for hostbased auth.

auth_debug_add queues messages about the auth process which is sent to
the client after successful authentication.  This also sends those to
the server debug log to aid in debugging.  From bz#3507, ok djm@

22 months agoCall vget(9) in uvn_put() to make sure we hold a reference if we're called
kettenis [Thu, 8 Dec 2022 21:32:48 +0000 (21:32 +0000)]
Call vget(9) in uvn_put() to make sure we hold a reference if we're called
by the pagedaemon for a persisting vnode.  This prevents a panic in
uvm_vnp_unache() since a persisting vnode has a reference count of zero.
This should also prevent the vnode from being recycled from under our
feet while we're doing I/O to it.

This fixes the "macppc panic: vref used where vget required" issue.

tested by bluhm@, tb@
ok mpi@

22 months agobio chain test: fix inconsequential off-by-one
tb [Thu, 8 Dec 2022 18:34:00 +0000 (18:34 +0000)]
bio chain test: fix inconsequential off-by-one

22 months agobio chain test: minor readability tweaks
tb [Thu, 8 Dec 2022 18:33:20 +0000 (18:33 +0000)]
bio chain test: minor readability tweaks

22 months agobio chain test: rename a few variables for consistency
tb [Thu, 8 Dec 2022 18:16:28 +0000 (18:16 +0000)]
bio chain test: rename a few variables for consistency

22 months agobio chain test: decouple lengths of test chains
tb [Thu, 8 Dec 2022 18:15:36 +0000 (18:15 +0000)]
bio chain test: decouple lengths of test chains

Add helpers to create and destroy a linear chain of BIOs. Provide two
defines for the two lengths of the test chains and make them distinct
to rule out coincidences. As a bonus, the code becomes simpler.

22 months agobio chain test: refactor link_chains_at()
tb [Thu, 8 Dec 2022 18:12:39 +0000 (18:12 +0000)]
bio chain test: refactor link_chains_at()

Add helper that validate the chains. This deduplicates a lot of code and
makes the heart of the test much easier to read.

22 months agobio chain test: lose some do_{,bio_} prefixes
tb [Thu, 8 Dec 2022 18:10:52 +0000 (18:10 +0000)]
bio chain test: lose some do_{,bio_} prefixes

22 months agoSplit biotest into its three logical parts
tb [Thu, 8 Dec 2022 17:49:02 +0000 (17:49 +0000)]
Split biotest into its three logical parts

Some parts of this test rely on unportable behavior, so cannot run in
portable. This way we can run more tests for portable which is helpful
for analysis tools, better coverage, etc.

22 months agobgpctl(8): ometric: measure elapsed time with monotonic clock
cheloha [Thu, 8 Dec 2022 17:24:39 +0000 (17:24 +0000)]
bgpctl(8): ometric: measure elapsed time with monotonic clock

Prefer CLOCK_MONOTONIC to gettimeofday(2) when measuring elapsed time,
as the UTC clock can jump around.

ok claudio@

22 months agoChange ld.bfd to default to --enable-new-dtags so that it generates
guenther [Thu, 8 Dec 2022 17:15:52 +0000 (17:15 +0000)]
Change ld.bfd to default to --enable-new-dtags so that it generates
DT_RUNPATH tags by default, so that it is consistent with ld.lld.

ok millert@ miod@ kettenis@ kmos@

22 months agoFix DT_MIPS_RLD_MAP_REL
visa [Thu, 8 Dec 2022 13:41:06 +0000 (13:41 +0000)]
Fix DT_MIPS_RLD_MAP_REL

Use proper tag-relative values for DT_MIPS_RLD_MAP_REL tags.

This causes an ABI break on mips64. Your system must have latest ld.so
before applying this commit.

OK deraadt@ kettenis@

22 months agobiotest: Tweak long comment a bit
tb [Thu, 8 Dec 2022 12:27:03 +0000 (12:27 +0000)]
biotest: Tweak long comment a bit

22 months agoPrint skipped on non applicable architectures.
anton [Thu, 8 Dec 2022 12:14:11 +0000 (12:14 +0000)]
Print skipped on non applicable architectures.

22 months agoStop overriding the regress target and use REGRESS_TARGETS instead.
anton [Thu, 8 Dec 2022 12:01:04 +0000 (12:01 +0000)]
Stop overriding the regress target and use REGRESS_TARGETS instead.

22 months agoFix copy-paste error that left a paragraph ending in a comma
tb [Thu, 8 Dec 2022 11:33:58 +0000 (11:33 +0000)]
Fix copy-paste error that left a paragraph ending in a comma

22 months agoAdd BIO_push() and BIO_set_next() regress coverage
tb [Thu, 8 Dec 2022 11:32:27 +0000 (11:32 +0000)]
Add BIO_push() and BIO_set_next() regress coverage

This tests for the behavior changes in bio_lib.c r1.40 and r1.41 and
makes sure that BIO_push() and BIO_set_next() act on two chains in the
expected and now documented way.

22 months agobn_mod_exp test: drop extra parentheses for readability
tb [Thu, 8 Dec 2022 07:18:47 +0000 (07:18 +0000)]
bn_mod_exp test: drop extra parentheses for readability

22 months agoConvert tcptv_keep_init in milliseconds before comparing other values
yasuoka [Thu, 8 Dec 2022 05:59:39 +0000 (05:59 +0000)]
Convert tcptv_keep_init in milliseconds before comparing other values
of tcp time.  This fixes the retransmit timer of syn_cache which was
broken.  reported by naddy, input dlg, test jca

ok jca

22 months agoFix pvbus to specify M_ZERO properly.
yasuoka [Thu, 8 Dec 2022 05:45:36 +0000 (05:45 +0000)]
Fix pvbus to specify M_ZERO properly.

ok kn mvs mlarkin asou deraadt

22 months ago_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
guenther [Thu, 8 Dec 2022 02:11:27 +0000 (02:11 +0000)]
_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
is ELF" world.  Eliminate use of them in landisk code.

ok deraadt@

22 months ago_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
guenther [Thu, 8 Dec 2022 01:25:43 +0000 (01:25 +0000)]
_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
is ELF" world.  Eliminate use of them in amd64, arm64, armv7, i386,
macppc, mips64, and sparc64 code.

ok deraadt@ jca@ krw@

22 months agoForcibly set console output to the framebuffer on the Lenovo x13s.
patrick [Thu, 8 Dec 2022 00:29:06 +0000 (00:29 +0000)]
Forcibly set console output to the framebuffer on the Lenovo x13s.
We should actually do something like checking that both stdout-path
and serial0 don't exist to realize we have to switch, but this hack
gets us going for now.

ok kettenis@

23 months ago_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
guenther [Wed, 7 Dec 2022 23:25:59 +0000 (23:25 +0000)]
_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
is ELF" world.  Eliminate use of them in powerpc64 code.

ok gkoehler@

23 months agoImprove the implementation of BIO_push(3) such that it changes nothing
schwarze [Wed, 7 Dec 2022 23:08:47 +0000 (23:08 +0000)]
Improve the implementation of BIO_push(3) such that it changes nothing
and reports failure if a call would result in a cycle.
The algorithm used was originally suggested by jsing@.
Feedback and OK tb@.

23 months agoThe ACPI tables on the Lenovo x13s are incomplete and unusable. For
patrick [Wed, 7 Dec 2022 23:04:26 +0000 (23:04 +0000)]
The ACPI tables on the Lenovo x13s are incomplete and unusable.  For
that reason, identify that we're running on that machine by looking at
the SMBIOS tables and load alternate device tree binaries from disk.

ok kettenis@

23 months agoAdd references to the BIO_{push,pop}(3) example
tb [Wed, 7 Dec 2022 22:30:15 +0000 (22:30 +0000)]
Add references to the BIO_{push,pop}(3) example

The reader may not know what digest BIOs, Base64 BIOs and file BIOs are
and the relevant function names are non-obvious, hence it's not entirely
trivial to find the manuals where they are explained. With these references
a reader should be able to turn the example into actual code.

ok schwarze

23 months agoDocument 'uidinfo' structure locks.
mvs [Wed, 7 Dec 2022 20:08:28 +0000 (20:08 +0000)]
Document 'uidinfo' structure locks.

Inputs and ok bluhm@

23 months agoAdd END()s to match ENTRY()s.
guenther [Wed, 7 Dec 2022 19:26:39 +0000 (19:26 +0000)]
Add END()s to match ENTRY()s.
ok deraadt@

23 months agoPrefer numeric labels over L<digit> labels, as the latter clutter
guenther [Wed, 7 Dec 2022 19:26:02 +0000 (19:26 +0000)]
Prefer numeric labels over L<digit> labels, as the latter clutter
the final kernel symbol table.
Add END()s to match ENTRY()s.

ok deraadt@

23 months agoPrefer STRONG_ALIAS() over multiple overlapping _ENTRY/_NENTRY
guenther [Wed, 7 Dec 2022 19:21:54 +0000 (19:21 +0000)]
Prefer STRONG_ALIAS() over multiple overlapping _ENTRY/_NENTRY
uses, as the latter requires manual handling of _PROF_PROLOGUE.
Add END()s to match ENTRY()s.

ok deraadt@

23 months agoApply changes from commitid FWrfGfO9Ojnsh1mq to libkern.
guenther [Wed, 7 Dec 2022 18:25:32 +0000 (18:25 +0000)]
Apply changes from commitid FWrfGfO9Ojnsh1mq to libkern.
From original commit message: To mitigate against spectre attacks,
AMD processors without the IBRS feature need an lfence instruction
after every near ret.  See software techniques for managing speculation
on AMD processors revision 9.17.20 mitigation G-5.

ok deraadt@

23 months agoDo not store unused ICMPv6 Option PREFIX_INFORMATION
kn [Wed, 7 Dec 2022 17:34:20 +0000 (17:34 +0000)]
Do not store unused ICMPv6 Option PREFIX_INFORMATION

Dead since 2017 sys/netinet6/nd6_rtr.c r1.163
    Remove sending of router solicitations and processing of router
    advertisements from the kernel. It's handled by slaacd(8) these days.

sysctl(2) net.inet6.icmp6.nd6_debug does not warn about it like it does
for, e.g., duplicate MTU options, so don't do anything with this option.

Remove access macros for other unused options while here.
Eventually, union nd_opts should be removed completely.
All under _KERNEL.

tcpdump(8)/rad(8)/slaacd(8) keep showing/sending/receiving this option when
running this diff on both router and client.

OK claudio

23 months agoFix example string
tb [Wed, 7 Dec 2022 17:17:29 +0000 (17:17 +0000)]
Fix example string

If you want to Base64-encode "Hello World\n" using a BIO, you had better
pass "Hello World\n" into it, not something slightly different... While
we're touching this, we might as well write it the way K&R did...

23 months agoFix comment by splitting sentance in two. From kn@
claudio [Wed, 7 Dec 2022 14:38:29 +0000 (14:38 +0000)]
Fix comment by splitting sentance in two. From kn@

23 months agoFix comment typo.
dtucker [Wed, 7 Dec 2022 11:45:43 +0000 (11:45 +0000)]
Fix comment typo.

23 months agoProcess escape sequences in show-buffer, GitHub issue 3401.
nicm [Wed, 7 Dec 2022 09:44:44 +0000 (09:44 +0000)]
Process escape sequences in show-buffer, GitHub issue 3401.

23 months agoIf the called of ypconnect(2) is root, the socket should acquire a
deraadt [Wed, 7 Dec 2022 01:02:28 +0000 (01:02 +0000)]
If the called of ypconnect(2) is root, the socket should acquire a
reserved port to received secure-maps from the ypserver.
issue found by niklas, using a simpler diff i proposed
ok miod

23 months agoAdd support for additional RTKit endpoint advertised by NVMe firmware that
kettenis [Tue, 6 Dec 2022 23:18:54 +0000 (23:18 +0000)]
Add support for additional RTKit endpoint advertised by NVMe firmware that
comes with newer macOS releases.

ok patrick@

23 months agoZap extra space
tb [Tue, 6 Dec 2022 22:22:42 +0000 (22:22 +0000)]
Zap extra space

23 months agoAdd missing kernel lock around (*if_ioctl)() call within
mvs [Tue, 6 Dec 2022 22:19:39 +0000 (22:19 +0000)]
Add missing kernel lock around (*if_ioctl)() call within
in{,6}_addmulti(). Since kernel lock is no more taken while following
setsockopt() path, it should be taken in this place. Corresponding
in{,6}_delmulti() already acquire kernel lock around (*if_ioctl)().

Problem reported and diff tested by weerd@

ok kn@ bluhm@

23 months agoMajor rewrite for accuracy and clarity, and document BIO_set_next(3).
schwarze [Tue, 6 Dec 2022 21:13:01 +0000 (21:13 +0000)]
Major rewrite for accuracy and clarity, and document BIO_set_next(3).
Feedback and OK tb@.

23 months ago_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
guenther [Tue, 6 Dec 2022 18:50:59 +0000 (18:50 +0000)]
_C_LABEL() and _ASM_LABEL() are no longer useful in the "everything
is ELF" world.  Eliminate use of them in m88k code.

ok aoyama@

23 months agoAdd a few missing headers and drop a few unused ones
tb [Tue, 6 Dec 2022 18:23:29 +0000 (18:23 +0000)]
Add a few missing headers and drop a few unused ones

In bn_test.c include bn_local.h instead of using copy-pasted prototypes.

23 months agoMake sure BIO_push(3) always preserves all invariants of the prev_bio
schwarze [Tue, 6 Dec 2022 17:59:21 +0000 (17:59 +0000)]
Make sure BIO_push(3) always preserves all invariants of the prev_bio
and next_bio fields of all BIO objects in all affected chains, no
matter what the arguments are.
In particular, if the second argument (the one to be appended) is
not at the beginning of its chain, properly detach the beginning
of its chain before appending.

We have weak indications that this bug might affect real-world code.
For example, in FreeRDP, file libfreerdp/crypto/tls.c, function
bio_rdp_tls_ctrl(), case BIO_C_SET_SSL, BIO_push(3) is definitely
called with a second argument that is *not* at the beginning of its
chain.  Admittedly, that code is hard to fathom, but it does appear
to result in a bogus prev_bio pointer without this patch.
The practical impact of this bug in this and other software remains
unknown; the consequences might possibly escalate up to use-after-free
issues if BIO_pop(3) is afterwards called on corrupted BIO objects.

OK tb@

23 months agoOpenMetrics is rather strict about naming metricsets.
claudio [Tue, 6 Dec 2022 17:38:41 +0000 (17:38 +0000)]
OpenMetrics is rather strict about naming metricsets.
Add a function that a) verifies that none of the special suffixes is used
and b) that the name itself is not yet used already.
Also when printing a counter _total has to be added to the metric name and
for info metrics _info is added.
With and OK tb@

23 months agoInstall arm64-qcom-dtb upon encountering a qcgpio(4) device.
patrick [Tue, 6 Dec 2022 17:33:27 +0000 (17:33 +0000)]
Install arm64-qcom-dtb upon encountering a qcgpio(4) device.

ok phessler@ sthen@ tobhe@

23 months agolist hatch-vcs for MODPY_PYBUILD
sthen [Tue, 6 Dec 2022 16:18:51 +0000 (16:18 +0000)]
list hatch-vcs for MODPY_PYBUILD

23 months agoImprove the poorly designed BIO_set_next(3) API to always preserve all
schwarze [Tue, 6 Dec 2022 16:10:55 +0000 (16:10 +0000)]
Improve the poorly designed BIO_set_next(3) API to always preserve all
invariants of the prev_bio and next_bio fields of all BIO objects
in all involved chains, no matter which arguments this function is
called with.

Both real-world uses of this function (in libssl and freerdp) have
been audited to make sure this makes nothing worse.  We believe libssl
behaves correctly before and after the patch (mostly because the second
argument is NULL there), and we believe the code in freerdp behaves
incorrectly before and after the patch, leaving a prev_bio pointer in
place that is becoming bogus, only in a different object before and
after the patch.  But after the patch, that bogus pointer is due to a
separate bug in BIO_push(3), which we are planning to fix afterwards.

Joint work with and OK tb@.

23 months agoImplement support for shared interrupts.
kettenis [Tue, 6 Dec 2022 16:07:14 +0000 (16:07 +0000)]
Implement support for shared interrupts.

ok patrick@

23 months agoFor write operations, wait until the transaction completes just like we
kettenis [Tue, 6 Dec 2022 16:06:32 +0000 (16:06 +0000)]
For write operations, wait until the transaction completes just like we
do after sending the command for a read operation.  Fixes issues with doing
multiple operations back-to-back.

ok patrick@

23 months agoImplement ometric_set_timeval() and ometric_set_timeval_with_labels()
claudio [Tue, 6 Dec 2022 11:27:58 +0000 (11:27 +0000)]
Implement ometric_set_timeval() and ometric_set_timeval_with_labels()

Timestamps are special since they can require more significant bits
than a double provides. Instead print them as pseudo float as suggested
by the OpenMetrics draft.
OK cheloha@

23 months agoCorrect previous, must exit 0 to signal failure.
anton [Tue, 6 Dec 2022 09:37:20 +0000 (09:37 +0000)]
Correct previous, must exit 0 to signal failure.

23 months agoPrint size_t with %zu.
tobhe [Tue, 6 Dec 2022 09:07:33 +0000 (09:07 +0000)]
Print size_t with %zu.

ok patrick@

23 months agoarithmethic -> arithmetic
jsg [Tue, 6 Dec 2022 02:12:05 +0000 (02:12 +0000)]
arithmethic -> arithmetic

23 months agoi386: switch to clockintr
cheloha [Tue, 6 Dec 2022 01:56:43 +0000 (01:56 +0000)]
i386: switch to clockintr

In lapic timer mode:

- Rip out lapic_delay().  We can't use the lapic timer to delay(9) when
  it's running in one-shot mode.
- Add a randomized statclock(), stathz = hz.
- Add profiling support, profhz = stathz * 10.
- Wire up lapic_intrclock.

In i8254-mode:

- i8254's clockintr() does not have a monopoly on hardclock(9).
- mc146818's rtcintr() does not have a monopoly on statclock().
- In profiling mode, the statclock() will drift very slightly
  because (profhz = 1024) does not divide into 1 billion.  Need to
  consider how best to fix this.

ACPI suspend/resume tested by mlarkin@ via ESXi.  Tons of testing by
Scott Bennett on a Pentium 4 machine; APM suspend/resume confirmed to
work there, too.

Link: https://marc.info/?l=openbsd-tech&m=166776370803446&w=2
ok mlarkin@

23 months agosh, landisk: switch to clockintr
cheloha [Tue, 6 Dec 2022 01:19:35 +0000 (01:19 +0000)]
sh, landisk: switch to clockintr

Patch review and testing by miod@.

Link: https://marc.info/?l=openbsd-tech&m=166776412003652&w=2
ok mlarkin@, probably ok miod@

23 months agom88k, luna88k: switch to clockintr
cheloha [Tue, 6 Dec 2022 00:56:52 +0000 (00:56 +0000)]
m88k, luna88k: switch to clockintr

- Initialize tick_nsec during cpu_initclocks()

We have no control over the interrupt clock on luna88k, so this switch
is trivial.

Bringup help and testing from aoyama@ and miod@.

Link: https://marc.info/?l=openbsd-tech&m=166776371203450&w=2
ok aoyama@ mlarkin@

23 months agohppa: switch to clockintr
cheloha [Tue, 6 Dec 2022 00:40:09 +0000 (00:40 +0000)]
hppa: switch to clockintr

- Remove hppa-specific clock interrupt scheduling bits from cpu_info.
- Rename cpu_hardclock() to itmr_intr(); it doesn't exclusively run
  hardclock(9) anymore.
- Wire up itmr_intrclock.

hppa now has a randomized statclock(), stathz = hz.

Patch help, testing, and review from kettenis@ (B2000) and miod@ (C3650).
MP testing from guenther@ (dual-core J6700).

ok mlarkin@ kettenis@, "Ship it?" guenther@

23 months agoPrint SBI vendor, version and implemented spec version
jca [Tue, 6 Dec 2022 00:11:23 +0000 (00:11 +0000)]
Print SBI vendor, version and implemented spec version

On my Unmatched:

SBI: OpenSBI v0.9, SBI Specification Version 0.2

ok mlarkin@

23 months agoDrop unused WEAK_REFERENCE macro
jca [Tue, 6 Dec 2022 00:08:38 +0000 (00:08 +0000)]
Drop unused WEAK_REFERENCE macro

Probably coming from FreeBSD.  We already have WEAK_ALIAS a few lines
above.  ok mlarkin@ guenther@

23 months agozap a pile of dangling tabs
deraadt [Mon, 5 Dec 2022 23:18:37 +0000 (23:18 +0000)]
zap a pile of dangling tabs

23 months agomake all lists non -compact, to keep spacing consistent;
jmc [Mon, 5 Dec 2022 23:14:03 +0000 (23:14 +0000)]
make all lists non -compact, to keep spacing consistent;
from brad
ok jca

while here knock out the resulting unnecessary Pp and wrap some
long lines

23 months agoPrep for rpki-client 8.2
claudio [Mon, 5 Dec 2022 21:02:52 +0000 (21:02 +0000)]
Prep for rpki-client 8.2

23 months agoAdd support configuring hostname.if(5) by lladdr
afresh1 [Mon, 5 Dec 2022 20:12:00 +0000 (20:12 +0000)]
Add support configuring hostname.if(5) by lladdr

Original implementation by martijn@
Feedback and suggestions from kn@, sthen@, claudio@, florian@, and deraadt@.

ok deraadt

23 months agoUnbreak rust-openssl-tests on sparc64
tb [Mon, 5 Dec 2022 14:43:06 +0000 (14:43 +0000)]
Unbreak rust-openssl-tests on sparc64

For the test compilation using the CC crate, base clang is good enough,
so we don't need to pull in another heavy dependency just for this test.