openbsd
2 years agolet pfattach() to also initialize pf_default_rule_new to avoid
sashan [Wed, 9 Feb 2022 11:42:58 +0000 (11:42 +0000)]
let pfattach() to also initialize pf_default_rule_new to avoid
div-by-zero in pf_purge()

Reported-by: syzbot+e720e3bab51366d7b667@syzkaller.appspotmail.com
OK deraadt@

2 years agoenable hw vlan tag handling in the rx path too.
dlg [Wed, 9 Feb 2022 11:12:21 +0000 (11:12 +0000)]
enable hw vlan tag handling in the rx path too.

also tested on both x86 and sparc64.

2 years agoAdd iic_is_compatible() for matching I2C devices
visa [Wed, 9 Feb 2022 07:58:24 +0000 (07:58 +0000)]
Add iic_is_compatible() for matching I2C devices

When using device trees, the ia_name field of struct i2c_attach_args
points to the first string of the device node's "compatible" array.
However, in many cases it would be preferable to use the last, most
general "compatible" entry as a device matching criterion.

Enable more flexible device matching by permitting ia_name to point to
the raw "compatible" data which is a concatenation of NUL-terminated
strings. I2C bus code will supply the data and set ia_name and
ia_namelen. I2C device drivers will use iic_is_compatible() to check
matches. This method is also backwards compatible with the old, direct
use of ia_name.

Prompted by a related patch from kettenis@.

OK kettenis@

2 years agosilence "function declaration isn't a prototype" warning by changing
tb [Wed, 9 Feb 2022 07:48:15 +0000 (07:48 +0000)]
silence "function declaration isn't a prototype" warning by changing
int foo() to int foo(void)

2 years agoIncrease armv7 ramdisk size to avoid errors in installer.
visa [Wed, 9 Feb 2022 07:28:54 +0000 (07:28 +0000)]
Increase armv7 ramdisk size to avoid errors in installer.

OK deraadt@

2 years agodrm/amd: avoid suspend on dGPUs w/ s2idle support when runtime PM enabled
jsg [Wed, 9 Feb 2022 04:31:46 +0000 (04:31 +0000)]
drm/amd: avoid suspend on dGPUs w/ s2idle support when runtime PM enabled

From Mario Limonciello
8a15ac1786c92dce6ecbeb4e4c237f5f80c2c703 in linux 5.15.y/5.15.22
e55a3aea418269266d84f426b3bd70794d3389c8 in mainline linux

2 years agodrm/i915/overlay: Prevent divide by zero bugs in scaling
jsg [Wed, 9 Feb 2022 04:29:02 +0000 (04:29 +0000)]
drm/i915/overlay: Prevent divide by zero bugs in scaling

From Dan Carpenter
5cba71707f0a7fe19fa1feaf25a4c094876c2db1 in linux 5.15.y/5.15.22
90a3d22ff02b196d5884e111f39271a1d4ee8e3e in mainline linux

2 years agodrm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels
jsg [Wed, 9 Feb 2022 04:25:22 +0000 (04:25 +0000)]
drm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels

From Aun-Ali Zaidi
2093ecf557e733f995c7db6df716c91c43923972 in linux 5.15.y/5.15.22
30fbce374745a9c6af93c775a5ac49a97f822fda in mainline linux

2 years agodrm/amd/display: watermark latencies is not enough on DCN31
jsg [Wed, 9 Feb 2022 04:22:32 +0000 (04:22 +0000)]
drm/amd/display: watermark latencies is not enough on DCN31

From Paul Hsieh
7ff0ed88e4eb6bd7ccd7cf422ab855032ed0528c in linux 5.15.y/5.15.22
f5fa54f45ab41cbb1f99b1208f49554132ffb207 in mainline linux

2 years agodrm/amd/pm: correct the MGpuFanBoost support for Beige Goby
jsg [Wed, 9 Feb 2022 04:19:11 +0000 (04:19 +0000)]
drm/amd/pm: correct the MGpuFanBoost support for Beige Goby

From Evan Quan
4f4c77ad5a13ac39d38cc3f1b963e85ecf9d528f in linux 5.15.y/5.15.22
3ec5586b4699cfb75cdfa09425e11d121db40773 in mainline linux

2 years agodrm/i915/adlp: Fix TypeC PHY-ready status readout
jsg [Wed, 9 Feb 2022 04:16:26 +0000 (04:16 +0000)]
drm/i915/adlp: Fix TypeC PHY-ready status readout

From Imre Deak
39ac3945d966168bdede467446dec45cee3382bb in linux 5.15.y/5.15.22
3c6f13ad723e7206f03bb2752b01d18202b7fc9d in mainline linux

2 years agodrm/i915: Disable DSB usage for now
jsg [Wed, 9 Feb 2022 04:13:39 +0000 (04:13 +0000)]
drm/i915: Disable DSB usage for now

From Ville Syrjala
d63d077fc44645d51df7e9007df87853f5c13e4c in linux 5.15.y/5.15.22
99510e1afb4863a225207146bd988064c5fd0629 in mainline linux

2 years agoenable hardware vlan tagging.
dlg [Wed, 9 Feb 2022 03:22:50 +0000 (03:22 +0000)]
enable hardware vlan tagging.

tested on sparc64 and x86

2 years agocat(1): drop "rpath" promise in no-file case
cheloha [Wed, 9 Feb 2022 01:58:57 +0000 (01:58 +0000)]
cat(1): drop "rpath" promise in no-file case

If we're only working with the standard input we don't need "rpath".

Tweaked by mestre@.

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

No objections on tech@ after several weeks.

2 years agocat(1): refactor cook_args()/raw_args() into single function, cat_file()
cheloha [Wed, 9 Feb 2022 01:56:28 +0000 (01:56 +0000)]
cat(1): refactor cook_args()/raw_args() into single function, cat_file()

- Combine the open/close portions of cook_args()/raw_args() into a single
  function, cat_file().

- Push the flag-checking conditional in main() down into cat_file().

- Pull the argv loop in cat_file() up into main().

These changes -- especially pulling the argv look up into main() --
will allow us to drop the "rpath" promise in a single spot in a
subsequent patch.

Tweaked by mestre@.  Descriptor leak in earlier version spotted by
Matthew Martin.

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

No objections on tech@ after several weeks.

2 years agooops, a typo snuck in
deraadt [Tue, 8 Feb 2022 23:19:47 +0000 (23:19 +0000)]
oops, a typo snuck in

2 years agoPlug a long standing leak in libtls CRL handling
tb [Tue, 8 Feb 2022 19:13:50 +0000 (19:13 +0000)]
Plug a long standing leak in libtls CRL handling

X509_STORE_add_crl() does not take ownership of the CRL, it bumps its
refcount. So nulling out the CRL from the stack will leak it.

Issue reported by KS Sreeram, thanks!

ok jsing

2 years agoPlug leaks reported by Ilya Shipitsin
tb [Tue, 8 Feb 2022 19:06:56 +0000 (19:06 +0000)]
Plug leaks reported by Ilya Shipitsin

2 years agoPlug a number of leaks reported by Ilya Shipitsin
tb [Tue, 8 Feb 2022 19:00:36 +0000 (19:00 +0000)]
Plug a number of leaks reported by Ilya Shipitsin

2 years agoIn the first example, use "mandoc -a" directly rather "mandoc -l".
schwarze [Tue, 8 Feb 2022 18:23:11 +0000 (18:23 +0000)]
In the first example, use "mandoc -a" directly rather "mandoc -l".

It feels more natural to me to use -a directly when asking mandoc(1)
to use a pager.  The reason that "mandoc -l" does exactly the same
as "mandoc -a" is that "mandoc" is essentially "man -lc", so the -a
implied by -l negates the -c and the -l has no effect because it is
already the default for mandoc(1).

The more usual command for doing the same is "man -l foo.1 bar.1 ..."
but that's off-topic for the mandoc(1) manual page.

Patch on tech@ from Anders Damsgaard <anders at adamsgaard dot dk>.

2 years agoDo not /0 if timeout[PFTM_INTERVAL] manages to become zero
deraadt [Tue, 8 Feb 2022 18:08:33 +0000 (18:08 +0000)]
Do not /0 if timeout[PFTM_INTERVAL] manages to become zero
crash noticed by gnezdo, a seperate commit will fix the identified
cause, but being careful at this point is a good idea.
ok sashan

2 years agoGarbage collect the unused hash and print kp->pubkey_hash instead of NULL.
tb [Tue, 8 Feb 2022 18:05:57 +0000 (18:05 +0000)]
Garbage collect the unused hash and print kp->pubkey_hash instead of NULL.
Make sure kp is freed also on error.

ok jsing

2 years agoFix memleaks reported by Ilya Shipitsin
tb [Tue, 8 Feb 2022 17:59:39 +0000 (17:59 +0000)]
Fix memleaks reported by Ilya Shipitsin

2 years agorev(1): drop "rpath" promise in no-file branch.
cheloha [Tue, 8 Feb 2022 17:44:18 +0000 (17:44 +0000)]
rev(1): drop "rpath" promise in no-file branch.

We don't need "rpath" if we're only processing the standard input.

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

ok deraadt@ millert@

2 years agoThe suspend/resume code is a sticky mess of MI, MD, and ACPI sequencing.
deraadt [Tue, 8 Feb 2022 17:25:10 +0000 (17:25 +0000)]
The suspend/resume code is a sticky mess of MI, MD, and ACPI sequencing.
This splits out the MI sequencing, backing it with per-architecture helper
functions.  Further steps will be neccesary because ACPI and MD are too
tightly coupled, but soon we'll be able to use this code for more architectures
(which depends on figuring out the lowest-level cpu sleeping method)
ok kettenis

2 years agoChange second argument of x25519_ge_scalarmult_base() from
tb [Tue, 8 Feb 2022 16:44:23 +0000 (16:44 +0000)]
Change second argument of x25519_ge_scalarmult_base() from
a 'const uint8_t *a' to a 'const uint8_t a[32]' to match
the prototype in curve25519_internal.h and the other variant
inside OPENSSL_SMALL.

ok millert

2 years agoCheck CRLs also for manifests
tb [Tue, 8 Feb 2022 14:53:03 +0000 (14:53 +0000)]
Check CRLs also for manifests

There is a chicken-egg here since manifests reference the CRL themselves.
We may also have two CRLs available, in which case we check against the
one with the newer thisUpdate time.

The RFC situation is a bit of a mess with abundant complexity, unclear
recommendations and requirements and draft specs that also need to be
considered. This is a first version that works with future improvements
to be landed later.

Joint work with claudio, prompted by a question by job

ok claudio job

2 years agoFix a KASSERT in iwm(4) being triggered for the wrong reason.
stsp [Tue, 8 Feb 2022 14:24:36 +0000 (14:24 +0000)]
Fix a KASSERT in iwm(4) being triggered for the wrong reason.

iwm_wakeup() must initialize the task reference counter only if
resuming the device succeeds. Otherwise, the newstate task will
not be scheduled and hence the ref counter must remain at zero.

Problem observed by + ok kettenis@

2 years agoBefore loading the certificate chain for the file under inspection check
claudio [Tue, 8 Feb 2022 12:35:14 +0000 (12:35 +0000)]
Before loading the certificate chain for the file under inspection check
if the AKI cert is not already present. This fixes a problem when a top
level MFT is displayed.
Report and OK job@, OK tb@

2 years agoUsing FILL_KPROC() from sysctl.h after rev 1.223 requires a definition
jsg [Tue, 8 Feb 2022 12:10:39 +0000 (12:10 +0000)]
Using FILL_KPROC() from sysctl.h after rev 1.223 requires a definition
of struct filedesc.  Include sys/filedesc.h here to unbreak the build.

problem found by and ok tb@

2 years agobring back IPv4, TCP4/6 and UDP4/6 checksum offloading.
dlg [Tue, 8 Feb 2022 11:55:19 +0000 (11:55 +0000)]
bring back IPv4, TCP4/6 and UDP4/6 checksum offloading.

this was first introduced in r1.176 by jan@. this diff includes two
fixes to that implementation.

the most important one is to parse the ip and tcp headers before a
possible call to m_defrag. if an l4 offload is requested, it's only
requested by the stack when the payload is correctly aligned and
with each header contiguous in memory. this means you can use
m_getptr and cast the packet data to the relevant headers to read
them directly because that's what the stack does when it's working
on them. this makes it cheap to work on them too.

however, if you m_defrag, it ignores the alignment and ends up
making it unsafe to dereference the ip and tcp/udp payloads on
strict alignment architectures. if we want to look at the headers
after m_defrag, we'd likely have to copy them onto the stack first.

the other fix is to reset the offload bits between packets in the
loop in ixl_start.

another difference is that this code skips parsing the packet if
no checksum offload is requested.

tests and a tweak by bluhm@ to actually use the offloading
tested by me on sparc64 and x86 boxes

ok bluhm@ jmatthew@

2 years agoMove the guts of proc_parser_crl() into crl_parse(). This is actually
tb [Tue, 8 Feb 2022 11:51:51 +0000 (11:51 +0000)]
Move the guts of proc_parser_crl() into crl_parse(). This is actually
parsing the CRL, so it makes more sense to have it there. It will also
make an upcoming change easier. While there, rename free_crl() into
crl_free() for consistency with all other *_free() functions.

input/ok claudio

2 years agouse sizeof(long) - 1 in m_pullup to determine payload alignment.
dlg [Tue, 8 Feb 2022 11:28:19 +0000 (11:28 +0000)]
use sizeof(long) - 1 in m_pullup to determine payload alignment.

this makes it consistent with the rest of the network stack when
determining alignment.

ok bluhm@

2 years agofix off by one in bounds test
jsg [Tue, 8 Feb 2022 09:41:04 +0000 (09:41 +0000)]
fix off by one in bounds test
ok miod@ kettenis@

2 years agoSwitch hpdelim interface to accept only ":" as delimiter.
dtucker [Tue, 8 Feb 2022 08:59:12 +0000 (08:59 +0000)]
Switch hpdelim interface to accept only ":" as delimiter.

Historicallly, hpdelim accepted ":" or "/" as a port delimiter between
hosts (or addresses) and ports.  These days most of the uses for "/"
are no longer accepted, so there are several places where it checks the
delimiter to disallow it.  Make hpdelim accept only ":" and use hpdelim2
in the other cases.  ok djm@

2 years agopoll(2): Switch to kqueue backend
visa [Tue, 8 Feb 2022 08:56:41 +0000 (08:56 +0000)]
poll(2): Switch to kqueue backend

Implement the poll(2) system call on top of the kqueue subsystem.
This obsoletes the old, non-MP-safe poll backend.

On entering poll(2), the new code translates each pollfd array entry
into a set of knotes. When these knotes receive events through kqueue,
the events are translated back to pollfd format.

Entries in the pollfd array can refer to the same file descriptor with
overlapping event masks. To allow such overlap with knotes, use an extra
kn_pollid key that separates knotes of different pollfd entries.

Adapted from DragonFly BSD, initial implementation by mpi@.

Tested in snaps for three weeks.

OK mpi@

2 years agorework checksum/vlan offloading, and enable it for ipv6 too.
dlg [Tue, 8 Feb 2022 03:38:00 +0000 (03:38 +0000)]
rework checksum/vlan offloading, and enable it for ipv6 too.

this is based on work by jan@ and bluhm@. the most interesting
change on top of their work is to move the parsing of the IP packets
to figure out ip and udp/tcp offsets before a possible call to
m_defrag.

if an l4 offload is requested, it's only requested by the stack
when the payload is correctly aligned and with each header contiguous
in memory. this means you can use m_getptr and cast the packet data
to the relevant headers to read them directly because that's what
the stack does when it's working on them. this makes it cheap to
work on them too.

however, if you m_defrag, it ignores the alignment and ends up
making it unsafe to dereference the ip and tcp/udp payloads on
strict alignment architectures. if we want to look at the headers
after m_defrag, we'd likely have to copy them onto the stack first.

we got away with this before because we were lucky with the code
that's generated on strict alignment archs for looking at the ip
hl and proto fields. that luck might run out though.

while here i've also tweaked the vlan handling code, and generally
tried to make it more readable.

ok bluhm@ jmatthew@

2 years agoAllow writes to rw pages in pte_spill_v
gkoehler [Mon, 7 Feb 2022 23:20:09 +0000 (23:20 +0000)]
Allow writes to rw pages in pte_spill_v

In the powerpc pmap, hash collisions can spill page table entries.
Page faults can use pte_spill_v to reinsert a spilled pte.  If the
fault is a write (DSISR_STORE), then pte_spill_v tries to check for a
read-only page.  The existing check (pte_lo & PTE_RO_64) also matched
rw pages, because PTE_RO_64 is 3 and PTE_RW_64 is 2.  This caused
pte_spill_v to deny writes to rw pages.  Then uvm_fault might allow
the write; but uvm_fault can't handle some pages in the kernel.  Such
faults caused, "panic: uvm_fault: fault on non-pageable map", or
"panic: trap type 300".

Change it to ((pte_lo & PTE_PP_64) == PTE_RO_64).  This seems to fix
one reason why bsd.mp on a macppc dual G5 might panic.

ok kettenis@ miod@

2 years agoNew status flag: 'c' - process is chrooted.
rob [Mon, 7 Feb 2022 22:57:47 +0000 (22:57 +0000)]
New status flag: 'c' - process is chrooted.
Feedback and tweaks from deraadt@ guenther@
Ok bluhm@ deraadt@

2 years agoAllow "ddb{1}> trace" through interrupt on macppc
gkoehler [Mon, 7 Feb 2022 22:28:15 +0000 (22:28 +0000)]
Allow "ddb{1}> trace" through interrupt on macppc

If cpu0 sends PPC_IPI_DDB to cpu1, then cpu1 stops on its interrupt
stack.  Teach ININTSTK to allow traces through all interrupt stacks,
not only cpu0's.

ININTSTK now works by looping for all cpus.  It doesn't remember which
cpu owns the stack.  A macppc has at most 4 cpus.

ok kettenis@ miod@

2 years agoUse fdisk's -b to create boot partitions instead of -e scripts.
krw [Mon, 7 Feb 2022 20:24:30 +0000 (20:24 +0000)]
Use fdisk's -b to create boot partitions instead of -e scripts.

Build, boot and install tested by visa@

ok visa@

2 years agoAvoid a NULL dereference in BN_mod_exp2_mont()
tb [Mon, 7 Feb 2022 19:49:56 +0000 (19:49 +0000)]
Avoid a NULL dereference in BN_mod_exp2_mont()

This is a very rarely used function and the crash is hard to reach in
practice. Instead of implementing BN_is_odd() badly by hand, just call
the real thing.

Reported by Guido Vranken

ok beck jsing

2 years agoCheck for zero modulus in BN_MONT_CTX_set().
tb [Mon, 7 Feb 2022 19:44:23 +0000 (19:44 +0000)]
Check for zero modulus in BN_MONT_CTX_set().

From OpenSSL 6a009812, prompted by a report by Guido Vranken

ok beck jsing

2 years agoDelete STACKGAPLEN: this exec-time allocation at the top of the
guenther [Mon, 7 Feb 2022 19:30:48 +0000 (19:30 +0000)]
Delete STACKGAPLEN: this exec-time allocation at the top of the
original thread's stack hasn't been used since 2015.

ok miod@ deraadt@

2 years agoTweak previous.
rob [Mon, 7 Feb 2022 19:28:14 +0000 (19:28 +0000)]
Tweak previous.

2 years agohead(1): check for stdio errors
cheloha [Mon, 7 Feb 2022 17:19:57 +0000 (17:19 +0000)]
head(1): check for stdio errors

- Output errors are terminal.

- Input errors yield a warning and cause head(1) to fail
  gracefully.

Tweaked by millert@.

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

ok millert@

2 years agomark failing tests for armv7
mbuhl [Mon, 7 Feb 2022 16:42:59 +0000 (16:42 +0000)]
mark failing tests for armv7

2 years agotrig_test-2 now passes on macppc
mbuhl [Mon, 7 Feb 2022 16:28:45 +0000 (16:28 +0000)]
trig_test-2 now passes on macppc

2 years agoChecking ifaddr pointer for NULL without checking in6_ifaddr works
bluhm [Mon, 7 Feb 2022 15:23:43 +0000 (15:23 +0000)]
Checking ifaddr pointer for NULL without checking in6_ifaddr works
as ifaddr ia_ifa is the first field of in6_ifaddr.  So the pointers
are the same, and one NULL check works for both.  But in ISO C NULL
has some kind of type and this is undefined behavior.  So add a
second NULL check that the compiler can optimize away.  The resulting
assembler is the same.
found by kubsan; OK tobhe@

2 years agoUse fdisk's -b to create boot partitions instead of -e scripts.
krw [Mon, 7 Feb 2022 15:21:38 +0000 (15:21 +0000)]
Use fdisk's -b to create boot partitions instead of -e scripts.

Build, boot and install tested by visa@

ok visa@

2 years agoSync ps.1 with sys/proc.h. Tweaked by deraadt@.
rob [Mon, 7 Feb 2022 13:17:27 +0000 (13:17 +0000)]
Sync ps.1 with sys/proc.h. Tweaked by deraadt@.
Ok millert@ deraadt@

2 years agoConvert KVA allocation to km_alloc(9).
kettenis [Mon, 7 Feb 2022 13:16:42 +0000 (13:16 +0000)]
Convert KVA allocation to km_alloc(9).

ok jsg@

2 years agoIn rtredirect() change an bad assignment in an if condition to the
claudio [Mon, 7 Feb 2022 11:03:34 +0000 (11:03 +0000)]
In rtredirect() change an bad assignment in an if condition to the
correct equality check.
Found by and OK jsg@

2 years agosystematically remove setuid/setgid from files before archiving AND
espie [Mon, 7 Feb 2022 09:38:33 +0000 (09:38 +0000)]
systematically remove setuid/setgid from files before archiving AND
during extractions. Those bits belong in a museum^Win the packing-list.

thx naddy@ for checking this thru a bulk.

2 years agoSwitch to stdint.h types like rest of bgpd
claudio [Mon, 7 Feb 2022 09:31:21 +0000 (09:31 +0000)]
Switch to stdint.h types like rest of bgpd

2 years agouse libfido2 1.8.0+ fido_assert_set_clientdata() instead of manually
djm [Mon, 7 Feb 2022 01:25:12 +0000 (01:25 +0000)]
use libfido2 1.8.0+ fido_assert_set_clientdata() instead of manually
hashing data outselves. Saves a fair bit of code and makes life easier
for some -portable platforms.

2 years agoAdd test for empty hostname with port.
dtucker [Sun, 6 Feb 2022 22:58:33 +0000 (22:58 +0000)]
Add test for empty hostname with port.

2 years agoAvoid touching "locked" DARTs. While there, print something when we place
kettenis [Sun, 6 Feb 2022 19:10:07 +0000 (19:10 +0000)]
Avoid touching "locked" DARTs.  While there, print something when we place
a DART in bypass mode.

ok patrick@

2 years agos/poll/pool
rob [Sun, 6 Feb 2022 17:24:58 +0000 (17:24 +0000)]
s/poll/pool

2 years agoRemove i <= 0 checks from SSL_get_error()
jsing [Sun, 6 Feb 2022 16:11:58 +0000 (16:11 +0000)]
Remove i <= 0 checks from SSL_get_error()

In order for SSL_get_error() to work with SSL_read_ex() and SSL_write_ex()
the error handling needs to be performed without checking i <= 0. This is
effectively part of OpenSSL 8051ab2b6f8 and should bring the behaviour of
SSL_get_error() largely inline with OpenSSL 1.1.

Issue reported by Johannes Nixdorf.

ok inoguchi@ tb@

2 years agoHandle zero byte reads/writes that trigger handshakes in the TLSv1.3 stack.
jsing [Sun, 6 Feb 2022 16:08:14 +0000 (16:08 +0000)]
Handle zero byte reads/writes that trigger handshakes in the TLSv1.3 stack.

With the legaacy stack, it is possible to do a zero byte SSL_read() or
SSL_write() that triggers the handshake, but then returns zero without
SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE being flagged. This currently
works in the TLSv1.3 stack by returning TLS_IO_WANT_POLLIN or
TLS_IO_WANT_POLLOUT, which is then hidden by SSL_get_error().

However, due to upcoming changes to SSL_get_error() this will no longer be
the case. In order to maintain the existing legacy behaviour, explicitly
handle zero byte reads and writes in the TLSv1.3 stack, following
completion of a handshake.

ok inoguchi@ tb@

2 years agoUse fdisk's -b to create boot partitions instead of -e scripts.
krw [Sun, 6 Feb 2022 15:52:23 +0000 (15:52 +0000)]
Use fdisk's -b to create boot partitions instead of -e scripts.

Build, boot and install tested by visa@

ok visa@

2 years agofix jobs and -j description: dpb uses hw.ncpuonline since
op [Sun, 6 Feb 2022 13:56:14 +0000 (13:56 +0000)]
fix jobs and -j description: dpb uses hw.ncpuonline since
ports/infrastructure/lib/DPB/Core/Init.pm revision 1.32

OK espie

2 years agoAllow installation on a disk with a GPT.
visa [Sun, 6 Feb 2022 11:29:18 +0000 (11:29 +0000)]
Allow installation on a disk with a GPT.

OK krw@

2 years agoSimplify cursig() a bit and make sure that signals are always sent to
claudio [Sun, 6 Feb 2022 09:57:59 +0000 (09:57 +0000)]
Simplify cursig() a bit and make sure that signals are always sent to
the parent of ptraced processes. Especially ignore the signal mask set
by sigprocmask(2) in that case. In userret() alter the testcase for
when to call cursig() which is only there to avoid taking the
KERNEL_LOCK when returning from a MP safe syscall. This can be revisited
once cursig() is MP safe.
Problem with debugging signal handlers found by kurt@
Tested and OK kurt@, OK mpi@

2 years agoSwitch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
claudio [Sun, 6 Feb 2022 09:52:32 +0000 (09:52 +0000)]
Switch from u_intX_t types to stdint.h uintX_t like it was done in bgpd.
OK florian@ tb@

2 years agoSwitch from u_intX_t types to stdint.h uintX_t. Mostly mechanical with
claudio [Sun, 6 Feb 2022 09:51:19 +0000 (09:51 +0000)]
Switch from u_intX_t types to stdint.h uintX_t. Mostly mechanical with
a few reindents.
OK florian@ tb@

2 years agocope with recent S3I removal; ok tb@
anton [Sun, 6 Feb 2022 09:19:46 +0000 (09:19 +0000)]
cope with recent S3I removal; ok tb@

2 years agonow that APM_BATT_CHARGING is also set in acpi and on some m1 devices
robert [Sun, 6 Feb 2022 09:07:42 +0000 (09:07 +0000)]
now that APM_BATT_CHARGING is also set in acpi and on some m1 devices
enable support for displaying an estimate recharge time in apm(d)

e.g:
Battery state: charging, 95% remaining, 11 minutes recharge time estimate
Battery state: charging, 97% remaining, 8 minutes recharge time estimate
Battery state: charging, 98% remaining, 6 minutes recharge time estimate
Battery state: charging, 99% remaining, 3 minutes recharge time estimate
Battery state: charging, 99% remaining, 1 minutes recharge time estimate
Battery state: charging, 99% remaining, 0 minutes recharge time estimate

ok jca@

2 years agoremove please from manual pages
jsg [Sun, 6 Feb 2022 00:29:02 +0000 (00:29 +0000)]
remove please from manual pages
ok jmc@ sthen@ millert@

2 years agoFix UB "shift-out-of-bounds" in battlestar
gnezdo [Sat, 5 Feb 2022 23:00:20 +0000 (23:00 +0000)]
Fix UB "shift-out-of-bounds" in battlestar

OK millert@

2 years agoypldap: fix -Wunused-but-set-variable warnings
naddy [Sat, 5 Feb 2022 22:59:58 +0000 (22:59 +0000)]
ypldap: fix -Wunused-but-set-variable warnings

* wrlen has been write-only since the code was imported
* removing "dns_pid" mirrors ntpd/ntp.c 1.122
* ifdef out unfinished code in yp_check()

ok millert@ deraadt@

2 years agogrow the dmesg buffer on i386 from 4 to 8 pages
daniel [Sat, 5 Feb 2022 20:31:26 +0000 (20:31 +0000)]
grow the dmesg buffer on i386 from 4 to 8 pages

I have a machine where the dmesg is too big for 4 pages.

ok deraadt@

2 years agoAdapt appstest.sh for the new TLS_ names.
tb [Sat, 5 Feb 2022 18:36:08 +0000 (18:36 +0000)]
Adapt appstest.sh for the new TLS_ names.

2 years agoAdd a workaround due to OpenSSL's limitation of SSL_CTX_set_cipher_list
tb [Sat, 5 Feb 2022 18:34:06 +0000 (18:34 +0000)]
Add a workaround due to OpenSSL's limitation of SSL_CTX_set_cipher_list

SSL_CTX_set_cipher_list() in OpenSSL 1.1 does not accept TLSv1.3 ciphers.
This wasn't a problem until now since the AEAD- ciphers were counted as
distinct from TLS_ ciphers by the regress test, so they were never used
in the {run,check}-cipher-${cipher}-client-${clib}-server-${slib} tests

With the renaming, the TLSv1.3 ciphers are now considered as common
ciphers, so they're tested. With openssl11 this results in

0:error:1410D0B9:SSL routines:SSL_CTX_set_cipher_list:no cipher match:ssl/ssl_lib.c:2573:

The design of these tests doesn't allow easily adding a call to
SSL_CTX_set_ciphersuites (since they also need to work with openssl 1.0.2)
so skip the TLS_* ciphers for the time being.

2 years agoMechanically adjust from AEAD- to TLS_ to adjust to the new cipher names.
tb [Sat, 5 Feb 2022 18:21:09 +0000 (18:21 +0000)]
Mechanically adjust from AEAD- to TLS_ to adjust to the new cipher names.

2 years agoAdjust the ssl_get_shared_ciphers to the new names.
tb [Sat, 5 Feb 2022 18:19:39 +0000 (18:19 +0000)]
Adjust the ssl_get_shared_ciphers to the new names.

2 years agoSwitch TLSv1.3 cipher names from AEAD- to OpenSSL's TLS_
tb [Sat, 5 Feb 2022 18:18:18 +0000 (18:18 +0000)]
Switch TLSv1.3 cipher names from AEAD- to OpenSSL's TLS_

OpenSSL chose to break the previous naming convention for ciphers and
to adopt TLS_* "RFC" names instead. Unfortunately, these names are
exposed in several APIs and some language bindings test for these
non-standard names instead of cipher values, which is ... unfortunate
(others would say "plain crazy").

We currently have to maintain patches in regress and ports (p5-Net-SSLeay,
openssl-ruby-tests - which means that Ruby will pick this up at some point)
to work around this difference and that's just not worth the effort.

The old AEAD- names will become aliases and continue to work, but in
openssl ciphers and netcat output the TLS_* names will now be displayed.

"I would be very happy if this gets committed" bluhm
ok beck inoguchi, begrudgingly ok jsing

2 years agoProvide logbl(3) when long double is double
gkoehler [Sat, 5 Feb 2022 17:11:56 +0000 (17:11 +0000)]
Provide logbl(3) when long double is double

bcallah@ had same diff
ok guenther@

2 years agoRevise for S3I removal.
jsing [Sat, 5 Feb 2022 14:54:40 +0000 (14:54 +0000)]
Revise for S3I removal.

2 years agoBye bye S3I.
jsing [Sat, 5 Feb 2022 14:54:10 +0000 (14:54 +0000)]
Bye bye S3I.

S3I has served us well, however now that libssl is fully opaque it is time
to say goodbye. Aside from removing the calloc/free/memset, the rest is
mechanical sed.

ok inoguchi@ tb@

2 years agoSwitch vmapbuf() and vunmapbuf() over to km_alloc(9) and km_free(9) like
kettenis [Sat, 5 Feb 2022 09:37:06 +0000 (09:37 +0000)]
Switch vmapbuf() and vunmapbuf() over to km_alloc(9) and km_free(9) like
we did for arm64 and powerpc64 some time ago.

ok guenther@

2 years agoOnly install the sensors once as multiple devices can be paired with the
anton [Sat, 5 Feb 2022 07:31:40 +0000 (07:31 +0000)]
Only install the sensors once as multiple devices can be paired with the
same receiver. Prevents a newly added assertion from triggering.

Problem reported by Joel Carnat <joel at carnat dot net> on bugs@

2 years agomake bpf_movein align the packet payload.
dlg [Sat, 5 Feb 2022 04:08:27 +0000 (04:08 +0000)]
make bpf_movein align the packet payload.

bluhm@ hit a problem while running a regress test where a packet
generated and injected via bpf ends up being consumed by the network
stack. the stack assumes that packets are aligned properly, but bpf
was lazy and put whatever was written to it at the start of an mbuf.
ethernet has a 14 byte header, so if you put that at the start the
payload will be misaligned by 2 bytes.

bpf already has handling for different link header types, so this
handling is extended a bit to align the payload after the link
header.

while here we're fixing up a few error codes. short packets produce
EINVAL instead of EPERM, and packets larger than the biggest mbuf
the kernel supports generates EMSGSIZE.

with tweaks and ok bluhm@

2 years agoremove an extra set of brackets. no functional change.
dlg [Sat, 5 Feb 2022 03:56:16 +0000 (03:56 +0000)]
remove an extra set of brackets. no functional change.

2 years agoWrap some annoyingly long lines.
krw [Fri, 4 Feb 2022 23:32:17 +0000 (23:32 +0000)]
Wrap some annoyingly long lines.

2 years agoAdd prototype for clock_set_frequency_idx().
kettenis [Fri, 4 Feb 2022 22:24:09 +0000 (22:24 +0000)]
Add prototype for clock_set_frequency_idx().

2 years ago%llu should be enough for anybody, no need to use %lld/(long long) for
krw [Fri, 4 Feb 2022 18:21:33 +0000 (18:21 +0000)]
%llu should be enough for anybody, no need to use %lld/(long long) for
uint64_t values.

2 years agoDefine __HAVE_PMAP_MPSAFE_ENTER_COW; the ARMv8 architecture requires
kettenis [Fri, 4 Feb 2022 18:15:40 +0000 (18:15 +0000)]
Define __HAVE_PMAP_MPSAFE_ENTER_COW; the ARMv8 architecture requires
that we implement proper "break-before-make" semantics and I've stared
at the code for long enough that I've convinced myself that we do indeed
implement this correctly several times.

ok guenther@

2 years agoUse the '-b' to create boot partitions instead of '-e' scripts.
krw [Fri, 4 Feb 2022 18:12:47 +0000 (18:12 +0000)]
Use the '-b' to create boot partitions instead of '-e' scripts.

Media creation & subsequent installation tests by visa@

ok visa@

2 years agowhitelist resolv.conf for stat. go dns library does this.
tedu [Fri, 4 Feb 2022 17:50:28 +0000 (17:50 +0000)]
whitelist resolv.conf for stat. go dns library does this.
ok deraadt

2 years agoMore consistency in the return code docs.
tb [Fri, 4 Feb 2022 16:50:49 +0000 (16:50 +0000)]
More consistency in the return code docs.

2 years agoDocument certificate_policies() in a comment.
tb [Fri, 4 Feb 2022 16:50:01 +0000 (16:50 +0000)]
Document certificate_policies() in a comment.

2 years agoBump libressl's version in pkgconfig to 2.0.0
tb [Fri, 4 Feb 2022 16:42:15 +0000 (16:42 +0000)]
Bump libressl's version in pkgconfig to 2.0.0

LibreSSL's pc files effectively hardcode the version to 1.0.0 since
LibreSSL exists. That probably never made much sense. This causes
some pain for ports that "need 'openssl' ['>= +1.1.0'] found '1.0.0'"
or similar while they would build perfectly fine with LibreSSL.
This only affects OpenBSD. We do not put the actual LibreSSL version
in there since it may cause trouble

Discussed with sthen, millert, inoguchi, beck over the past year.

Diff from/ok sthen

2 years agoRemove a strange inheritance check from addr_validate_path_internal()
tb [Fri, 4 Feb 2022 16:34:15 +0000 (16:34 +0000)]
Remove a strange inheritance check from addr_validate_path_internal()

The trust anchor can't inherit, but the code says that it can inherit
just not if the leaf tries to inherit from that. This makes no sense
and doesn't match what is done on the asid side.

ok jsing

2 years agowhitespace
tb [Fri, 4 Feb 2022 16:29:43 +0000 (16:29 +0000)]
whitespace

2 years agoEnsure that certificate policies follow RFC 7318
tb [Fri, 4 Feb 2022 16:28:20 +0000 (16:28 +0000)]
Ensure that certificate policies follow RFC 7318

RFC 7318 makes requirements on the certificate policy extension imposed
by RFC 6487 a bit stricter. It requires that exactly one policy OID is
present and that it be id-cp-ipAddr-asNumber and if there is a policy
qualifier it must be id-qt-cps. These are requirements that the X.509
verifier's policy code can't enforce, so unpack the certificate policy
extension by hand and check that it matches expectations.

ok claudio

2 years agoEnforce Certificate Policy for RPKI
tb [Fri, 4 Feb 2022 16:21:11 +0000 (16:21 +0000)]
Enforce Certificate Policy for RPKI

RFCs 6384 defines a certificate policy for RPKI. Ensure that the verifier
builds a certification path that follows this OID: set up a policy on the
X509_STORE_CTX's verify parameters and set initial-explicit-policy and
initial-policy-mapping-inhibit.

Pointed out by Ties de Kock

ok claudio

2 years agoAdd id-cp-ipAddr-asNumber OID to x509_init_oid()
tb [Fri, 4 Feb 2022 16:08:53 +0000 (16:08 +0000)]
Add id-cp-ipAddr-asNumber OID to x509_init_oid()

Unfortunately, NID_ipAddr_asNumber is not available in LibreSSL < 3.3
and OpenSSL, so load its OID by hand to help -portable. This will be
used for certificate policy checks.

ok claudio

2 years agoNow that installboot(8) creates the startup.nsh file, remove the shell
kettenis [Fri, 4 Feb 2022 16:08:39 +0000 (16:08 +0000)]
Now that installboot(8) creates the startup.nsh file, remove the shell
scripting doing the same thing from here.

ok deraadt@, visa@