openbsd
2 years agoDo not allow send/receive of kcov descriptors as the file descriptor can
anton [Wed, 29 Dec 2021 07:15:13 +0000 (07:15 +0000)]
Do not allow send/receive of kcov descriptors as the file descriptor can
be kept alive longer than expected causing syzkaller to no longer being
able to enable remote coverage.

ok visa@

Reported-by: syzbot+ab2016d729cda7b0d003@syzkaller.appspotmail.com
2 years agoTweak some DEBUG output.
krw [Wed, 29 Dec 2021 00:04:45 +0000 (00:04 +0000)]
Tweak some DEBUG output.

Always put '0x' prefix in front of displayed hex values,
i.e. the checksums.

Add missing letoh32() so bad endian checksum is clear.

Be consistent when displaying 'expected' and 'got' checksums,
i.e. 'expected' == calculated checksum and 'got' == checksum
found in GPT.

2 years agoAdd unp_dispose() threads to 'unsopassgc' test.
mvs [Wed, 29 Dec 2021 00:04:35 +0000 (00:04 +0000)]
Add unp_dispose() threads to 'unsopassgc' test.

2 years agoTweak some DEBUG output.
krw [Tue, 28 Dec 2021 23:44:02 +0000 (23:44 +0000)]
Tweak some DEBUG output.

'EFI PART' reads better than "TRAP IFE" and
checksums are easier to read/compare when shown
in hex rather than decimal.

Prompted by recent GPT vs disklabel misc@ thread
concerning  Rob Whitlock's problematic GPT.

2 years agowhitespace tweak, no functional change.
dlg [Tue, 28 Dec 2021 23:13:20 +0000 (23:13 +0000)]
whitespace tweak, no functional change.

2 years agoit doesnt make sense to configure a vport as a span port.
dlg [Tue, 28 Dec 2021 23:10:58 +0000 (23:10 +0000)]
it doesnt make sense to configure a vport as a span port.

2 years agomove away from using the M_PROTO1 flag to prevent loops with vports
dlg [Tue, 28 Dec 2021 23:10:30 +0000 (23:10 +0000)]
move away from using the M_PROTO1 flag to prevent loops with vports

if a vlan interface is configured on a vport interface, vlan(4)
will take the packet away from ether_input before the veb bridge
input handler gets to clear M_PROTO1. this leaves the flag on the
mbuf as it goes through the l3 stacks. if it goes back out a vport
into a veb, the presence of M_PROTO1 means the packet ends up getting
dropped, which is unexpected.

this diff specialises vport handling by veb even more to avoid the
problem the flag was handling. vports get their own bridge input
handler that skips veb processing completely because a packet being
received on a vport can only occur if a veb has decided to forward
it there and has already processed it. when the stack sends a packet
out a vport interface, then we do actual veb bridge input handling.

bug reported on misc@ and the fix tested by Simon Baker

2 years agoFix typo in comment
tb [Tue, 28 Dec 2021 21:23:40 +0000 (21:23 +0000)]
Fix typo in comment

2 years agolld: restore upstream default for --[no-]allow-shlib-undefined
naddy [Tue, 28 Dec 2021 21:14:24 +0000 (21:14 +0000)]
lld: restore upstream default for --[no-]allow-shlib-undefined

ok patrick@ kettenis@

2 years agolld: do not report undefined weak references in shared libraries
naddy [Tue, 28 Dec 2021 21:13:20 +0000 (21:13 +0000)]
lld: do not report undefined weak references in shared libraries

https://github.com/llvm/llvm-project/commit/52bfd2c1ccd86ff813ee6df5a6700690acdd912f

This fixes an issue introduced in D101996.

A weak reference in a shared library could be incorrectly reported if
there is another library that has a strong reference to the same symbol.

Differential Revision: https://reviews.llvm.org/D115041

ok patrick@ kettenis@

2 years agoUse lowercase letters for hexadecimal constants, as both jsing and I
tb [Tue, 28 Dec 2021 21:06:01 +0000 (21:06 +0000)]
Use lowercase letters for hexadecimal constants, as both jsing and I
prefer this.

2 years agoRewrite X509v3_addr_canonize() with new accessors
tb [Tue, 28 Dec 2021 21:00:27 +0000 (21:00 +0000)]
Rewrite X509v3_addr_canonize() with new accessors

This is again a straightforward conversion and leads to something which
matches our usual style more.

ok jsing

2 years agoValidate AFIs before sorting in X509v3_adr_canonize()
tb [Tue, 28 Dec 2021 20:58:05 +0000 (20:58 +0000)]
Validate AFIs before sorting in X509v3_adr_canonize()

Again, we're dealing with necessarily not fully validated data here,
so a check up front seems prudent.

ok jsing

2 years agoRewrite/simplify X509v3_addr_is_canonical()
tb [Tue, 28 Dec 2021 20:50:37 +0000 (20:50 +0000)]
Rewrite/simplify X509v3_addr_is_canonical()

This is a more or less straightforward conversion using the new
IPAddressFamily accessor API. As a result, some checks have become
a bit stricter, which is only desirable here.

ok jsing

2 years agoCheck AFI/SAFI before comparing them in X509v3_addr_is_canonical()
tb [Tue, 28 Dec 2021 20:44:56 +0000 (20:44 +0000)]
Check AFI/SAFI before comparing them in X509v3_addr_is_canonical()

As mentioned in a previous commit, IPAddressFamily_cmp() can't really
check for trailing garbage in addressFamily->data. Since the path
validation and hence the X.509 validator call X509v3_addr_is_canonical(),
this deals with only partially validated data.

ok jsing

2 years agoMake IPAddressFamily_cmp() more pleasing on the eye
tb [Tue, 28 Dec 2021 20:07:17 +0000 (20:07 +0000)]
Make IPAddressFamily_cmp() more pleasing on the eye

Define and use MINIMUM() instead of a ternary operator and separate
the code from the declarations. Also, we can spare a line to make the
return legible instead of squeezing it into another ternary operator.

addressFamily->data contains a two-bytes AFI and an optional one-byte
SAFI.  This function currently also compares any trailing garbage that
may be present. Since comparison functions can't really error, this
needs to be checked bofore it is used. Such checks will be added in
subsequent commits.

ok jsing

2 years agoStyle improvements in X509v3_addr_add_range()
tb [Tue, 28 Dec 2021 19:59:33 +0000 (19:59 +0000)]
Style improvements in X509v3_addr_add_range()

ok jsing

2 years agoStyle improvements in X509v3_addr_add_prefix()
tb [Tue, 28 Dec 2021 19:56:45 +0000 (19:56 +0000)]
Style improvements in X509v3_addr_add_prefix()

ok jsing

2 years agoThe initial kd_lookup() in kcovopen() is redundant as kcov is a cloning
anton [Tue, 28 Dec 2021 17:50:10 +0000 (17:50 +0000)]
The initial kd_lookup() in kcovopen() is redundant as kcov is a cloning
device. Turn it into an assertion instead to better state the expected
semantics of D_CLONE.

Prompted after a discussion with visa@

2 years agoAnother small readability tweak in X509v3_addr_inherits()
tb [Tue, 28 Dec 2021 17:45:41 +0000 (17:45 +0000)]
Another small readability tweak in X509v3_addr_inherits()

Declare IPAddressFamily before using it.

2 years agoUse an accessor in X509v3_addr_inherits()
tb [Tue, 28 Dec 2021 17:25:46 +0000 (17:25 +0000)]
Use an accessor in X509v3_addr_inherits()

2 years agoAdd a comment to i2r_IPAddrBlocks that we may want/have to deal with
tb [Tue, 28 Dec 2021 16:40:13 +0000 (16:40 +0000)]
Add a comment to i2r_IPAddrBlocks that we may want/have to deal with
unknown address family types.

Pointed out by jsing during review.

2 years agoAdd a few accessors for IPAddressFamily and make first use of them
tb [Tue, 28 Dec 2021 16:37:37 +0000 (16:37 +0000)]
Add a few accessors for IPAddressFamily and make first use of them

One reason why this file is hard to read are endless repetitions of
checks and assignments reaching deep inside structs. This can be made
much more readable by adding a bunch of accessors. As a first step,
we deal with IPAddressFamily, where we want to check the type of the
ipAddressChoice member, check whether the inheritance element is present
or access the addressOrRanges field.

This diff already makes minimal use of these accessors to appease -Werror.
More use and additional accessors will follow in later passes.

ok inoguchi jsing

2 years agoNow that -A prints -- markers as it is supposed to filter them out when
otto [Tue, 28 Dec 2021 16:29:59 +0000 (16:29 +0000)]
Now that -A prints -- markers as it is supposed to filter them out when
doing the consistency check for locore.o; ok millert@

2 years agoFix printing of -- marker when using -A as noted by gnezdo@
otto [Tue, 28 Dec 2021 16:27:53 +0000 (16:27 +0000)]
Fix printing of -- marker when using -A as noted by gnezdo@
ok millert@

2 years agoSimplify and explain expand_addr() a bit
tb [Tue, 28 Dec 2021 16:26:53 +0000 (16:26 +0000)]
Simplify and explain expand_addr() a bit

RFC 3779 section 2.1.2 does a decent job of explaining how IP addresses
are encoded in. What's stored amounts to a prefix with all trailing zero
octets omitted. If there are trailing zero bits in the last non-zero octet,
bs->flags & 7 indicates how many. addr_expand() expands this to an address
of length 4 or 16 depending on whether we deal with IPv4 or IPv6.

Since an address can be the lower or the upper bound of a prefix or
address range, expansion needs to be able to zero-fill or one-fill the
unused bits/octets. No other expansion is ever used, so simplify the
meaning of fill accordingly. There's no need to special case the case
that there are no unused bits, the masking/filling is a noop.

ok jsing

2 years agoAdd a comment so I don't forget to think about input validation
tb [Tue, 28 Dec 2021 16:21:59 +0000 (16:21 +0000)]
Add a comment so I don't forget to think about input validation
in make_IPAddressFamily()

2 years agoConvert make_IPAddressFamily to CBS/CBB
tb [Tue, 28 Dec 2021 16:10:47 +0000 (16:10 +0000)]
Convert make_IPAddressFamily to CBS/CBB

The IPAddrBlocks type, which represents the IPAddrBlocks extension,
should have exactly one IPAddressFamily per AFI+SAFI combination to
be delegated. make_IPAddressFamily() first builds up a search key
from the afi and safi arguments and then looks for an existing
IPAddressFamily with that key in the IPAddrBlocks that was passed
in. It returns that if it finds it or allocates and adds a new one.

This diff preserves the current behavior that the afi and *safi
arguments are truncated to 2 and 1 bytes, respectively. This may
change in the future.

ok inoguchi jsing

2 years agoRemove two pointless NULL checks and allocations
tb [Tue, 28 Dec 2021 16:05:23 +0000 (16:05 +0000)]
Remove two pointless NULL checks and allocations

The ASN.1 template for IPAddressFamily doesn't mark either of its two
members as optional, so they are allocated by IPAddressFamily_new().

ok inoguchi jsing

2 years agoCheck for trailing garbage in X509_addr_get_afi()
tb [Tue, 28 Dec 2021 15:59:13 +0000 (15:59 +0000)]
Check for trailing garbage in X509_addr_get_afi()

Per RFC 3779 2.2.3.3, the addressFamily field contains the 2-byte AFI
and an optional 1-byte SAFI. Nothing else. The optional SAFI is nowhere
exposed in the API. It is used expliclty only for pretty printing. There
are implicit uses in a few places, notably for sorting/comparing where
trailing garbage would be erroneously taken into account.

Erroring in this situation will let us avoid this in upcoming revisions.

ok inoguchi jsing

2 years agoConvert X509v3_adr_get_afi() to CBS
tb [Tue, 28 Dec 2021 15:49:11 +0000 (15:49 +0000)]
Convert X509v3_adr_get_afi() to CBS

The manual byte bashing is performed more safely using this API
which would have avoided the out-of-bounds read that this API had
until a few years back.

The API is somewhat strange in that it uses the reserved AFI 0 as an
in-band error but it doesn't care about the reserved AFI 65535.

ok inoguchi jsing

2 years agoCompile out-of-line helpers for atomic operations which can be enabled
patrick [Tue, 28 Dec 2021 15:45:17 +0000 (15:45 +0000)]
Compile out-of-line helpers for atomic operations which can be enabled
through -moutline-atomics.  These are included by default in this updated
version of compiler-rt, we just haven't enabled them yet.  Some ports start
to make use of that option, so it makes sense to provide these helpers.

The helpers would make use of the ARMv8.1 LSE instructions, if we flagged
that the running system supports those.  As we do not yet have a mechanism
to show support for LSE, the code will always fall back to regular atomics.

Issue raised by jca@
Tested by phessler@
Input from jsg@
ok kettenis@

2 years agoUnlock bottom part of the fault handler.
mpi [Tue, 28 Dec 2021 13:16:28 +0000 (13:16 +0000)]
Unlock bottom part of the fault handler.

Tested by many during the past months, thanks!

ok sthen@

2 years agoIn io_write_buf() adjust the calculation of the multiplex message size
claudio [Tue, 28 Dec 2021 11:59:48 +0000 (11:59 +0000)]
In io_write_buf() adjust the calculation of the multiplex message size
so that the loop works even for buffers bigger than 0xffffff. The code
does not produce such big buffers but better make the code correct.
Reported by Blago Dachev (blago (at) dachev (dot) com)
OK benno@

2 years agoNot only BCM4378, but all PCIe core revisions >= 64 need to be accessed
patrick [Mon, 27 Dec 2021 17:56:03 +0000 (17:56 +0000)]
Not only BCM4378, but all PCIe core revisions >= 64 need to be accessed
using the new sets of registers.

2 years agoMap the chip ids used on Apple M1 Pro/Max and Apple T2 Macs to firmware
patrick [Mon, 27 Dec 2021 17:32:14 +0000 (17:32 +0000)]
Map the chip ids used on Apple M1 Pro/Max and Apple T2 Macs to firmware
names.

2 years agoSupport reading OTP information from a few more chips, necessary to learn
patrick [Mon, 27 Dec 2021 17:12:34 +0000 (17:12 +0000)]
Support reading OTP information from a few more chips, necessary to learn
firmare names on Apple M1 Pro/Max and Apple T2 Macs.

2 years agoReduce sensitivity to TCP segmentation in urgent data test case
visa [Mon, 27 Dec 2021 16:38:06 +0000 (16:38 +0000)]
Reduce sensitivity to TCP segmentation in urgent data test case

Use one-byte sequences before and after urgent data so that the
socket-tcp test would be less sensitive to TCP segmentation.

2 years agoDisable poll/select iocond regress
visa [Mon, 27 Dec 2021 16:20:20 +0000 (16:20 +0000)]
Disable poll/select iocond regress

Some of the tests are unreliable because of inadequate synchronization
in the test code.

2 years agoYet another errno correction.
anton [Mon, 27 Dec 2021 15:38:25 +0000 (15:38 +0000)]
Yet another errno correction.

2 years agoknf
florian [Mon, 27 Dec 2021 15:18:51 +0000 (15:18 +0000)]
knf

2 years agoPull BN_{new,init,clear,clear_free,free} up to the top of bn_lib.c
jsing [Mon, 27 Dec 2021 15:12:22 +0000 (15:12 +0000)]
Pull BN_{new,init,clear,clear_free,free} up to the top of bn_lib.c

Discussed with tb@

2 years agoProvide a set of RSA and ECDSA test certificates/keys.
jsing [Mon, 27 Dec 2021 14:50:57 +0000 (14:50 +0000)]
Provide a set of RSA and ECDSA test certificates/keys.

These are generated using the make-certs.sh script.

2 years agoProvide a script to generate test certificates/keys.
jsing [Mon, 27 Dec 2021 14:40:16 +0000 (14:40 +0000)]
Provide a script to generate test certificates/keys.

This will allow us to generate a variety of client and server certificates,
including expired and revoked certificates, using both RSA and ECDSA.

Discussed with tb@

2 years agoFix off-by-one in blob download, where in the case that the blob is evenly
patrick [Mon, 27 Dec 2021 14:31:15 +0000 (14:31 +0000)]
Fix off-by-one in blob download, where in the case that the blob is evenly
divisible by 1400, the last chunk isn't marked with an end flag.

ok tobhe@

2 years agoMake clear that poll_iocond pty test fails currently.
visa [Mon, 27 Dec 2021 14:29:54 +0000 (14:29 +0000)]
Make clear that poll_iocond pty test fails currently.

Prompted by anton@

2 years agoBCM4387 needs the D11 cores to be held in reset by us, the firmware
patrick [Mon, 27 Dec 2021 14:28:13 +0000 (14:28 +0000)]
BCM4387 needs the D11 cores to be held in reset by us, the firmware
will take care of releasing them, as otherwise initialization would
fail some of the time.  That chip also contains 3 of these, so make
sure we reset all of them.  Necessary on Apple M1 Pro/Max.

2 years agoSend TxCap and WiFi calibration blobs to the chip.
patrick [Mon, 27 Dec 2021 13:54:39 +0000 (13:54 +0000)]
Send TxCap and WiFi calibration blobs to the chip.

2 years agoSwitch module codename retrieval to use the newly proposed device tree
patrick [Mon, 27 Dec 2021 12:03:59 +0000 (12:03 +0000)]
Switch module codename retrieval to use the newly proposed device tree
bindings.

2 years agoHandle trailing odd-sized 1024 byte blocks when calculating TCM RAM size.
patrick [Mon, 27 Dec 2021 10:59:20 +0000 (10:59 +0000)]
Handle trailing odd-sized 1024 byte blocks when calculating TCM RAM size.

2 years agoBump rxpost and rxcomplete ring size to 1024 for newer chips.
patrick [Mon, 27 Dec 2021 10:56:55 +0000 (10:56 +0000)]
Bump rxpost and rxcomplete ring size to 1024 for newer chips.

2 years agoRework garbage collector for unix(4) sockets.
mvs [Sun, 26 Dec 2021 23:41:41 +0000 (23:41 +0000)]
Rework garbage collector for unix(4) sockets.

This time unix(4) sockets garbage collector always destroys any socket
with positive "fp->f_count == unp->unp_msgcount" equation. This is wrong
because unix(4) sockets within SCM_RIGHTS message but closed on sender
side also have this equation positive. Such sockets are not in the loop,
and if garbage collector kill them before they are received, we get
kernel panic.

FreeBSD already has garbage collector reworked to fix this issue [1]. The
logic is pretty simple so import it to our garbage collector.

1. https://reviews.freebsd.org/D23142

ok bluhm@

2 years agosplit method list search functionality from authmethod_lookup() into
djm [Sun, 26 Dec 2021 23:34:41 +0000 (23:34 +0000)]
split method list search functionality from authmethod_lookup() into
a separate authmethod_byname(), for cases where we don't need to
check whether a method is enabled, etc.

use this to fix the "none" authentication method regression reported
by Nam Nguyen via bugs@

ok deraadt@

2 years agoAdd information about TCM rambase and how to check the SR capability for
patrick [Sun, 26 Dec 2021 20:50:17 +0000 (20:50 +0000)]
Add information about TCM rambase and how to check the SR capability for
a few more chips.

2 years agozap doubled semicolon
tb [Sun, 26 Dec 2021 15:44:29 +0000 (15:44 +0000)]
zap doubled semicolon

2 years agoCheck BIO_indent() return like all the others in this file.
tb [Sun, 26 Dec 2021 15:38:49 +0000 (15:38 +0000)]
Check BIO_indent() return like all the others in this file.

CID 345118

2 years agoCheck error returns for HMAC_* to appease coverity.
tb [Sun, 26 Dec 2021 15:34:26 +0000 (15:34 +0000)]
Check error returns for HMAC_* to appease coverity.

CID 345114

2 years agoOne more leak similar to previous.
tb [Sun, 26 Dec 2021 15:31:24 +0000 (15:31 +0000)]
One more leak similar to previous.

2 years agoPlug leaks
tb [Sun, 26 Dec 2021 15:28:37 +0000 (15:28 +0000)]
Plug leaks

CID 345111

2 years agoPlug memleak
tb [Sun, 26 Dec 2021 15:23:37 +0000 (15:23 +0000)]
Plug memleak

CID 345119

2 years agoDrop pointless cast in i2d_ASN1_BOOLEAN(). This may or may not fix
tb [Sun, 26 Dec 2021 15:20:21 +0000 (15:20 +0000)]
Drop pointless cast in i2d_ASN1_BOOLEAN().  This may or may not fix
a weird coverity warning.

CID 345121

ok jsing

2 years agoConsistently call BN_init() before BN_with_flags()
tb [Sun, 26 Dec 2021 15:16:50 +0000 (15:16 +0000)]
Consistently call BN_init() before BN_with_flags()

BN_with_flags() preserves the BN_FLG_MALLOCED flag of the destination
which results in a potential use of an uninitialized bit. In practice
this doesn't matter since we don't free the cloned BIGNUMs anyway.

As jsing points out, these are mostly pointless noise and should be
garbage collected. I'll leave that for another rainy day.

Coverity flagged one instance BN_gcd_no_branch(), the rest was found by
the ever so helpful grep(1).

CID 345122

ok jsing

2 years agoHoist memset of CBB above EVP_MD_CTX_new() and HMAC_CTX_new() to avoid
tb [Sun, 26 Dec 2021 15:10:59 +0000 (15:10 +0000)]
Hoist memset of CBB above EVP_MD_CTX_new() and HMAC_CTX_new() to avoid
a use of uninitialized in the unlikely event that either of them fails.
Problem introduced in r1.128.

CID 345113

ok jsing

2 years agoCorrect SSL_get_peer_cert_chain() when used with the TLSv1.3 stack.
jsing [Sun, 26 Dec 2021 14:59:52 +0000 (14:59 +0000)]
Correct SSL_get_peer_cert_chain() when used with the TLSv1.3 stack.

Due to a wonderful API inconsistency, a client includes the peer's leaf
certificate in the stored certificate chain, while a server does not.

Found due to a haproxy test failure reported by Ilya Shipitsin.

ok tb@

2 years agoAttempt to opportunistically use the host name for SNI in s_client.
jsing [Sun, 26 Dec 2021 14:46:06 +0000 (14:46 +0000)]
Attempt to opportunistically use the host name for SNI in s_client.

ok beck@ inoguchi@ tb@

2 years agoDIOCHANGERRULE ioctl must set pointer to ruleset in rule it inserts.
sashan [Sun, 26 Dec 2021 14:04:29 +0000 (14:04 +0000)]
DIOCHANGERRULE ioctl must set pointer to ruleset in rule it inserts.

Reported-by: syzbot+7718c5f69c595f76b298@syzkaller.appspotmail.com
OK bluhm@, OK jmatthew@

2 years agoAdd address locators for the ACPI "bus" and use these to fix the order of
kettenis [Sun, 26 Dec 2021 13:55:36 +0000 (13:55 +0000)]
Add address locators for the ACPI "bus" and use these to fix the order of
the com(4) devices to match the traditional order one the ISA bus.

ok patrick@, anton@

2 years agoFix compiler warnings with sparc64 gcc 4.2.1.
bluhm [Sun, 26 Dec 2021 13:32:05 +0000 (13:32 +0000)]
Fix compiler warnings with sparc64 gcc 4.2.1.

2 years agofix spelling of inheritance
tb [Sun, 26 Dec 2021 12:32:28 +0000 (12:32 +0000)]
fix spelling of inheritance

2 years agoCheck ipAddrBlock and autonomousSysNum for criticality
tb [Sun, 26 Dec 2021 12:30:11 +0000 (12:30 +0000)]
Check ipAddrBlock and autonomousSysNum for criticality

These extensions MUST be marked critical. Criticality is determined by the
ASN1_BOOLEAN that is extracted and ignored after the FIXME a few lines
below each of the two hunks. Rather than getting the info from there, it's
easier to use an API call that checks what was already parsed by d2i_X509().

ok claudio job

2 years agoadd missing include path; ok tb@
anton [Sun, 26 Dec 2021 08:37:21 +0000 (08:37 +0000)]
add missing include path; ok tb@

2 years agoFix unexpanded LOCALBASE and X11BASE
kn [Sun, 26 Dec 2021 02:53:17 +0000 (02:53 +0000)]
Fix unexpanded LOCALBASE and X11BASE

Hardcode them like the script does;  nothing does SUBST_* here
as is practise in ports land.

OK gnezdo

2 years agomake 'set skip on ...' in pf.conf dynamic
sashan [Sun, 26 Dec 2021 01:00:32 +0000 (01:00 +0000)]
make 'set skip on ...' in pf.conf dynamic

This is an old issue in pf(4): whenever new interface appears
in IP stack, we must reload pf.conf to apply 'set skip on ...'
to newly plumbed network interfaces. Time has come to fix it.
The idea is to also create pfi_kif for interfaces, which are
referred by 'set skip on ...'. Such pfi_kif instances are
created/destroyed by pfi_set_flags()/pfi_clear_flags().

claudio@ dragged my attention to this in Gouveia. Also his
feedback helped me to put change into shape.

OK claudio@

2 years agoFix some weird line wrapping and a minor KNF nit
tb [Sat, 25 Dec 2021 23:35:25 +0000 (23:35 +0000)]
Fix some weird line wrapping and a minor KNF nit

2 years agoreword some old text mentioning openbsd 5.5 and windows 7; ok deraadt
tj [Sat, 25 Dec 2021 17:26:13 +0000 (17:26 +0000)]
reword some old text mentioning openbsd 5.5 and windows 7; ok deraadt

2 years agoDon't accept an empty string as selector value
ratchov [Sat, 25 Dec 2021 16:25:07 +0000 (16:25 +0000)]
Don't accept an empty string as selector value

"looks good" edd@

2 years agoMove example about USB devices from -F description to hot plugging section
ratchov [Sat, 25 Dec 2021 16:15:53 +0000 (16:15 +0000)]
Move example about USB devices from -F description to hot plugging section

ok kn

2 years agoNo need for assert.h in here.
tb [Sat, 25 Dec 2021 15:46:05 +0000 (15:46 +0000)]
No need for assert.h in here.

2 years agodrop a meaningless XXX
tb [Sat, 25 Dec 2021 15:43:13 +0000 (15:43 +0000)]
drop a meaningless XXX

2 years agoUse C99 initializers for v3_addr, v3_asid and v3_ct_scts[]
tb [Sat, 25 Dec 2021 15:42:32 +0000 (15:42 +0000)]
Use C99 initializers for v3_addr, v3_asid and v3_ct_scts[]
as is done for most other X.509 v3 extension methods.

discussed with jsing

2 years agoAdd section to explain how to handle device hot plugging
ratchov [Sat, 25 Dec 2021 15:24:02 +0000 (15:24 +0000)]
Add section to explain how to handle device hot plugging

mostly from kn@, tweaks from me

2 years agoFor a long time ip_ours() and ip6_ours() are calling ip_deliver()
bluhm [Sat, 25 Dec 2021 13:35:17 +0000 (13:35 +0000)]
For a long time ip_ours() and ip6_ours() are calling ip_deliver()
without kernel lock.  Unlock the two callers in ip6_input_if() that
have been forgotten.
OK mvs@ kn@

2 years agoIndent goto labels for diffability.
jsing [Sat, 25 Dec 2021 13:17:48 +0000 (13:17 +0000)]
Indent goto labels for diffability.

Whitespace change only.

2 years agoMerge asn_pack.c into asn1_item.c - these are two ASN1_item_* functions.
jsing [Sat, 25 Dec 2021 12:21:36 +0000 (12:21 +0000)]
Merge asn_pack.c into asn1_item.c - these are two ASN1_item_* functions.

No functional change.

2 years agoMerge evp_asn1.c into a_type.c - these are all ASN1_TYPE_* functions.
jsing [Sat, 25 Dec 2021 12:19:16 +0000 (12:19 +0000)]
Merge evp_asn1.c into a_type.c - these are all ASN1_TYPE_* functions.

No functional change.

2 years agoMove more ASN1_STRING_* functions to a_string.c.
jsing [Sat, 25 Dec 2021 12:11:57 +0000 (12:11 +0000)]
Move more ASN1_STRING_* functions to a_string.c.

No functional change.

2 years agoMore consolidation of ASN.1 code.
jsing [Sat, 25 Dec 2021 12:00:22 +0000 (12:00 +0000)]
More consolidation of ASN.1 code.

Consolidate various ASN1_item_* functions into asn1_item.c and the
remaining NO_OLD_ASN1 code (not to be confused with the NO_ASN1_OLD code)
into asn1_old.c. This is preferable to having many files, often with one
or two functions per file.

No functional change.

Discussed with tb@

2 years agoAdjust pty case for kqueue-based poll(2)
visa [Sat, 25 Dec 2021 11:27:19 +0000 (11:27 +0000)]
Adjust pty case for kqueue-based poll(2)

Unlike the old code, kqueue-based poll(2) sets POLLIN when the other
end of a pty has been closed. Calling read(2) on such a pty returns
zero anyway. FreeBSD sets POLLIN too.

2 years agokqueue: Invalidate revoked vnodes' knotes on the fly
visa [Sat, 25 Dec 2021 11:04:58 +0000 (11:04 +0000)]
kqueue: Invalidate revoked vnodes' knotes on the fly

When a tty device is revoked, the associated knotes should be
invalidated. Otherwise the user processes can keep on receiving
events from the device.

It appears tricky to do the invalidation as part of revocation
in a way that does not allow unwanted event registration or clutter
the tty code. For now, make the knotes invalid lazily before delivery.

OK mpi@

2 years agoConsolidate code/templates for ASN.1 types.
jsing [Sat, 25 Dec 2021 08:52:44 +0000 (08:52 +0000)]
Consolidate code/templates for ASN.1 types.

Where an ASN.1 type has its own file, move the ASN.1 item template and
template related functions into the file.

Discussed with tb@

2 years agoMove ASN1_<type>_* functions to the top, encoding/decoding to the bottom.
jsing [Sat, 25 Dec 2021 07:48:09 +0000 (07:48 +0000)]
Move ASN1_<type>_* functions to the top, encoding/decoding to the bottom.

No functional change.

2 years agoRewrite ASN.1 identifier/length parsing in CBS.
jsing [Sat, 25 Dec 2021 07:04:03 +0000 (07:04 +0000)]
Rewrite ASN.1 identifier/length parsing in CBS.

Provide internal asn1_get_identifier_cbs() and asn1_get_length_cbs()
functions that are called from asn1_get_object_cbs(). Convert the existing
ASN1_get_object() function so that it calls asn1_get_object_cbs(), before
mapping the result into the API that it implements.

ok tb@

2 years agosync
deraadt [Sat, 25 Dec 2021 02:50:51 +0000 (02:50 +0000)]
sync

2 years agoSync DF_1_* flag definitions with llvm 13, including support in
guenther [Sat, 25 Dec 2021 01:25:51 +0000 (01:25 +0000)]
Sync DF_1_* flag definitions with llvm 13, including support in
readelf -d for displaying them.
(lld 13 sets DF_1_PIE on most our binaries)

ok jsg@

2 years agoUpdate to reflect changes over the last six years
guenther [Sat, 25 Dec 2021 01:13:44 +0000 (01:13 +0000)]
Update to reflect changes over the last six years

2 years agoFilter out all symbols starting with a double underbar. In particular,
tb [Fri, 24 Dec 2021 23:01:56 +0000 (23:01 +0000)]
Filter out all symbols starting with a double underbar.  In particular,
this filters out all retguard symbols, which are no fun to guess. One
recognizes them easily but can get yourself hanged by a single digit!

An earlier version filtering only __retguard symbols was

ok deraadt, jsing

guenther agreed that filtering all double underbar symbols makes sense.
He also suggested to filter out symbols containing several consecutive
digits, but how much fun is guessing libcrypto symbols without all the
X509 goodness?

2 years agowhen getopts prints "unknown option" or "requires argument", it should
deraadt [Fri, 24 Dec 2021 22:08:37 +0000 (22:08 +0000)]
when getopts prints "unknown option" or "requires argument", it should
not print the shell script line number where this occured.  Doing so is
pointless, or an information leak.
This change does not affect any other error reporting.
ok millert

2 years agosync
deraadt [Fri, 24 Dec 2021 20:10:23 +0000 (20:10 +0000)]
sync

2 years agouniq(1): skip() each input line only once
cheloha [Fri, 24 Dec 2021 17:59:28 +0000 (17:59 +0000)]
uniq(1): skip() each input line only once

In uniq(1), skip() is very expensive.  We should only do it once per
input line.  Doing it more than once is redundant, anyway.

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

ok millert@

2 years agoRun malloc_duel for 60 seconds instead of 20. It did find kernel
bluhm [Fri, 24 Dec 2021 15:09:10 +0000 (15:09 +0000)]
Run malloc_duel for 60 seconds instead of 20.  It did find kernel
crashes due to missing TLB flushes in the past.  Other stress tests
in regress also run for a minute.  Additional 40 seconds to the run
time of the test suite is a small price compared to higher chance
of finding bugs.