openbsd
2 years agoTest poll/select with various I/O conditions; not hooked up yet.
visa [Mon, 6 Dec 2021 05:52:07 +0000 (05:52 +0000)]
Test poll/select with various I/O conditions; not hooked up yet.

2 years agogettimeofday.2: miscellaneous manpage cleanup
cheloha [Mon, 6 Dec 2021 02:48:55 +0000 (02:48 +0000)]
gettimeofday.2: miscellaneous manpage cleanup

Highlights:

- Tweak the one-liner description.
- Better variable names.
- Reorder DESCRIPTION to reflect the importance of each interface.
- Advise against using gettimeofday(2) for measuring elapsed time.
- Isolate discussion of the historical timezone parameter to its
  own paragraph at the end of the DESCRIPTION.
- Update ERRORS.  Mention the securelevel(7) EPERM for settimeofday(2).
- Expand SEE ALSO.
- Note settimeofday(2) in STANDARDS.  It is available on many systems.

Discussed with jmc@, millert@, and deraadt@.  Possibly discussed with
schwarze@, though I can't find the email.

Thread: https://marc.info/?t=162765632800002&r=1&w=2

"reads fine to me" jmc@, ok millert@

2 years agotime.3: miscellaneous manpage cleanup
cheloha [Mon, 6 Dec 2021 00:15:01 +0000 (00:15 +0000)]
time.3: miscellaneous manpage cleanup

- Change "tloc" variable to "now" to reinforce meaning.
- Simplify DESCRIPTION.
- No point in describing how gettimeofday(2) can fail here.
- Add a STANDARDS section.
- Rework the HISTORY section.

With input from jmc@, millert@, and schwarze@.

Thread: https://marc.info/?l=openbsd-tech&m=162766815024823&w=2

"reads fine" jmc@, ok schwarze@

2 years agosys/select.h is not needed, if howmany/NBBY are needed they will arrive
deraadt [Sun, 5 Dec 2021 22:36:19 +0000 (22:36 +0000)]
sys/select.h is not needed, if howmany/NBBY are needed they will arrive
via netinet/in.h and sys/time.h, which I must say surprises me a bit

2 years agokbind(2): disable system call if not initialized before first __tfork(2)
cheloha [Sun, 5 Dec 2021 22:00:42 +0000 (22:00 +0000)]
kbind(2): disable system call if not initialized before first __tfork(2)

To unlock kbind(2) we need to protect ps_kbind_addr and
ps_kbind_cookie.

The simplest way to do this is to disallow kbind(2) initialization
after the first __tfork(2) call.  If the first thread does not
initialize the kbind(2) variables before __tfork(2) then we disable
kbind(2) during that first __tfork(2) call.

This is guenther@'s patch, I'm just committing it.

Discussed with guenther@, deraadt@, kettenis@, and mpi@.

ok kettenis@, positive response from mpi@, "I am busy" guenther@

2 years agoAdd test case for policy matching on responder with multiple policies that
tobhe [Sun, 5 Dec 2021 20:21:14 +0000 (20:21 +0000)]
Add test case for policy matching on responder with multiple policies that
only differ by srcid.

2 years agolibpcap parser uses a memory tracker to only free all objects at the end.
deraadt [Sun, 5 Dec 2021 16:40:24 +0000 (16:40 +0000)]
libpcap parser uses a memory tracker to only free all objects at the end.
this code was slicing up large mallocs with sys/param.h ALIGN().  such a
scheme loses the many overflow/damage checking benefits of malloc per object.
Change the code to track independent allocations, rather than slicing.
ok gnezdo claudio

2 years agoelf64_checkum->elf64_checksum; adapted from changes by saitoh masanobu
jmc [Sun, 5 Dec 2021 16:07:01 +0000 (16:07 +0000)]
elf64_checkum->elf64_checksum; adapted from changes by saitoh masanobu

2 years agosytle -> style; adapted from changes by saitoh masanobu
jmc [Sun, 5 Dec 2021 15:53:46 +0000 (15:53 +0000)]
sytle -> style; adapted from changes by saitoh masanobu

2 years agoadd missing mtx_leave() calls in error paths
jsg [Sun, 5 Dec 2021 15:35:32 +0000 (15:35 +0000)]
add missing mtx_leave() calls in error paths
ok anton@

2 years agofix use after free
jsg [Sun, 5 Dec 2021 13:48:14 +0000 (13:48 +0000)]
fix use after free
ok tb@

2 years agoAllow libradius tests to compile with opaque HMAC_CTX.
tb [Sun, 5 Dec 2021 13:47:52 +0000 (13:47 +0000)]
Allow libradius tests to compile with opaque HMAC_CTX.

2 years agoSimplify DH_check_params a bit.
tb [Sun, 5 Dec 2021 13:45:26 +0000 (13:45 +0000)]
Simplify DH_check_params a bit.

It makes no sense to allocate an entire BN_CTX if we only use it to
get a single BIGNUM, from which we subtract 1 to compare it to g.
We can just use a plain BIGNUM and delete a bunch of lines.

ok inoguchi jsing

2 years agoAdd initial regress for CT.
jsing [Sun, 5 Dec 2021 13:01:08 +0000 (13:01 +0000)]
Add initial regress for CT.

This provides test coverage for SCT encoding/decoding.

2 years agofix unintended sizeof pointer in debug path
jsg [Sun, 5 Dec 2021 12:28:27 +0000 (12:28 +0000)]
fix unintended sizeof pointer in debug path
ok markus@

2 years agofix unintended sizeof pointer
jsg [Sun, 5 Dec 2021 12:26:27 +0000 (12:26 +0000)]
fix unintended sizeof pointer
ok claudio@

2 years agoDefer rtm_80211info() call from ieee80211_set_link_state() to a task context.
stsp [Sun, 5 Dec 2021 11:33:45 +0000 (11:33 +0000)]
Defer rtm_80211info() call from ieee80211_set_link_state() to a task context.

Sending routing messages requires a socket lock which may sleep.
ieee80211_set_link_state() is called from interrupts and timeouts where
sleeping is not allowed. mvs@ pointed out that if_link_state_change()
is already using a task for this reason.

Should fix a witness-related panic reported by cheloha@

ok mvs@ tobhe@ florian@

2 years agoAdd RCS markers
tb [Sun, 5 Dec 2021 09:37:46 +0000 (09:37 +0000)]
Add RCS markers

2 years agovmm(4): reload vmcs after possible sleep points
dv [Sat, 4 Dec 2021 18:51:36 +0000 (18:51 +0000)]
vmm(4): reload vmcs after possible sleep points

Guests running on Intel hosts that sleep on a lock might have their
process moved to another cpu core by the scheduler. If this happens,
the VMCS needs to be remotely cleared and locally loaded otherwise
vmx instructions will fail. vmd(8) will receive a failure code and
abort the guest.

This change stores the current (last) cpu the process was on before
attempting a function call that may sleep (e.g. uvm_fault(9)). Upon
function return, perform the VMCS dance if needed.

Tested with help from Mischa Pieters.

OK mlarkin@

2 years agogross trailing whitespace
tb [Sat, 4 Dec 2021 17:03:43 +0000 (17:03 +0000)]
gross trailing whitespace

2 years agoList subdirectories as a simple list. Avoids a source of many merge
tb [Sat, 4 Dec 2021 16:29:25 +0000 (16:29 +0000)]
List subdirectories as a simple list. Avoids a source of many merge
conflicts in my work on making much of libcrypto opaque.

discussed with jsing

2 years agoAnnotate the structs to be moved to bn_lcl.h in the next bump
tb [Sat, 4 Dec 2021 16:11:10 +0000 (16:11 +0000)]
Annotate the structs to be moved to bn_lcl.h in the next bump

ok inoguchi jsing

2 years agoUse BN_is_negative(p) instead of p->neg in one place.
tb [Sat, 4 Dec 2021 16:09:59 +0000 (16:09 +0000)]
Use BN_is_negative(p) instead of p->neg in one place.

2 years agoAdd #include "bn_lcl.h" to the files that will soon need it.
tb [Sat, 4 Dec 2021 16:08:32 +0000 (16:08 +0000)]
Add #include "bn_lcl.h" to the files that will soon need it.

ok inoguchi jsing

2 years agoPrevious diff was incomplete, we also need to do DMA translation for
kettenis [Sat, 4 Dec 2021 16:08:02 +0000 (16:08 +0000)]
Previous diff was incomplete, we also need to do DMA translation for
bus_dmamap_load_raw(9).  This fixes xhci(4) on the rpi4 with the
U-Boot from ports that is installed on the arm64 installation media.

ok mglocker@, patrick@

2 years agoImplement the BN_to_montgomery() macro as a function
tb [Sat, 4 Dec 2021 16:05:46 +0000 (16:05 +0000)]
Implement the BN_to_montgomery() macro as a function

ok inoguchi jsing

2 years agoImplement the BN_is_negative macro as a function
tb [Sat, 4 Dec 2021 16:02:44 +0000 (16:02 +0000)]
Implement the BN_is_negative macro as a function

ok inoguchi jsing

2 years agoProvide function implementations for various BN_* macros
tb [Sat, 4 Dec 2021 15:59:52 +0000 (15:59 +0000)]
Provide function implementations for various BN_* macros

BN_abs_is_word, BN_is_{zero,one,word,odd}, BN_one, BN_zero_ex are
now implemented as functions for internal use. They will be exposed
publicly to replace the macros reaching into BIGNUM in the next bump.

ok inoguchi jsing

2 years agoProvide replacement functions for the BN_{get,set,with}_flags() macros.
tb [Sat, 4 Dec 2021 15:53:01 +0000 (15:53 +0000)]
Provide replacement functions for the BN_{get,set,with}_flags() macros.

ok inoguchi jsing

2 years agoProvide replacement functions for the BN_GENCB_set{,_old}() macros
tb [Sat, 4 Dec 2021 15:48:23 +0000 (15:48 +0000)]
Provide replacement functions for the BN_GENCB_set{,_old}() macros

The function implementations are necessary to make BIGNUM opaque.
They will be used in libcrypto internally until they will replace
the macro implementations with the next bump.

ok inoguchi jsing

2 years agoConsolidate {d2i,i2d}_{pr,pu}.c
jsing [Sat, 4 Dec 2021 15:38:10 +0000 (15:38 +0000)]
Consolidate {d2i,i2d}_{pr,pu}.c

Currently there are two files for private key ASN.1 (d2i_pr.c, i2d_pr.c)
and two files for public key ASN.1 (d2i_pu.c, i2d_pu.c). All of the other
ASN.1 code has d2i and i2d in the same per-object file.

Consolidate d2i_pr.c/i2d_pr.c into a_pkey.c and consolidate
d2i_pu.c/i2d_pu.c into a_pubkey.c before making any further changes to
this code.

ok tb@

2 years agoClean up and refactor server side DHE key exchange.
jsing [Sat, 4 Dec 2021 14:03:22 +0000 (14:03 +0000)]
Clean up and refactor server side DHE key exchange.

Provide ssl_kex_generate_dhe_params_auto() which handles DHE key generation
based on parameters determined by the specified key bits. Convert the
existing DHE auto parameter selection code into a function that just tells
us how many key bits to use.

Untangle and rework the server side DHE key exchange to use the ssl_kex_*
functions.

ok inoguchi@ tb@

2 years agoMove the minimum DHE key size check into ssl_kex_peer_params_dhe()
jsing [Sat, 4 Dec 2021 13:50:35 +0000 (13:50 +0000)]
Move the minimum DHE key size check into ssl_kex_peer_params_dhe()

ok inoguchi@ tb@

2 years agoCheck DH public key in ssl_kex_peer_public_dhe().
jsing [Sat, 4 Dec 2021 13:15:10 +0000 (13:15 +0000)]
Check DH public key in ssl_kex_peer_public_dhe().

Call DH_check_pub_key() after decoding the peer public key - this will be
needed for the server DHE key exchange, but also benefits the client.

ok inoguchi@ tb@

2 years agoSend out dstid as initiator if configured. This makes it easier for
tobhe [Sat, 4 Dec 2021 13:07:17 +0000 (13:07 +0000)]
Send out dstid as initiator if configured. This makes it easier for
the responder to match the correct policy if multiple are available.

ok patrick@

2 years agoFree cert, key and ocsp_staple on exit of do_keypair_test().
tb [Sat, 4 Dec 2021 09:04:36 +0000 (09:04 +0000)]
Free cert, key and ocsp_staple on exit of do_keypair_test().

Reported by Ilya Shipitsine, discussed with jsing

2 years agoConvert main into single exit to appease asan.
tb [Sat, 4 Dec 2021 08:15:16 +0000 (08:15 +0000)]
Convert main into single exit to appease asan.

2 years agoExplicitly free EVP_MD_CTX to appease asan. Reported by Ilya Shipitsin.
tb [Sat, 4 Dec 2021 07:58:10 +0000 (07:58 +0000)]
Explicitly free EVP_MD_CTX to appease asan. Reported by Ilya Shipitsin.

2 years agolist backup files created by adduser; from leon fischer
jmc [Sat, 4 Dec 2021 07:31:38 +0000 (07:31 +0000)]
list backup files created by adduser; from leon fischer
adjust list width to make it all fit

2 years agoupdate the firmware file list, helped by stsp;
jmc [Sat, 4 Dec 2021 07:27:38 +0000 (07:27 +0000)]
update the firmware file list, helped by stsp;

2 years agoConsolidate error paths in usbd_new_device, shaving of 14 lines.
anton [Sat, 4 Dec 2021 07:01:59 +0000 (07:01 +0000)]
Consolidate error paths in usbd_new_device, shaving of 14 lines.

ok bluhm@

2 years agoDo not setup pipes between SERVER processes, they don't talk to each
florian [Sat, 4 Dec 2021 06:52:58 +0000 (06:52 +0000)]
Do not setup pipes between SERVER processes, they don't talk to each
other. Since this generates a full mesh, the amount of filedescriptors
needed grows quadratically with the amount of configured prefork
processes.

Might fix an out of filedescriptor bug that beck is seeing.
OK benno

2 years agoAdd regress for ECPKParameters ASN.1 encoding/decoding.
jsing [Sat, 4 Dec 2021 05:15:09 +0000 (05:15 +0000)]
Add regress for ECPKParameters ASN.1 encoding/decoding.

2 years agoRSA/SHA-1 is not used by default anymore on the server
naddy [Sat, 4 Dec 2021 00:05:39 +0000 (00:05 +0000)]
RSA/SHA-1 is not used by default anymore on the server

2 years agoadd Allwinner H6 support
uaa [Fri, 3 Dec 2021 19:22:42 +0000 (19:22 +0000)]
add Allwinner H6 support
ok kettenis@

2 years agosupport AXP805 PMIC
uaa [Fri, 3 Dec 2021 19:17:27 +0000 (19:17 +0000)]
support AXP805 PMIC
ok kettenis@

2 years ago- support I2C connected PMIC, add "early 1" to sxitwi.
uaa [Fri, 3 Dec 2021 19:16:29 +0000 (19:16 +0000)]
- support I2C connected PMIC, add "early 1" to sxitwi.
- support axppmic via iic

ok kettenis@

2 years agoAdd tdb_delete_locked() to replace duplicate tdb deletion code in
tobhe [Fri, 3 Dec 2021 19:04:49 +0000 (19:04 +0000)]
Add tdb_delete_locked() to replace duplicate tdb deletion code in
pfkey_flush().

ok bluhm@ mvs@

2 years agoPerform DMA address translation if required.
kettenis [Fri, 3 Dec 2021 18:23:41 +0000 (18:23 +0000)]
Perform DMA address translation if required.

ok patrick@

2 years agoReplace asn1_tlc_clear and asn1_tlc_clear_nc macros with a function.
jsing [Fri, 3 Dec 2021 17:27:34 +0000 (17:27 +0000)]
Replace asn1_tlc_clear and asn1_tlc_clear_nc macros with a function.

Call the replacement asn1_tlc_invalidate() since it does not actually
clear the ASN1_TLC.

While here, name the ASN1_TLC variables consistently as ctx, remove a
pointless comment and simplify ASN1_item_d2i() slightly.

ok inoguchi@ tb@

2 years agoGroup and sort includes.
jsing [Fri, 3 Dec 2021 17:23:16 +0000 (17:23 +0000)]
Group and sort includes.

2 years agoCall asn1_item_ex_d2i() directly from ASN1_item_d2i()
jsing [Fri, 3 Dec 2021 17:22:10 +0000 (17:22 +0000)]
Call asn1_item_ex_d2i() directly from ASN1_item_d2i()

ASN1_item_ex_d2i() is just a wrapper around the internal asn1_item_ex_d2i()
function, so call asn1_item_ex_d2i() directly.

ok inoguchi@ tb@

2 years agoAdd TDB reference counting to ipsp_spd_lookup(). If an output
bluhm [Fri, 3 Dec 2021 17:18:34 +0000 (17:18 +0000)]
Add TDB reference counting to ipsp_spd_lookup().  If an output
pointer is passed to the function, it will return a refcounted TDB.
The ref happens when ipsp_spd_inp() copies the pointer from
ipo->ipo_tdb.  The caller of ipsp_spd_lookup() has to unref after
using it.
tested by Hrvoje Popovski; OK mvs@ tobhe@

2 years agoConvert ASN1_PCTX_new() to calloc().
jsing [Fri, 3 Dec 2021 17:10:49 +0000 (17:10 +0000)]
Convert ASN1_PCTX_new() to calloc().

Rather than using malloc() and then initialising all struct members to zero
values, use calloc().

ok schwarze@ tb@

2 years agoUse calloc() for X509_CRL_METHOD_new() instead of malloc().
jsing [Fri, 3 Dec 2021 17:07:53 +0000 (17:07 +0000)]
Use calloc() for X509_CRL_METHOD_new() instead of malloc().

This ensures that if any members are added to this struct, they will be
initialised.

ok schwarze@ tb@

2 years agoRewrite ASN1_STRING_cmp().
jsing [Fri, 3 Dec 2021 17:03:54 +0000 (17:03 +0000)]
Rewrite ASN1_STRING_cmp().

This removes nested ifs and uses more sensible variable names.

ok schwarze@ tb@

2 years agoConvert ASN1_STRING_type_new() to calloc().
jsing [Fri, 3 Dec 2021 17:01:07 +0000 (17:01 +0000)]
Convert ASN1_STRING_type_new() to calloc().

Rather than using malloc() and then initialising all struct members, use
calloc() and only initialise the single non-zero value member.

ok schwarze@ tb@

2 years agoConvert ASN1_OBJECT_new() to calloc().
jsing [Fri, 3 Dec 2021 16:58:11 +0000 (16:58 +0000)]
Convert ASN1_OBJECT_new() to calloc().

Rather than using malloc() and then initialising all struct members, use
calloc() and only initialise the single non-zero value member.

ok schwarze@ tb@

2 years agoConvert {i2d,d2i}_{,EC_,DSA_,RSA_}PUBKEY{,_bio,_fp}() to templated ASN1
jsing [Fri, 3 Dec 2021 16:46:50 +0000 (16:46 +0000)]
Convert {i2d,d2i}_{,EC_,DSA_,RSA_}PUBKEY{,_bio,_fp}() to templated ASN1

These functions previously used the old ASN1_{d2i,i2d}_{bio,fp}()
interfaces.

ok inoguchi@ tb@

2 years agoFixed-size NOFILE_MAX (from sys/param.h of course) array is crazy, so
deraadt [Fri, 3 Dec 2021 15:15:22 +0000 (15:15 +0000)]
Fixed-size NOFILE_MAX (from sys/param.h of course) array is crazy, so
rewrite to expand the array as needed.
ok tb

2 years agoSwitch iwx(4) to new -67 firmware images.
stsp [Fri, 3 Dec 2021 14:32:08 +0000 (14:32 +0000)]
Switch iwx(4) to new -67 firmware images.

iwx-firmware-20211101 must be installed with fw_update(1) before
booting a new kernel. sysupgrade(8) will take care of this.

Intel has published a related security advisory:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00509.html

iwx(4) devices which are using the iwx-Qu-c0-hr-b0-63 image did
not receive a firmware update. I have no idea why.

Tested:
ax200: jmc, stsp, Matthias Schmidt
ax201: fkr, stsp

2 years agoUse calloc() in EVP_PKEY_meth_new() instead of malloc() and setting
tb [Fri, 3 Dec 2021 14:19:57 +0000 (14:19 +0000)]
Use calloc() in EVP_PKEY_meth_new() instead of malloc() and setting
almost all members to 0. Just set the two things that need setting.

ok jsing

2 years agoFix EVP_PKEY_{asn1,meth}_copy once and for all
tb [Fri, 3 Dec 2021 14:18:06 +0000 (14:18 +0000)]
Fix EVP_PKEY_{asn1,meth}_copy once and for all

It is very easy to forget to copy over newly added methods. Everyone
working in this corner has run into this. Instead, preserve what needs
preserving and use a struct copy, so all methods get copied from src
to dest.

tweak/ok jsing

2 years agoRevert previous
kn [Fri, 3 Dec 2021 14:15:07 +0000 (14:15 +0000)]
Revert previous

Those scripts are not hooked up to the build yet;
I assumed they were without checking, my bad.

Reminded by deraadt

2 years agoDisable probe requests during scans in iwx(4) again.
stsp [Fri, 3 Dec 2021 13:17:32 +0000 (13:17 +0000)]
Disable probe requests during scans in iwx(4) again.

While this is working well for many, some people see device timeouts
when using the device unless we disable probe requests during scans.

The issue was a lot more visible on iwx(4) with earlier firmware.
In fact, iwx(4) did ship with probe requests disabled for most of its
existence. I re-enabled them along with a firmware upgrade since I no
longer saw the problem. However, the issue prevails for other people.

I still have no idea what is causing this. I have already spent enough
time trying to track down a proper fix. Unless we receive help from
someone who knows about firmware internals the best we can do is trial
and error. The problem also existed on iwm(4) 9k devices which we now
run with probe requests disabled, too.

The only upside of probe requests is that scans can complete faster, with
the downside of a potential privacy leak (the previously selected SSID is
exposed). So, overall, we do not lose much here.

Patch tested for a week by Laurence Tratt who is no longer seeing device
timeouts which were relatively frequent before.

2 years agoApply the same MAX_IP_SIZE limit to ROA files as it is done on certificates.
claudio [Fri, 3 Dec 2021 12:56:19 +0000 (12:56 +0000)]
Apply the same MAX_IP_SIZE limit to ROA files as it is done on certificates.
OK job@ tb@

2 years agoImplement a bgscan_done() handler for iwm(4).
stsp [Fri, 3 Dec 2021 12:43:17 +0000 (12:43 +0000)]
Implement a bgscan_done() handler for iwm(4).

Required to prevent breakage of roaming with new Intel firmware on 9k devices.

Tested:
8265: Aaron Poffenberger, stsp
9260: florian
9560: sthen

2 years agoImplement a bgscan_done() handler for iwx(4).
stsp [Fri, 3 Dec 2021 12:42:39 +0000 (12:42 +0000)]
Implement a bgscan_done() handler for iwx(4).

Fixes roaming-related hangs observed by jmc@.

Tested:
ax200: jmc, stsp

2 years agoIntroduce an optional driver-specific bgscan_done() handler which
stsp [Fri, 3 Dec 2021 12:41:36 +0000 (12:41 +0000)]
Introduce an optional driver-specific bgscan_done() handler which
allows the driver to take control of the roaming teardown sequence.
This handler allows drivers to ensure that race conditions between
firmware state and net80211 state are avoided, and will be used by
the iwm(4) and iwx(4) drivers soon.

Split the existing roaming teardown sequence into two steps, one step
for tearing down Tx block ack sessions which sends a DELBA frame, and a
second step for flushing Tx rings followed by sending a DEAUTH frame.
We used to queue both frames, expecting to switch APs once both were sent.
Now we effectively expect everything to be sent before we queue a final
DEAUTH frame, and wait for just this frame to be sent before switching.
This already made issues on iwm/iwx less frequent but by itself this was
not enough to close all races for those drivers. It should however help
when adding background scan support to a non-firmware device driver.

Tested, with driver patches:
iwm 8265: Aaron Poffenberger, stsp
iwm 9260: florian
iwm 9560: sthen
iwx ax200: jmc, stsp

2 years agoIgnore ADDBA requests from our AP while we are roaming away from it.
stsp [Fri, 3 Dec 2021 12:40:15 +0000 (12:40 +0000)]
Ignore ADDBA requests from our AP while we are roaming away from it.

Noticed while testing iwm/iwx roaming patches, where my AP would request
a new Rx BA session when we had already decided to roam away. There is no
need to set up a new Rx BA session with our old AP which we would have to
immediately tear down again anyway.

2 years agoShip mpi's helpers, see share/btrace/Makefile r1.1:
kn [Fri, 3 Dec 2021 11:47:23 +0000 (11:47 +0000)]
Ship mpi's helpers, see share/btrace/Makefile r1.1:
---
Provide common btrace(8) scripts

. kprofile.bt - to save kernel stackframces and produce flamegraphs
. runqlat.bt  - to measure the latency of the scheduler runqueues

2 years agoClarify manpage
job [Fri, 3 Dec 2021 08:40:07 +0000 (08:40 +0000)]
Clarify manpage

OK claudio@

2 years agoDump more data in the hopes of figuring out why this test occasionally
anton [Fri, 3 Dec 2021 06:44:46 +0000 (06:44 +0000)]
Dump more data in the hopes of figuring out why this test occasionally
fails.

2 years agoBring back the recently reverted change, this time without the inverted
anton [Fri, 3 Dec 2021 06:34:38 +0000 (06:34 +0000)]
Bring back the recently reverted change, this time without the inverted
conditional. Repeating the previous commit messsage:

Assert that at least one report id is claimed during multiple report ids
attachment. Should prevent uhidev drivers from doing the wrong thing in their
corresponding match routine.

Tested by dv@

2 years agohash full host:port when asked to hash output, fixes hashes for non-
djm [Thu, 2 Dec 2021 23:45:36 +0000 (23:45 +0000)]
hash full host:port when asked to hash output, fixes hashes for non-
default ports. bz3367 ok dtucker@

2 years agoimprove the testing of credentials against inserted FIDO keys a little
djm [Thu, 2 Dec 2021 23:23:13 +0000 (23:23 +0000)]
improve the testing of credentials against inserted FIDO keys a little
more: ask the token whether a particular key belongs to it in cases
where the token support on-token user- verification (e.g. biometrics)
rather than just assuming that it will accept it.

Will reduce spurious "Confirm user presence" notifications for key
handles that relate to FIDO keys that are not currently inserted in at
least some cases.

Motivated by bz3366; by Pedro Martelletto

2 years agomove check_sk_options() up so we can use it earlier
djm [Thu, 2 Dec 2021 22:40:05 +0000 (22:40 +0000)]
move check_sk_options() up so we can use it earlier

2 years agossh-rsa is no longer in the default for PubkeyAcceptedAlgorithms.
dtucker [Thu, 2 Dec 2021 22:35:05 +0000 (22:35 +0000)]
ssh-rsa is no longer in the default for PubkeyAcceptedAlgorithms.

2 years agobsearch(3): support arrays with more than INT_MAX elements
cheloha [Thu, 2 Dec 2021 20:58:01 +0000 (20:58 +0000)]
bsearch(3): support arrays with more than INT_MAX elements

The "lim" variable needs to be a size_t to match nmemb, otherwise we
get undefined behavior when nmemb exceeds INT_MAX.

Prompted by a blog post by Joshua Bloch:

https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html

Fixed by Chris Torek a long time ago:

https://svnweb.freebsd.org/csrg/lib/libc/stdlib/bsearch.c?revision=51742&view=markup

ok millert@

2 years agounmount real root partition from /mnt before the cgi/random actions
deraadt [Thu, 2 Dec 2021 17:18:39 +0000 (17:18 +0000)]
unmount real root partition from /mnt before the cgi/random actions
which run asyncronously and can grab vnodes race to make the umount fail
spuriously
problem seen and diagnosed by Yuichiro NAITO
ok florian

2 years agoTell testers which packages to install right away (and why)
kn [Thu, 2 Dec 2021 17:10:53 +0000 (17:10 +0000)]
Tell testers which packages to install right away (and why)

Other regress tests do it differently;  just fix/thouch those that did not
mention any package name at all.

This helps grepping logs for SKIPPED to find instructions for the next run.

2 years agoLog that kern.allowdt=1 is needed and where
kn [Thu, 2 Dec 2021 17:09:46 +0000 (17:09 +0000)]
Log that kern.allowdt=1 is needed and where

This helps grepping logs for SKIPPED to find instructions for the next run.

2 years agoTell testers which packages to install right away
kn [Thu, 2 Dec 2021 15:56:15 +0000 (15:56 +0000)]
Tell testers which packages to install right away

OK bluhm

2 years agolist uppercase options along with lower in SYNOPSIS/options list/usage;
jmc [Thu, 2 Dec 2021 15:15:29 +0000 (15:15 +0000)]
list uppercase options along with lower in SYNOPSIS/options list/usage;
suggested by/ok deraadt

2 years agofirstc() and nextc() use an int of global static storage. Make this
deraadt [Thu, 2 Dec 2021 15:13:49 +0000 (15:13 +0000)]
firstc() and nextc() use an int of global static storage.  Make this
a pointer to a local variable to allow concurrent use if that ever
needs to happen in the future.
ok mpi kettenis

2 years agoipsec_common_input_cb() extracted the inner IP header of IPsec
bluhm [Thu, 2 Dec 2021 13:46:42 +0000 (13:46 +0000)]
ipsec_common_input_cb() extracted the inner IP header of IPsec
tunnels.  It is never used, so this is useless code.  Remove ipn
and ip6n IP header variables and the m_copydata() to fill them.
OK mvs@ kn@ sthen@

2 years agoAllow to build kernel without IPSEC or INET6 defines.
bluhm [Thu, 2 Dec 2021 12:39:15 +0000 (12:39 +0000)]
Allow to build kernel without IPSEC or INET6 defines.
OK mpi@ mvs@

2 years agodon't put the tty into raw mode when SessionType=none, avoids ^c being
djm [Thu, 2 Dec 2021 02:44:44 +0000 (02:44 +0000)]
don't put the tty into raw mode when SessionType=none, avoids ^c being
unable to kill such a session. bz3360; ok dtucker@

2 years agoRemove the MBR_init() "#ifdef defined(__macppc__) ||
krw [Wed, 1 Dec 2021 22:37:30 +0000 (22:37 +0000)]
Remove the MBR_init() "#ifdef defined(__macppc__) ||
defined(__mips__)" chunk that rounded the start of the default
OpenBSD partition to a cylinder boundary. The value has been
immediately re-rounded to a power of 2 block since r1.25 in 2009.

Eliminates wasted space when no /usr/mdec/mbr partition
0 information is available.

'-b' becomes available to architectures other than amd64 and
i386, taking precedence over /usr/mdec/mbr partition 0
information. The latter being present only in macppc and loongson
/usr/mdec/mbr files.

2 years agoReintroduce the TDBF_DELETED flag. Checking next pointer to figure
bluhm [Wed, 1 Dec 2021 22:34:31 +0000 (22:34 +0000)]
Reintroduce the TDBF_DELETED flag.  Checking next pointer to figure
out whether the TDB is linked to the hash bucket does not work.
This fixes removal of SAs that could not be flushed with ipsecctl -F.
OK tobhe@

2 years agomention that the "flags" field in the enchdr is uses m_flags values
deraadt [Wed, 1 Dec 2021 21:48:00 +0000 (21:48 +0000)]
mention that the "flags" field in the enchdr is uses m_flags values
(see mbuf.h)

2 years agosys/core.h is not needed by these files, therefore sys/param.h isn't
deraadt [Wed, 1 Dec 2021 21:45:19 +0000 (21:45 +0000)]
sys/core.h is not needed by these files, therefore sys/param.h isn't
needed for MAXCOMLEN either

2 years agowe do not need 'struct mbuf; struct rtentry;' to satisfy some ancient unix
deraadt [Wed, 1 Dec 2021 18:28:45 +0000 (18:28 +0000)]
we do not need 'struct mbuf; struct rtentry;' to satisfy some ancient unix
variant that made a header file mistake.
ok jsg

2 years agofurther improvements in sys/param.h annotation and removal.
deraadt [Wed, 1 Dec 2021 18:21:23 +0000 (18:21 +0000)]
further improvements in sys/param.h annotation and removal.

2 years agoFix booting from an IDE block device on the Sun Blade 100. Apparently
kettenis [Wed, 1 Dec 2021 17:25:35 +0000 (17:25 +0000)]
Fix booting from an IDE block device on the Sun Blade 100.  Apparently
writing to disk using the Open Firmware interfaces is buggy and causes
corruption of the disk.  While it isn't entirely clear what versions
of Open Firmware are affected, but it seems to only affect IDE drives.
So if we detect an IDE drive, disable writing to it.  This results in
a small lose of bootloader functionality (bsd.upgrade loop prevention
and flagging /etc/random.seed re-use) but that is better than losing
the ability to run OpenBSD at all.

Based on a diff by Ted Bullock (who did all the hard work of debugging
this and coming up with a viable fix).

ok deraadt@

2 years agolate allocation of clist in putc() and b_to_q() hasn't been required in
deraadt [Wed, 1 Dec 2021 17:04:26 +0000 (17:04 +0000)]
late allocation of clist in putc() and b_to_q() hasn't been required in
a decade, because all tty drivers preallocate.
ok kettenis

2 years agoReduce use of sys/param.h, or annotate the reason why it is needed
deraadt [Wed, 1 Dec 2021 16:53:28 +0000 (16:53 +0000)]
Reduce use of sys/param.h, or annotate the reason why it is needed
(pretty much MAXCOMLEN for struct process or struct core), and remove
sys/vnode.h where not needed

2 years agoUse system _ALIGN to reduce the reasons why this uses sys/param.h
deraadt [Wed, 1 Dec 2021 16:51:57 +0000 (16:51 +0000)]
Use system _ALIGN to reduce the reasons why this uses sys/param.h

2 years agowhitespace cleanup during review read
deraadt [Wed, 1 Dec 2021 16:42:12 +0000 (16:42 +0000)]
whitespace cleanup during review read

2 years agoLet ipsp_spd_lookup() return an error instead of a TDB. The TDB
bluhm [Wed, 1 Dec 2021 12:51:09 +0000 (12:51 +0000)]
Let ipsp_spd_lookup() return an error instead of a TDB.  The TDB
is not always needed, but the error value is necessary for the
caller.  As TDB should be refcounted, it makes not sense to always
return it.  Pass an output pointer for the TDB which can be NULL.
OK mvs@ tobhe@