openbsd
22 months agovmd(8): implement zero-copy operations on virtqueues.
dv [Fri, 23 Dec 2022 19:25:22 +0000 (19:25 +0000)]
vmd(8): implement zero-copy operations on virtqueues.

The original virtio device implementation relied on allocating a
buffer on heap, copying the virtqueue from the guest, mutating the
copy, and then overwriting the virtqueue in the guest.

While the approach worked, it was both complex and added extra
overhead. On older hardware, switching to the zero-copy approach
can show a noticeable performance improvement for vionet devices.
An added benefit is this diff also reduces the amount of code in
vmd, which is always a welcome change.

In addition, change to talking about the queue pfn and not "address"
as the virtio-pci spec has drivers provide a 32-bit value representing
the physical page number of the location in guest memory, not the
linear address.

Original idea from dlg@ while working on re-adding async task queues.

ok dlg@, tested by many

22 months agoDocument the deprecated wrappers BIO_set_app_data(3) and BIO_get_app_data(3).
schwarze [Fri, 23 Dec 2022 17:52:32 +0000 (17:52 +0000)]
Document the deprecated wrappers BIO_set_app_data(3) and BIO_get_app_data(3).
Some code roams the wild still calling them.

22 months agoAdd detection of EPAN feature bit.
kettenis [Fri, 23 Dec 2022 17:46:49 +0000 (17:46 +0000)]
Add detection of EPAN feature bit.

ok deraadt@

22 months agoAvoid using 1GB mappings for the identity map that we use in the early
kettenis [Fri, 23 Dec 2022 17:31:30 +0000 (17:31 +0000)]
Avoid using 1GB mappings for the identity map that we use in the early
kernel bootstrap phase and when booting the secondary CPUs.  This avoids
accidentally mapping memory regions that should not be mapped (i.e. secure
memory) as all mapped memory can be accessed speculatively.

To allow the kernel to be loaded at arbitrary physical addresses (and
arbitrary virtual addresses in the future) make sure the code that builds
the page tables can handle mapping a block of memory that straddles a
1GB or 512GB boundary.  This involves using two pagetable pages at all
levels except the top level and changing the link_l1_pagetable function
to accept an entry count just like link_l0_pagetable already does.

ok patrick@

22 months agoMark BIO_buffer_get_num_lines(3) as intentionally undocumented.
schwarze [Fri, 23 Dec 2022 17:27:53 +0000 (17:27 +0000)]
Mark BIO_buffer_get_num_lines(3) as intentionally undocumented.
Contrary to what bio.h says, it does not *not* retrieve some "IO type",
whatever that is supposed to be, but it is a NOOP, and nothing uses it.
Despite its name, it is unrelated to BIO_f_buffer(3), and please
be careful to not confuse it with BIO_get_buffer_num_lines(3).

22 months agoMark BIO_f_nbio_test(3) as intentionally undocumented.
schwarze [Fri, 23 Dec 2022 16:59:39 +0000 (16:59 +0000)]
Mark BIO_f_nbio_test(3) as intentionally undocumented.
It exposes absurd functionality, and according to codesearch.debian.net,
it is unused except in openssl(1) s_client/s_server -nbio_test.

22 months agonew manual page BIO_s_datagram(3);
schwarze [Fri, 23 Dec 2022 15:59:34 +0000 (15:59 +0000)]
new manual page BIO_s_datagram(3);
feedback and OK tb@

22 months agoPrevent an iwx(4) firmware error when authentication to the AP times out.
stsp [Fri, 23 Dec 2022 11:29:32 +0000 (11:29 +0000)]
Prevent an iwx(4) firmware error when authentication to the AP times out.

Stop session protection before tearing down firmware state after failure
to authenticate. Firmware will panic if we remove the MAC/PHY binding
while session protection is active.

test + ok kevlo@

22 months ago- hostname.if can handle lladdr as well as if names now
jmc [Fri, 23 Dec 2022 07:37:21 +0000 (07:37 +0000)]
- hostname.if can handle lladdr as well as if names now
- mention that they can be used for dynamic addressing
- lower the reading order of multicast routing (it makes sense to place
this at the end)
- Xr route(8) up front of the route text, not the end
- use Xr rather than Pa where possible
- reorder the forwarding text

22 months agoremove "-p protocol" from the -r synopsis: it no longer makes sense
jmc [Fri, 23 Dec 2022 07:18:46 +0000 (07:18 +0000)]
remove "-p protocol" from the -r synopsis: it no longer makes sense

pointed out by pguemther
ok pguenther kn claudio

22 months agopoint readers, where relevant, to route(8) rather than netstat(1) or route(4);
jmc [Fri, 23 Dec 2022 07:16:54 +0000 (07:16 +0000)]
point readers, where relevant, to route(8) rather than netstat(1) or route(4);
remove some redundant info regarding netstat -r from ipcomp/ipsec

feedback claudio sthen
ok claudio kn sthen

22 months agodisable the use of the has in the pf state key lookup (for now).
dlg [Fri, 23 Dec 2022 07:14:55 +0000 (07:14 +0000)]
disable the use of the has in the pf state key lookup (for now).

anton@ says the previous commit breaks ipv6 related regress tests.
disabling the use of the hash in the state key compare gets it going
again while i can figure out what's going on.

22 months agowrap a line better
deraadt [Fri, 23 Dec 2022 05:35:08 +0000 (05:35 +0000)]
wrap a line better

22 months agoSimplify BN_cmp() and BN_ucmp().
jsing [Fri, 23 Dec 2022 03:15:35 +0000 (03:15 +0000)]
Simplify BN_cmp() and BN_ucmp().

The only real difference between BN_cmp() and BN_ucmp() is that one has
to respect the sign of the BN (although BN_cmp() also gets to deal with
some insanity from accepting NULLs). Rewrite/cleanup BN_ucmp() and turn
BN_cmp() into code that handles differences in sign, before calling
BN_ucmp().

ok tb@

22 months agoConsistently check for NULL early.
jsing [Fri, 23 Dec 2022 02:31:56 +0000 (02:31 +0000)]
Consistently check for NULL early.

Also be more consistent with variable naming.

ok tb@

22 months agoFix an unchecked strdup() in UI_create_method().
jsing [Fri, 23 Dec 2022 02:27:47 +0000 (02:27 +0000)]
Fix an unchecked strdup() in UI_create_method().

ok tb@

22 months agoMake UI_destroy_method() NULL safe.
jsing [Fri, 23 Dec 2022 02:26:16 +0000 (02:26 +0000)]
Make UI_destroy_method() NULL safe.

ok tb@

22 months agoRemove unhelpful comment.
jsing [Fri, 23 Dec 2022 02:22:58 +0000 (02:22 +0000)]
Remove unhelpful comment.

Remove a comment that tells you not to call a function that internally
calls free, with a stack allocated pointer...

ok tb@

22 months agoRemove compatibility "glue" for des_read_pw{_string}()
jsing [Fri, 23 Dec 2022 02:20:28 +0000 (02:20 +0000)]
Remove compatibility "glue" for des_read_pw{_string}()

Nothing can be actually using these as the symbols are not exported from
libcrypto... hopefully ui_compat.h can also go away entirely.

ok tb@

22 months agoAdd regress coverage for shifts of zero bits.
jsing [Fri, 23 Dec 2022 02:13:15 +0000 (02:13 +0000)]
Add regress coverage for shifts of zero bits.

22 months agoDo similar setup for lshift and rshift benchmarks.
jsing [Fri, 23 Dec 2022 02:12:11 +0000 (02:12 +0000)]
Do similar setup for lshift and rshift benchmarks.

This prevents realloc from unnecessarily impacting the lshift benchmarks.

22 months agoAllow configuring interfaces by lladdr in installer
afresh1 [Fri, 23 Dec 2022 00:40:58 +0000 (00:40 +0000)]
Allow configuring interfaces by lladdr in installer

This modifies the installer question, auto install scripts may need updating.

Allows answering ? to the interface question to list allowed lladdrs
and allows answering with one of them to configure the interface.
Reconfiguring by either name/unit or lladdr will clear the previous config.

Many suggestions from kn@
finish it @deraadt

22 months agonew manual page BIO_accept(3)
schwarze [Thu, 22 Dec 2022 21:05:48 +0000 (21:05 +0000)]
new manual page BIO_accept(3)

22 months agoin case of failure, always report the error with BIOerror();
schwarze [Thu, 22 Dec 2022 20:13:45 +0000 (20:13 +0000)]
in case of failure, always report the error with BIOerror();
OK tb@

22 months agoDenote multiple arguments with 'arg ...' not 'args'
kn [Thu, 22 Dec 2022 19:53:22 +0000 (19:53 +0000)]
Denote multiple arguments with 'arg ...' not 'args'

A few programs used the plural in their synopsis which doesn't read as
clear as the obvious triple-dot notation.

mdoc(7) .Ar defaults to "file ..." if no arguments are given and consistent
use of 'arg ...' matches that behaviour.

Cleanup a few markups of the same argument so the text keeps reading
naturally;  omit unhelpful parts like 'if optional arguments are given,
they are passed along' for tools like time(1) and timeout(1) that obviously
execute commands with whatever arguments where given -- just like doas(1)
which doesn't mention arguments in its DESCRIPTION in the first place.

For expr(1) the difference between 'expressions' and 'expression ...' is
crucial, as arguments must be passed as individual words.

Feedback millert jmc schwarze deraadt
OK jmc

22 months agosparc64: move retry logic out of stickcmpr_set()
cheloha [Thu, 22 Dec 2022 19:51:11 +0000 (19:51 +0000)]
sparc64: move retry logic out of stickcmpr_set()

In some cases, stickcmpr_set() fails to ensure that %STICK_CMPR leads
%STICK before returning to the caller.  Rewriting the retry logic in C
trivially fixes the issue.  So move the retry logic out into a new
function, stick_rearm().

Issue discovered by miod@, fix tested by miod@.

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

22 months agoMark BIO_s_log(3) as intentionally undocumented.
schwarze [Thu, 22 Dec 2022 16:38:45 +0000 (16:38 +0000)]
Mark BIO_s_log(3) as intentionally undocumented.

Ben Laurie invented the system logging BIO in 1999 and yet,
nothing whatsoever uses it according to codesearch.debian.net.
Besides, it is poorly designed and a crypto library is absolutely
not the place for putting a clumsy system logging facility.
Not everything needs to be a BIO!

22 months agoBring over various changes from the arm64 version of this code.
kettenis [Thu, 22 Dec 2022 15:44:02 +0000 (15:44 +0000)]
Bring over various changes from the arm64 version of this code.

ok patrick@

22 months agoit seems we made a separate list for the two sourceaddr commands,
jmc [Thu, 22 Dec 2022 07:46:19 +0000 (07:46 +0000)]
it seems we made a separate list for the two sourceaddr commands,
just to remove some vertical spacing; that is unfortunate
because when i adjusted the list spacing it did not affect this second
list, and logically it is one list (route commands) not two;

resolve this by having one -compact list, and inserting Pp between list items
where needed;

22 months agomove the flag mappings displayed by "route show" from netstat(1) to route(8):
jmc [Thu, 22 Dec 2022 07:23:29 +0000 (07:23 +0000)]
move the flag mappings displayed by "route show" from netstat(1) to route(8):
diff from paul tagliamonte, who was surprised to find them not documented
in route(8);

claudio agreed placement was not ideal;
deraadt confirmed users better served by route(8) than netstat(1);

i've tweaked some of the spacing and text so it displays better,
and removed some macros incorrectly associated with the "nameserver"
list item, which was messing up the formatting. should display better
now

22 months agouse stoeplitz to generate a hash/flowid for state keys.
dlg [Thu, 22 Dec 2022 05:59:26 +0000 (05:59 +0000)]
use stoeplitz to generate a hash/flowid for state keys.

the hash will be used to partition work in pf and pfsync in the
future, and right now it is used as the first comparison in the rb
tree state lookup.

using stoeplitz means that pf will hash traffic the same way that
hardware using a stoeplitz key will hash incoming traffic on rings.
stoeplitz is also used by the tcp stack to generate a flow id, which
is used to pick which transmit ring is used on nics with multiple
queues too. using the same algorithm throughout the stack encourages
affinity of packets to rings and softnet threads the whole way
through.

using the hash as the first comparison in the state rb tree comparison
should encourage faster traversal of the state tree by having all
the address/port bits summarised into the single hash value. however,
tests by hrvoje popovski don't show performance changing. on the
plus side, if this change is free from a performance point of view
then it makes the future steps more straightforward.

discussed at length at h2k22
tested by sashan@ and hrvoje popovski
ok tb@ sashan@ claudio@ jmatthew@

22 months agoprovide stoeplitz_n32()
dlg [Thu, 22 Dec 2022 04:43:52 +0000 (04:43 +0000)]
provide stoeplitz_n32()

22 months agoHave the power button trigger a wakeup from suspend.
patrick [Wed, 21 Dec 2022 23:26:54 +0000 (23:26 +0000)]
Have the power button trigger a wakeup from suspend.

ok kettenis@

22 months agoImplement wakeup interrupt handling. This makes sure that during suspend
patrick [Wed, 21 Dec 2022 23:18:09 +0000 (23:18 +0000)]
Implement wakeup interrupt handling.  This makes sure that during suspend
we only have wakeup interrupts enabled, all others are disabled.

ok kettenis@

22 months agoPull enabling/disabling wakeup interrupt handling out of the aplintc(4)
kettenis [Wed, 21 Dec 2022 22:30:42 +0000 (22:30 +0000)]
Pull enabling/disabling wakeup interrupt handling out of the aplintc(4)
DVACT_SUSPEND/DVACT_RESUME handling and push it into the MD code that
handles "suspend-to-idle".  This way a failure in DVACT_SUSPEND handling
will not result in hosed interrupts on the primary interrupt controller
if we abort the suspend operation.

requested by deraadt@
ok patrick@

22 months agoMark BIO_nread0(3), BIO_nread(3), BIO_nwrite0(3), and BIO_nwrite(3)
schwarze [Wed, 21 Dec 2022 15:08:37 +0000 (15:08 +0000)]
Mark BIO_nread0(3), BIO_nread(3), BIO_nwrite0(3), and BIO_nwrite(3)
as intentionally undocumented.

Bodo Moeller invented this "non-copying I/O" API in 1999, but according
to codesearch.debian.net, it is still completely unused by anything.
On top of that, it appears to be inflexible in so far as it only
supports BIO pairs and no other BIO types and fragile in so far as
it exposes pointers to internal storage and runs contrary to expectations
of how BIO objects are supposed to work.

22 months agoMove duplicate code to new sr_find_discipline() helper
kn [Wed, 21 Dec 2022 09:54:23 +0000 (09:54 +0000)]
Move duplicate code to new sr_find_discipline() helper

OK miod

22 months agoThe location of the aux info vector is now cached in ps_auxinfo of struct
claudio [Wed, 21 Dec 2022 07:59:02 +0000 (07:59 +0000)]
The location of the aux info vector is now cached in ps_auxinfo of struct
process. Use this information to access the vector.
OK mpi@ mbuhl@ deraadt@

22 months agofix a mangled comment
deraadt [Wed, 21 Dec 2022 07:16:03 +0000 (07:16 +0000)]
fix a mangled comment

22 months agotiny whitespace tweak.
dlg [Wed, 21 Dec 2022 03:02:34 +0000 (03:02 +0000)]
tiny whitespace tweak.

22 months agoconsistently use the PF_REF wrappers around refcnts.
dlg [Wed, 21 Dec 2022 02:51:06 +0000 (02:51 +0000)]
consistently use the PF_REF wrappers around refcnts.

22 months agoUpdate the Rx descriptor based on the vendor driver for Linux.
kevlo [Wed, 21 Dec 2022 02:31:09 +0000 (02:31 +0000)]
Update the Rx descriptor based on the vendor driver for Linux.
This fixes a panic seen by Geoff Steckel on RTL8125 with MCLGETL.

Tested by Geoff Steckel and Nick Owens.

ok dlg@

22 months agoprefix pf_state_key and pf_state_item struct bits to make them more unique.
dlg [Wed, 21 Dec 2022 02:23:10 +0000 (02:23 +0000)]
prefix pf_state_key and pf_state_item struct bits to make them more unique.

this makes searching for the struct members easier, which in turn
makes tweaking code around them a lot easier too. sk_refcnt in
particular would have been a lot nicer to fiddle with than just
refcnt because pf_state structs also have a refcnt, which is annoying.

tweaks and ok sashan@
reads ok kn@

22 months agoAdd argument support for msyscall, pledge, unveil, __realpath,
guenther [Tue, 20 Dec 2022 21:44:19 +0000 (21:44 +0000)]
Add argument support for msyscall, pledge, unveil, __realpath,
ypconnect, and __tmpfd.  Reorder several other syscalls to match
the order in syscalls.master

ok deraadt@

22 months agoIf we don't have usecommonopt for our application we shouldn't check the
martijn [Tue, 20 Dec 2022 20:12:27 +0000 (20:12 +0000)]
If we don't have usecommonopt for our application we shouldn't check the
default values for snmp protocol level stuff. Makes snmp mibtree work
again which got broken since the defaults changed back in 2021.

Reported by Matthias Pitzl (pitzl <at> genua <dot> de)
Hint to use usecommonopt and OK gerhard@

22 months agoApply proper bounds checking to non-repeaters and max-repetitions.
martijn [Tue, 20 Dec 2022 20:06:47 +0000 (20:06 +0000)]
Apply proper bounds checking to non-repeaters and max-repetitions.

OK sthen@, kn@

22 months agoMake ar[du]_{nonrepeaters,maxrepetitions} uint16_t instead of int16_t.
martijn [Tue, 20 Dec 2022 20:04:55 +0000 (20:04 +0000)]
Make ar[du]_{nonrepeaters,maxrepetitions} uint16_t instead of int16_t.
snmp uses signed 32 bits integers and agentx uses unsigned 16 bits
integers. I somehow ended up somewhere in between.

OK sthen@, kn@

22 months agoWhen writing out a PDU with authpriv that's larger than READ_BUF_SIZE
martijn [Tue, 20 Dec 2022 20:01:25 +0000 (20:01 +0000)]
When writing out a PDU with authpriv that's larger than READ_BUF_SIZE
we overflow the encbuf. Allocate encbuf on the fly so that we always have
enough room.

Give decryption the same treatment, although this one is not at risk, since
the input is limited to READ_BUF_SIZE.

OK sthen@, kn@

22 months agoWhen writing a message out over tcp that's too large to fit in a single
martijn [Tue, 20 Dec 2022 19:53:33 +0000 (19:53 +0000)]
When writing a message out over tcp that's too large to fit in a single
write(2), make sure that we don't restart the message on the next write
out, but continue where we left of.

OK sthen@, kn@

22 months agoadd a missing .Vt macro;
schwarze [Tue, 20 Dec 2022 17:59:29 +0000 (17:59 +0000)]
add a missing .Vt macro;
from Josiah Frentsos <jfrent at tilde dot team>

22 months agoMark BIO_dump_cb(3) and BIO_dump_indent_cb(3) as intentionally undocumented.
schwarze [Tue, 20 Dec 2022 15:34:03 +0000 (15:34 +0000)]
Mark BIO_dump_cb(3) and BIO_dump_indent_cb(3) as intentionally undocumented.

It appears Richard Levitte succumbed to everything-needs-a-callback-paranoia
in 2004, but nobody is going to be surprised that nothing whatsoever wants
to use this particular callback, according to codesearch.debian.net.

22 months agodocument BIO_fd_non_fatal_error(3) and BIO_fd_should_retry(3)
schwarze [Tue, 20 Dec 2022 14:55:45 +0000 (14:55 +0000)]
document BIO_fd_non_fatal_error(3) and BIO_fd_should_retry(3)

22 months ago- some small tweaks for the text
jmc [Tue, 20 Dec 2022 09:01:05 +0000 (09:01 +0000)]
- some small tweaks for the text
- on guenther's advice, remove NOTES: the text is either not relevant
  or already described correctly elsewhere

ok guenther

22 months agoImprove reporting of waitid(2)'s idtype/id and options arguments
guenther [Mon, 19 Dec 2022 22:55:12 +0000 (22:55 +0000)]
Improve reporting of waitid(2)'s idtype/id and options arguments
Add mimmutable(2) to report like munmap(2)

22 months agoWTRAPPED is now supported by waitid(2)
guenther [Mon, 19 Dec 2022 22:44:54 +0000 (22:44 +0000)]
WTRAPPED is now supported by waitid(2)
Don't test waitid(WUNTRACED) as that's not portable and only 'works' due
to an implementation decision

22 months agoSilence vmd ns8250 log noise about reading com1 before ready.
dv [Mon, 19 Dec 2022 20:27:26 +0000 (20:27 +0000)]
Silence vmd ns8250 log noise about reading com1 before ready.

ok marlkin@

22 months agosync
deraadt [Mon, 19 Dec 2022 20:17:06 +0000 (20:17 +0000)]
sync

22 months agoAdd waitid(2) manpage, based on a first pass by espie@ and bits
guenther [Mon, 19 Dec 2022 18:13:50 +0000 (18:13 +0000)]
Add waitid(2) manpage, based on a first pass by espie@ and bits
from FreeBSD and NetBSD.

ok kettenis@ jmc@ espie@

22 months agoRemove unused *sd_scsibus_dev member from struct sr_discipline
kn [Mon, 19 Dec 2022 15:27:06 +0000 (15:27 +0000)]
Remove unused *sd_scsibus_dev member from struct sr_discipline

Under _KERNEL, dead since 2011 r1.100
    Simplify softraid(4) to behave like other HBAs [...]

OK krw

22 months agoInvalidate ugen(4) knote lists after device detach
visa [Mon, 19 Dec 2022 15:10:40 +0000 (15:10 +0000)]
Invalidate ugen(4) knote lists after device detach

This prevents the kernel from crashing when a ugen(4) device is detached
while kqueue still holds a reference to that device.

Crash reported and fix tested by xavier.s on bugs@.

OK mpi@

22 months agodocument BIO_copy_next_retry(3)
schwarze [Mon, 19 Dec 2022 14:40:14 +0000 (14:40 +0000)]
document BIO_copy_next_retry(3)

22 months agoacme-client: fix copy-paste error in error message
tb [Mon, 19 Dec 2022 11:16:52 +0000 (11:16 +0000)]
acme-client: fix copy-paste error in error message

22 months agoRemove array reference from sh(1) because sh doesn't have arrays.
sdk [Mon, 19 Dec 2022 08:19:50 +0000 (08:19 +0000)]
Remove array reference from sh(1) because sh doesn't have arrays.
Reported with diff from Ross L Richardson

Agreed kn, OK jmc

22 months agoSay "discipline" not "dis" in comment, latter looks like typoed "disk"
kn [Mon, 19 Dec 2022 08:16:36 +0000 (08:16 +0000)]
Say "discipline" not "dis" in comment, latter looks like typoed "disk"

22 months agoAllow send-keys without a client again, reported by Stefan Hagen.
nicm [Mon, 19 Dec 2022 07:30:10 +0000 (07:30 +0000)]
Allow send-keys without a client again, reported by Stefan Hagen.

22 months agorework the synchronisation around suspend/resume.
dlg [Mon, 19 Dec 2022 04:48:07 +0000 (04:48 +0000)]
rework the synchronisation around suspend/resume.

the idea is that access to vmm from userland is gated by the vmm_softc
sc_status field, and then accounted for by the refcnt. you take a read
lock to check the gate, and if it is open then you can take a reference
and do your thing. once you've finished the work then you rele the
refcnt on the way out of the ioctl handler.

the suspend code takes a write lock to close the sc_status gate,
and then uses refcnt_finalise to wait for things in the ioctl handler
to get out.

on resume, the code takes the write lock, sets the refcnt up again for
userland to use, and then opens the gate.

tested by and ok dv@

22 months agomove pf_state_item and pf_state_key structs from pfvar.h to pfvar_priv.h.
dlg [Mon, 19 Dec 2022 04:35:33 +0000 (04:35 +0000)]
move pf_state_item and pf_state_key structs from pfvar.h to pfvar_priv.h.

both of these are kernel private data structures and do not need
to be visible to userland. moving them to pfvar_priv.h makes this
explicit, and makes it leass scary to tweak them in the future.

ok deraadt@ kn@ sashan@

22 months agoRevert previous: unintentionally included in commit
guenther [Mon, 19 Dec 2022 03:54:17 +0000 (03:54 +0000)]
Revert previous: unintentionally included in commit

22 months agoAdd pselect(2), recvmmsg(2), sendmmsg(2), and waitid(2) to the lists
guenther [Mon, 19 Dec 2022 03:49:42 +0000 (03:49 +0000)]
Add pselect(2), recvmmsg(2), sendmmsg(2), and waitid(2) to the lists
of built-in cancelation points.

22 months agowaitid(2) returns 0 on success; do post-call cancelation only if
guenther [Mon, 19 Dec 2022 03:40:20 +0000 (03:40 +0000)]
waitid(2) returns 0 on success; do post-call cancelation only if
it either failed, or succeeded but didn't put a status into infop.

ok millert@

22 months agoAdd WTRAPPED opiton for waitid(2) to control whether CMD_TRAPPED
guenther [Mon, 19 Dec 2022 00:22:11 +0000 (00:22 +0000)]
Add WTRAPPED opiton for waitid(2) to control whether CMD_TRAPPED
state changes are reported.  That's the 6th bit, so switch to hex
constants.  Adjust #if tests for consistency

ok kettenis@

22 months agospelling
deraadt [Sun, 18 Dec 2022 23:41:17 +0000 (23:41 +0000)]
spelling

22 months agodocument BIO_FLAGS_MEM_RDONLY
schwarze [Sun, 18 Dec 2022 22:27:10 +0000 (22:27 +0000)]
document BIO_FLAGS_MEM_RDONLY

22 months agodocument BIO_set_retry_read(3), BIO_set_retry_write(3),
schwarze [Sun, 18 Dec 2022 21:45:47 +0000 (21:45 +0000)]
document BIO_set_retry_read(3), BIO_set_retry_write(3),
BIO_set_retry_special(3), BIO_clear_retry_flags(3), BIO_get_retry_flags(3),
and the BIO_FLAGS_* constants

22 months agodocument the interaction with BIO_dup_chain(3)
schwarze [Sun, 18 Dec 2022 20:24:52 +0000 (20:24 +0000)]
document the interaction with BIO_dup_chain(3)

22 months agonew manual page BIO_dup_chain(3)
schwarze [Sun, 18 Dec 2022 19:35:36 +0000 (19:35 +0000)]
new manual page BIO_dup_chain(3)

22 months agocannot try the boot.data unmap until all the ld.script are commited, and
deraadt [Sun, 18 Dec 2022 19:33:11 +0000 (19:33 +0000)]
cannot try the boot.data unmap until all the ld.script are commited, and
fixed to identify the region correctly.

22 months agocorrect the prototypes of BIO_get_conn_ip(3) and BIO_get_conn_int_port(3);
schwarze [Sun, 18 Dec 2022 19:15:38 +0000 (19:15 +0000)]
correct the prototypes of BIO_get_conn_ip(3) and BIO_get_conn_int_port(3);
from Richard Levitte via OpenSSL commit 0e474b8b in the 1.1.1 branch,
which is still under a freee license

22 months agoUnify RSSI check
kn [Sun, 18 Dec 2022 18:56:38 +0000 (18:56 +0000)]
Unify RSSI check

Two spots in ifconfig print the signal strength, one for the "ieee80211: "
line and one for each SSID in scan output.

Only the former checks nr_rssi, which is not needed as nr_max_rssi alone
indicates whether the driver reports signal strength in percentage or dBm.

Zap the nr_rssi check to simplify;  "worst case" we display 0% or 0dBm
instead of nothing.

Feedback OK stsp

22 months agoadd Czechia as an alternative for Czech Republic
daniel [Sun, 18 Dec 2022 18:02:00 +0000 (18:02 +0000)]
add Czechia as an alternative for Czech Republic

22 months agoregen
daniel [Sun, 18 Dec 2022 17:42:56 +0000 (17:42 +0000)]
regen

22 months agoadd two transmeta devices
daniel [Sun, 18 Dec 2022 17:42:23 +0000 (17:42 +0000)]
add two transmeta devices

According to the "Efficeon BIOS Programmers Guide", the Efficeon
processor has a virtual north bridge that can communicate with the
south bridge over HyperTransport (device 0x0060) and with the
graphics controller over an AGP bridge (device 0x0061).

ok jsg@

22 months agodocument BIO_number_read(3) and BIO_number_written(3)
schwarze [Sun, 18 Dec 2022 17:40:55 +0000 (17:40 +0000)]
document BIO_number_read(3) and BIO_number_written(3)

22 months agoRevert previous as it doesn't create additional lo(4) anymore
kn [Sun, 18 Dec 2022 15:52:52 +0000 (15:52 +0000)]
Revert previous as it doesn't create additional lo(4) anymore

Reported by Andreas Bartelt on bugs@

22 months agoDo not save bootdev and boothowto when invalid value has passed.
aoyama [Sun, 18 Dec 2022 13:18:36 +0000 (13:18 +0000)]
Do not save bootdev and boothowto when invalid value has passed.

This occurs the kernel has booted from old boot loader or directly
booted by command line parameter on emulator.

Tested by LUNA-88K2 and nono emulator.

22 months agoPrevent detaching the boot volume
kn [Sun, 18 Dec 2022 13:10:08 +0000 (13:10 +0000)]
Prevent detaching the boot volume

bioctl(8)'s -d has no sanity checks and happily "deletes" any volume,
whether currently in use or not.

For now, refuse to detach the boot volume as a (too) simple safety guard,
until proper logic around mounted file systems on top is implemented.

Found the hard way through "bioctl -d sd1" with sd1 hosting /, after which
it took both fsck(8) and installboot(8) from a miniroot USB to recover.

regress/sys/dev/softraid also triggers it if root is on softraid.

OK claudio op jsing

22 months agonc: update regress after recent changes
tb [Sun, 18 Dec 2022 12:53:50 +0000 (12:53 +0000)]
nc: update regress after recent changes

22 months agonc: skip connection info on failed or skipped udptest()
tb [Sun, 18 Dec 2022 12:53:18 +0000 (12:53 +0000)]
nc: skip connection info on failed or skipped udptest()

In udp mode, nc would always print that the connected succeeded
independently of whether that was actually the case. Don't do that.

idea/ok mpf

22 months agonc: do not test the connection in non-interactive mode
tb [Sun, 18 Dec 2022 12:51:10 +0000 (12:51 +0000)]
nc: do not test the connection in non-interactive mode

The connection test writes four X to the socket, which corrupts data
that we may want to pipe into nc. So don't do that if stdin is not a
tty but still do it in scan mode, this is needed according to chris.

based on a diff by and ok mpf

22 months agonc: clean up and simplify connection_infO()
tb [Sun, 18 Dec 2022 12:48:28 +0000 (12:48 +0000)]
nc: clean up and simplify connection_infO()

ok mpf as part of a larger diff

22 months agonc: pass protocol name to connection_info()
tb [Sun, 18 Dec 2022 12:47:31 +0000 (12:47 +0000)]
nc: pass protocol name to connection_info()

Avoids repeated use of ternary operator on globals.

22 months agonc: factor printing of connection info into a function
tb [Sun, 18 Dec 2022 12:45:34 +0000 (12:45 +0000)]
nc: factor printing of connection info into a function

This simply moves a chunk of code in this spaghetti mess into its own
function with minimal changes.

idea from a diff by mpf

22 months agoacme-client: rename cc to sign_len in op_sign()
tb [Sun, 18 Dec 2022 12:39:59 +0000 (12:39 +0000)]
acme-client: rename cc to sign_len in op_sign()

requested by jsing

22 months agoacme-client: fix openssl includes in acctproc.c
tb [Sun, 18 Dec 2022 12:35:26 +0000 (12:35 +0000)]
acme-client: fix openssl includes in acctproc.c

We don't do PEM or random in here, but we use BN, EC, ECDSA, so include
the relevant headers. errno.h was also missing.

22 months agoacme-client: check EC signature length
tb [Sun, 18 Dec 2022 12:31:57 +0000 (12:31 +0000)]
acme-client: check EC signature length

Make sure the size_t containing EC signature length is not truncated
when passing it to d2i_ECDSA_SIG() as a long. This won't happen, but
documents API quirks...

requested by jsing

22 months agoacme-client: simplify elliptic curve signatures
tb [Sun, 18 Dec 2022 12:27:58 +0000 (12:27 +0000)]
acme-client: simplify elliptic curve signatures

We can get the correct size of the signature using EVP_PKEY_bits() which
uses the order instead of the (strictly speaking incorrect) degree. Grab
the (r, s) out of the ECDSA signature with ECDSA_SIG_get0_{r,s}(), which
is a saner interface than EVP_SIG_get0(). Finally, do the zero padding
using BN_bn2binpad() which is simpler than the currently rather fiddly
solution.

ok jsing

22 months agoacme-client: switch op_sign() to EVP_DigestSign()
tb [Sun, 18 Dec 2022 12:22:30 +0000 (12:22 +0000)]
acme-client: switch op_sign() to EVP_DigestSign()

EVP_DigestSign() is a bit more ergonomic than the old EVP_Sign* family,
it takes size_t instead of int and and it also allows allocating the
memory needed instead of relying on some weird estimate. This again gets
rid of a few stupid else if.

ok jsing

22 months agoacme-client: simplify op_thumbprint()
tb [Sun, 18 Dec 2022 12:13:11 +0000 (12:13 +0000)]
acme-client: simplify op_thumbprint()

We can EVP_Digest() into an array on the stack rather than doing a long
dance and song with lots of ugly else if.

ok jsing

22 months agoacme-client: inline a confusing and useless define
tb [Sun, 18 Dec 2022 12:08:49 +0000 (12:08 +0000)]
acme-client: inline a confusing and useless define

22 months agoacme-client: encode unexpected SANs before printing
tb [Sun, 18 Dec 2022 12:04:55 +0000 (12:04 +0000)]
acme-client: encode unexpected SANs before printing

If a SAN isn't configured, it could be anything, so make printing it safe
using strvisx(). If it is configured but duplicate, printing it should be
fine, so don't bother. This removes two XXX added in the previous commit.

ok florian