openbsd
2 years agoRewrite TLSv1.2 key exporter.
jsing [Mon, 7 Nov 2022 11:58:45 +0000 (11:58 +0000)]
Rewrite TLSv1.2 key exporter.

Replace the grotty TLSv1.2 key exporter with a cleaner version that uses
CBB and CBS.

ok tb@

2 years agoMove tls13_exporter() code.
jsing [Mon, 7 Nov 2022 11:53:39 +0000 (11:53 +0000)]
Move tls13_exporter() code.

It makes more sense to have tls13_exporter() in tls13_key_schedule.c,
rather than tls13_lib.c

ok tb@

2 years agoFix some spelling errors.
mbuhl [Mon, 7 Nov 2022 11:33:24 +0000 (11:33 +0000)]
Fix some spelling errors.
OK claudio@

2 years agoModify TCP receive buffer size auto scaling to use the smoothed RTT
yasuoka [Mon, 7 Nov 2022 11:22:55 +0000 (11:22 +0000)]
Modify TCP receive buffer size auto scaling to use the smoothed RTT
(SRTT) instead of the timestamp option.  Since the timestamp option is
disabled on some OSs (eg. Windows) or dropped by some
firewalls/routers, in such a case the window size had been fixed at
16KB, this limits throughput at very low on high latency networks.
Also replace "tcp_now" from 2HZ tick counter to binuptime in
milliseconds to calculate the SRTT better.

tested by krw matthieu jmatthew dlg djm stu stsp
ok claudio

2 years agoSet up logger(1) traps earlier to catch logfile setup failures
kn [Mon, 7 Nov 2022 11:03:14 +0000 (11:03 +0000)]
Set up logger(1) traps earlier to catch logfile setup failures

If /usr is mounted read-only, kernel relinking fails silently without any
log trace:

# /usr/libexec/reorder_kernel
/usr/libexec/reorder_kernel[35]: cannot create /usr/share/relink/kernel/GENERIC.MP/relink.log: Read-only file system

This stderr line does not show up anywhere because init(8) redirects stdout
and stderr to /dev/null, executes rc(8) which inherits it and thus executes
reorder_kernel with both streams discarded.

So install the error handler first, then try to set up a log file.

Introduce ERRMSG to provide error messages to users, i.e. not say
"see .../relink.log" when creating this file is what failed:

# ksh ./reorder_kernel.sh
./reorder_kernel.sh[40]: cannot create /usr/share/relink/kernel/GENERIC.MP/relink.log: Read-only file system
# tail -n1 /var/log/message # or xconsole(1)
Nov  7 10:51:00 eru reorder_kernel.sh: failed

OK tb

2 years agoRun the ND6 expiry timer without kernel lock
kn [Mon, 7 Nov 2022 10:45:39 +0000 (10:45 +0000)]
Run the ND6 expiry timer without kernel lock

Added in 2017 to
Reduce contention on the NET_LOCK() by moving the nd6 address expiration
task to the `softnettq`.

This should no longer be needed thanks to sys/net/if.c r1.652 in 2022:
Activate parallel IP forwarding.  Start 4 softnet tasks.  Limit the
usage to the number of CPUs.

Nothing in nd6_expire() or nd6_expire_timer_update() requires protection by
the kernel lock.

The interface list and per-interface address lists remain protected by the
net lock.

Tests by Hrvoje
OK mpi

2 years agodtors were broken by trying to reuse DF_1_NODELETE to hint that this
deraadt [Mon, 7 Nov 2022 10:35:26 +0000 (10:35 +0000)]
dtors were broken by trying to reuse DF_1_NODELETE to hint that this
library would never unload, and could be immutable.  Pass a seperate
flag for our purposes
Noticed from regress tests by anton, ok kettenis

2 years agoRename unreferenced field d_drivedata to smoke out any well
krw [Mon, 7 Nov 2022 10:33:22 +0000 (10:33 +0000)]
Rename unreferenced field d_drivedata to smoke out any well
hidden uses.

2 years agoNuke last references to d_drivedata.
krw [Mon, 7 Nov 2022 10:21:17 +0000 (10:21 +0000)]
Nuke last references to d_drivedata.

2 years agoThe IdentityFile option in ssh_config can also be used to specify a
dtucker [Mon, 7 Nov 2022 10:09:28 +0000 (10:09 +0000)]
The IdentityFile option in ssh_config can also be used to specify a
public key file, as documented in ssh.1 for the -i option. Document this
also for IdentityFile in ssh_config.5, for documentation completeness.
From laalsaas at systemli.org via portable github PR#352, ok jmc@ djm@

2 years agoRemove some set but otherwise unused variables, spotted in -portable by
dtucker [Mon, 7 Nov 2022 10:05:38 +0000 (10:05 +0000)]
Remove some set but otherwise unused variables, spotted in -portable by
clang 16's -Wunused-but-set-variable.  ok djm@

2 years agoCheck for and disallow MaxStartups values less than or equal to zero
dtucker [Mon, 7 Nov 2022 10:02:59 +0000 (10:02 +0000)]
Check for and disallow MaxStartups values less than or equal to zero
during config parsing, rather than faling later at runtime.  bz#3489,
ok djm@

2 years agoImplement db_write_text/bytes() which add support for ddb(4)'s breakpoints.
mpi [Mon, 7 Nov 2022 09:43:04 +0000 (09:43 +0000)]
Implement db_write_text/bytes() which add support for ddb(4)'s breakpoints.

Based on a diff from gerhard@, ok kettenis@

2 years agoConfirm Path Length is absent in the Basic Constraints extension
job [Mon, 7 Nov 2022 09:18:14 +0000 (09:18 +0000)]
Confirm Path Length is absent in the Basic Constraints extension

OK tb@

2 years agofix parsing of hex cert expiry time; was checking whether the
djm [Mon, 7 Nov 2022 04:04:40 +0000 (04:04 +0000)]
fix parsing of hex cert expiry time; was checking whether the
start time began with "0x", not the expiry time.

from Ed Maste

2 years agoImport regenerated moduli.
dtucker [Mon, 7 Nov 2022 02:21:21 +0000 (02:21 +0000)]
Import regenerated moduli.

2 years agoFix typo. From pablomh via -portable github PR#344.
dtucker [Mon, 7 Nov 2022 01:53:01 +0000 (01:53 +0000)]
Fix typo.  From pablomh via -portable github PR#344.

2 years agoIn kpageflttrap(), validate a non-NULL pcb_onfault against an array
guenther [Mon, 7 Nov 2022 01:41:57 +0000 (01:41 +0000)]
In kpageflttrap(), validate a non-NULL pcb_onfault against an array
of permitted addresses, done via .nofault* sections that end up in
the linked kernel's rodata.

ok deraadt@ kettenis@

2 years agoConstify pfsync_acts[]; OK dlg
kn [Sun, 6 Nov 2022 21:34:01 +0000 (21:34 +0000)]
Constify pfsync_acts[]; OK dlg

2 years agoSkip MD post-install bits on upgrades
kn [Sun, 6 Nov 2022 21:32:54 +0000 (21:32 +0000)]
Skip MD post-install bits on upgrades

Upgrades are noiser on macppc (and loongson and octeon) than on other
architectures because boot firmware changes and/or tips to complete an
OpenBSD installation are always printed, even though they are not needed
after an upgrade.

OK deraadt

2 years agoget rid of pfsync_state_export.
dlg [Sun, 6 Nov 2022 21:31:24 +0000 (21:31 +0000)]
get rid of pfsync_state_export.

it wraps pf_state_export and has the same arguments and return type.
pfsync can just call pf_state_export instead.

ok clang

2 years agoremove unneccessary Pp after Sh;
jmc [Sun, 6 Nov 2022 20:15:44 +0000 (20:15 +0000)]
remove unneccessary Pp after Sh;

2 years agoNuke some 'set but not used' pathlen variables.
krw [Sun, 6 Nov 2022 20:03:48 +0000 (20:03 +0000)]
Nuke some 'set but not used' pathlen variables.

ok beck@

2 years agoAt present, mprotect(2) may reduce permissions on immutable pages marked
deraadt [Sun, 6 Nov 2022 19:28:48 +0000 (19:28 +0000)]
At present, mprotect(2) may reduce permissions on immutable pages marked
PROT_READ | PROT_WRITE to the less permissive PROT_READ.  This one-way
operation is permitted for an introductory period to observe how software
uses this mechanism.  It may change to require explicit mutable region
annotation with __attribute__((section(".openbsd.mutable"))) and explicit
calls to mimmutable().
^^^ Decided we'll do that for now, since we've only discovered one program
trying to be clever so far (chrome is trying to do something smart, and
mimmutable makes it even better)
discussed with kettenis and robert

2 years agovmm(4): allocate reference for vm and vcpu SLISTs
dv [Sun, 6 Nov 2022 19:00:37 +0000 (19:00 +0000)]
vmm(4): allocate reference for vm and vcpu SLISTs

Mischa Peters reported a performance regression in 7.2 when hosting
numerous guests under vmm(4). While iterating through the list of
vms during servicing an ioctl, vmm was triggering excessive wakeup
calls due to hitting zero refcnt.

Much guidance from dlg@ and testing from Mischa. OK mlarkin@.

2 years agoregen after /dev/pf? cleanup (only /dev/pf exists)
kn [Sun, 6 Nov 2022 18:32:51 +0000 (18:32 +0000)]
regen after /dev/pf? cleanup (only /dev/pf exists)

2 years agoDocument that OPENSSL_free() is required in some circumstances
tb [Sun, 6 Nov 2022 18:31:15 +0000 (18:31 +0000)]
Document that OPENSSL_free() is required in some circumstances

BoringSSL uses the common trick of storing malloc metadata in a prefix
and then returning a pointer with an offset. Therefore callers must not
call free() but OPENSSL_free().

Reported by dropk1ck via tobhe

ok beck jsing

2 years agoThere is only one pf(4); OK sashan
kn [Sun, 6 Nov 2022 18:30:22 +0000 (18:30 +0000)]
There is only one pf(4); OK sashan

2 years agoEnable IPv4, TCP, and UDP checksum offloading, and VLAN HW tagging
mbuhl [Sun, 6 Nov 2022 18:17:56 +0000 (18:17 +0000)]
Enable IPv4, TCP, and UDP checksum offloading, and VLAN HW tagging
for em 82575, 82576, i350, and i210.

Additional testing by Hrvoje Popovski
OK dlg@

2 years agomove pfsync_state_import in if_pfsync.c to pf_state_import in pf.c
dlg [Sun, 6 Nov 2022 18:05:05 +0000 (18:05 +0000)]
move pfsync_state_import in if_pfsync.c to pf_state_import in pf.c

this is straightening the deck chairs. the state import and export
code are used by both the pf ioctls and pfsync, but the export code
is in pf.c and the import code is in if_pfsync. if pfsync was
disabled then the ioctl stuff wouldnt link.

moving the import code to pf.c makes it more symmetrical(?) and
robust.

tweaks and ok from kn@ sashan@

2 years agoAdd regress for Ed25519.
jsing [Sun, 6 Nov 2022 16:41:29 +0000 (16:41 +0000)]
Add regress for Ed25519.

From tb@

2 years agoEnable Ed25519 internal to libcrypto.
jsing [Sun, 6 Nov 2022 16:31:19 +0000 (16:31 +0000)]
Enable Ed25519 internal to libcrypto.

Based on a diff from tb@

2 years agoAdd FDT-based attachment for qciic(4).
patrick [Sun, 6 Nov 2022 15:36:13 +0000 (15:36 +0000)]
Add FDT-based attachment for qciic(4).

ok kettenis@

2 years agoAdd FDT-based attachment for qcgpio(4).
patrick [Sun, 6 Nov 2022 15:33:58 +0000 (15:33 +0000)]
Add FDT-based attachment for qcgpio(4).

ok kettenis@

2 years agoRemove useless ancient files.
jsing [Sun, 6 Nov 2022 15:10:08 +0000 (15:10 +0000)]
Remove useless ancient files.

ok beck@ tb@

2 years agoReplace existing Blowfish regress tests
joshua [Sun, 6 Nov 2022 14:56:08 +0000 (14:56 +0000)]
Replace existing Blowfish regress tests

ok tb@ jsing@

2 years agoNext to signedObject only allow rpkiNotify accessMethods
tb [Sun, 6 Nov 2022 14:50:51 +0000 (14:50 +0000)]
Next to signedObject only allow rpkiNotify accessMethods

Instead of ignoring all non-signedObject accessMethods, we can be stricter
and only allow rpkiNotify (for now) and error on anything else. Also make
sure we properly clean up behind ourselves on error.

With and ok job

2 years agomake /dev/pf a clonable device.
dlg [Sun, 6 Nov 2022 13:03:52 +0000 (13:03 +0000)]
make /dev/pf a clonable device.

this provides a 1:1 relationship of pfopen() calls to pfclose()
calls. in turn, this makes it a lot easier to track stuff allocated
by a process and then clean it up if that process goes away
unexpectedly. the unique dev_t provided by the cloning machinery
gives us a good identifier to track this state with too.

discussed with h2k22
ok sashan@
deraadt@ agrees this is a good time to put this in

2 years agoChange character drawing depth when 'pseudo' framebuffer depth is changed.
aoyama [Sun, 6 Nov 2022 13:01:22 +0000 (13:01 +0000)]
Change character drawing depth when 'pseudo' framebuffer depth is changed.

Tested on LUNA-88K2 with 4bpp/8bpp framebuffer by me.

2 years agoadd arch to Dt;
jmc [Sun, 6 Nov 2022 13:01:02 +0000 (13:01 +0000)]
add arch to Dt;

2 years agoEnable time_conversion regress tests
beck [Sun, 6 Nov 2022 12:59:46 +0000 (12:59 +0000)]
Enable time_conversion regress tests

2 years agoAdd a bunch of regression tests for time conversion.
beck [Sun, 6 Nov 2022 12:57:08 +0000 (12:57 +0000)]
Add a bunch of regression tests for time conversion.

This regression tests time conversion across various
limits, leap seconds, and daylight transistions.
gmtime_r, localtime_r, timegm, and mktime are
tested against themselves and expected outputs.

It requires the "posix" and "right" zoneinfo to be
installed on the test running machine in order to
access testable time zones. If those are not present
the test is skipped successfully with a warning.

2 years agoDon't leak args.fspec in create_filesystem().
krw [Sun, 6 Nov 2022 12:33:41 +0000 (12:33 +0000)]
Don't leak args.fspec in create_filesystem().

ok kn@

2 years agoqcdwusb(4)
patrick [Sun, 6 Nov 2022 12:18:28 +0000 (12:18 +0000)]
qcdwusb(4)

2 years agoDisable smmu(4) for Qualcomm SC8280XP on FDT attachment like we already do
patrick [Sun, 6 Nov 2022 12:14:52 +0000 (12:14 +0000)]
Disable smmu(4) for Qualcomm SC8280XP on FDT attachment like we already do
on ACPI.

ok kettenis@

2 years agoAdd glue for the USB3 controller on the Lenovo x13s.
patrick [Sun, 6 Nov 2022 12:12:45 +0000 (12:12 +0000)]
Add glue for the USB3 controller on the Lenovo x13s.

ok kettenis@

2 years agoWhile the Qualcomm GENI isn't just a simplebus(4), as one can e.g. select
patrick [Sun, 6 Nov 2022 12:01:52 +0000 (12:01 +0000)]
While the Qualcomm GENI isn't just a simplebus(4), as one can e.g. select
between DMA or FIFO mode for the i2c/serial devices, we can treat it as one
for now.

ok kettenis@

2 years agoTEXTREL binaries are loaded without immutable on un-writeable sections.
deraadt [Sun, 6 Nov 2022 12:00:20 +0000 (12:00 +0000)]
TEXTREL binaries are loaded without immutable on un-writeable sections.
After text relocations are finished, these regions (in the binary) can become
immutable.
OPENBSD_MUTABLE section always overlaps writeable LOADs, so don't be afraid
of that case, it's covered.

2 years agoFix typo in comment about pledges (send -> sendfd).
dv [Sun, 6 Nov 2022 11:54:08 +0000 (11:54 +0000)]
Fix typo in comment about pledges (send -> sendfd).

No functional change.

2 years agoMake EFI runtime calls more robust on arm64 as well. While I have not seen
kettenis [Sun, 6 Nov 2022 11:44:30 +0000 (11:44 +0000)]
Make EFI runtime calls more robust on arm64 as well.  While I have not seen
any broken implementations yet, Linux developers claim that arm64 machines
intended to run Windows are not much better than x86 machines.  And I
totally believe that.

ok patrick@

2 years agold.so wants to make it's own RELRO immutable, which is obviously done
deraadt [Sun, 6 Nov 2022 11:43:19 +0000 (11:43 +0000)]
ld.so wants to make it's own RELRO immutable, which is obviously done
right after it does mprotect PROT_READ.

2 years agoLibrary RELRO sections are excluded from the immutable list, because ld.so
deraadt [Sun, 6 Nov 2022 11:38:54 +0000 (11:38 +0000)]
Library RELRO sections are excluded from the immutable list, because ld.so
tweaks them quite late.  _dl_relro() is called when that work is done, and
the final mprotect PROT_READ happens.  Then we can make mark it immutable.
ok kettenis

2 years agoWhen loading startup libraries, pass DF_1_NODELETE to indicate these are
deraadt [Sun, 6 Nov 2022 11:34:50 +0000 (11:34 +0000)]
When loading startup libraries, pass DF_1_NODELETE to indicate these are
unloadable libraries.  This allows us make consider making parts of those
libraries immutable (in future commits)
ok guenther kettenis

2 years agoFix out-of-order string operations resulting in a wrongly calculated
tobhe [Sun, 6 Nov 2022 11:11:47 +0000 (11:11 +0000)]
Fix out-of-order string operations resulting in a wrongly calculated
string size that could lead to a buffer overflow in ikev2_print_id().

Found by and fix from dropk1ck on github (issue #90)
ok patrick@ mbuhl@

2 years agoUse installboot -p; OK visa
kn [Sun, 6 Nov 2022 10:53:34 +0000 (10:53 +0000)]
Use installboot -p; OK visa

2 years agoDocument LOGDIR on its own since it's not a bsd.port.mk variable.
tb [Sun, 6 Nov 2022 09:26:29 +0000 (09:26 +0000)]
Document LOGDIR on its own since it's not a bsd.port.mk variable.

ok espie

2 years agoWhen a TEXTREL binary is loaded, non-writeable LOADs are not made immutable
deraadt [Sun, 6 Nov 2022 09:25:39 +0000 (09:25 +0000)]
When a TEXTREL binary is loaded, non-writeable LOADs are not made immutable
because a loader may want to perform text relocations wrapped inside
mprotect permission flips.  So static TEXTREL binaries need to perform
this operation themselves, at this fairly late point.
ok kettenis

2 years agotypo: wlll -> will
ajacoutot [Sun, 6 Nov 2022 09:12:03 +0000 (09:12 +0000)]
typo: wlll -> will

2 years agoReintroduce snippet describing startup behaviour to where it belongs. ok jmc@
otto [Sun, 6 Nov 2022 07:39:30 +0000 (07:39 +0000)]
Reintroduce snippet describing startup behaviour to where it belongs. ok jmc@

2 years agoremove the remnants of the old -s option, which was left stranded with poor,
jmc [Sun, 6 Nov 2022 06:51:22 +0000 (06:51 +0000)]
remove the remnants of the old -s option, which was left stranded with poor,
innocent -n;

noticed by indivc on misc@

2 years ago- escape a macro in an Rs/Re block: groff appears to think it is callable
jmc [Sat, 5 Nov 2022 23:18:03 +0000 (23:18 +0000)]
- escape a macro in an Rs/Re block: groff appears to think it is callable
- while here, sort NAME

2 years agoFix kernel build without IPSEC option.
jan [Sat, 5 Nov 2022 22:33:11 +0000 (22:33 +0000)]
Fix kernel build without IPSEC option.

ok deraadt@

2 years agoAdd mount_nfs(8) to fetch sets over NFS
kn [Sat, 5 Nov 2022 22:30:57 +0000 (22:30 +0000)]
Add mount_nfs(8) to fetch sets over NFS

bsd.rd and miniroot72.img fit, boot and install over NFS with this.

OK deraadt

2 years agoAdd regress coverage for TLS exporters.
jsing [Sat, 5 Nov 2022 21:58:24 +0000 (21:58 +0000)]
Add regress coverage for TLS exporters.

2 years agoclockintr(9): initial commit
cheloha [Sat, 5 Nov 2022 19:29:45 +0000 (19:29 +0000)]
clockintr(9): initial commit

clockintr(9) is a machine-independent clock interrupt scheduler.  It
emulates most of what the machine-dependent clock interrupt code is
doing on every platform.  Every CPU has a work schedule based on the
system uptime clock.  For now, every CPU has a hardclock(9) and a
statclock().  If schedhz is set, every CPU has a schedclock(), too.

This commit only contains the MI pieces.  All code is conditionally
compiled with __HAVE_CLOCKINTR.  This commit changes no behavior yet.

At a high level, clockintr(9) is configured and used as follows:

1. During boot, the primary CPU calls clockintr_init(9).  Global state
   is initialized.
2. Primary CPU calls clockintr_cpu_init(9).  Local, per-CPU state is
   initialized.  An "intrclock" struct may be installed, too.
3. Secondary CPUs call clockintr_cpu_init(9) to initialize their
   local state.
4. All CPUs repeatedly call clockintr_dispatch(9) from the MD clock
   interrupt handler.  The CPUs complete work and rearm their local
   interrupt clock, if any, during the dispatch.
5. Repeat step (4) until the system shuts down, suspends, or hibernates.
6. During resume, the primary CPU calls inittodr(9) and advances the
   system uptime.
7. Go to step (2).  This time around, clockintr_cpu_init(9) also
   advances the work schedule on the calling CPU to skip events that
   expired during suspend.  This prevents a "thundering herd" of
   useless work during the first clock interrupt.

In the long term, we need an MI clock interrupt scheduler in order to
(1) provide control over the clock interrupt to MI subsystems like
timeout(9) and dt(4) to improve their accuracy, (2) provide drivers
like acpicpu(4) a means for slowing or stopping the clock interrupt on
idle CPUs to conserve power, and (3) reduce the amount of duplicated
code in the MD clock interrupt code.

Before we can do any of that, though, we need to switch every platform
over to using clockintr(9) and do some cleanup.

Prompted by "the vmm(4) time bug," among other problems, and a
discussion at a2k19 on the subject.  Lots of design input from
kettenis@.  Early versions reviewed by kettenis@ and mlarkin@.
Platform-specific help and testing from kettenis@, gkoehler@,
mlarkin@, miod@, aoyama@, visa@, and dv@.  Babysitting and spiritual
guidance from mlarkin@ and kettenis@.

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

2 years agoBump version number so that it's easier to see if the running version has
patrick [Sat, 5 Nov 2022 19:01:51 +0000 (19:01 +0000)]
Bump version number so that it's easier to see if the running version has
the bugfixes in.

ok kettenis@

2 years agoNot every device tree we're getting passed has an /aliases or /chosen node,
patrick [Sat, 5 Nov 2022 19:00:31 +0000 (19:00 +0000)]
Not every device tree we're getting passed has an /aliases or /chosen node,
but our code assumes so.  It's useful to have them, so create them if they
do not exist.

ok kettenis@

2 years agoActivate the device tree we just loaded from disk. While this doesn't fix
patrick [Sat, 5 Nov 2022 18:58:24 +0000 (18:58 +0000)]
Activate the device tree we just loaded from disk.  While this doesn't fix
any current bug, it might catch issues in the future.

ok kettenis@

2 years agoMake sure fdt_find_node() returns NULL if it can't find the requested node.
patrick [Sat, 5 Nov 2022 18:56:09 +0000 (18:56 +0000)]
Make sure fdt_find_node() returns NULL if it can't find the requested node.

ok kettenis@

2 years agoThe /var/run/ld.so.hints file is mapped into memory. It is never replaced,
deraadt [Sat, 5 Nov 2022 18:48:31 +0000 (18:48 +0000)]
The /var/run/ld.so.hints file is mapped into memory.  It is never replaced,
so the mapping can be immutable.
ok kettenis

2 years agoteach ld.so how to call the mimmutable() system call
deraadt [Sat, 5 Nov 2022 18:44:09 +0000 (18:44 +0000)]
teach ld.so how to call the mimmutable() system call
ok kettenis

2 years agopowerpc64: TimeBase: add userspace timecounting support
cheloha [Sat, 5 Nov 2022 16:23:02 +0000 (16:23 +0000)]
powerpc64: TimeBase: add userspace timecounting support

Tested by gkoehler@.

ok gkoehler@

2 years ago"need root privileges" is an error, print it on stderr"
kn [Sat, 5 Nov 2022 12:06:05 +0000 (12:06 +0000)]
"need root privileges" is an error, print it on stderr"

2 years agoPrint full path in usage; OK jmc
kn [Sat, 5 Nov 2022 12:03:58 +0000 (12:03 +0000)]
Print full path in usage; OK jmc

2 years agoFix missing variable declaration in regress, thanks Anton Lindqvist for the report
job [Sat, 5 Nov 2022 10:32:51 +0000 (10:32 +0000)]
Fix missing variable declaration in regress, thanks Anton Lindqvist for the report

2 years agoFor textrel binaries, skipping immutability on text segments is not enough:
deraadt [Sat, 5 Nov 2022 10:31:16 +0000 (10:31 +0000)]
For textrel binaries, skipping immutability on text segments is not enough:
It needs to be all non-writeable segments, which really means rodata.
crt0 and ld.so will need to call mimmutable() later on these regions.
ok kettenis

2 years agomatch on Intel 500 Series HD Audio (0x43c8)
jsg [Sat, 5 Nov 2022 00:12:39 +0000 (00:12 +0000)]
match on Intel 500 Series HD Audio (0x43c8)

on a Lenovo ThinkPad P1 Gen 4, the audio device is subclass audio not
hd audio, so azalia does not match

reported by John Browning
ok kettenis@ thfr@

2 years agoDo not fail on non-rsync URIs in EE cert SIA extensions
tb [Fri, 4 Nov 2022 23:52:59 +0000 (23:52 +0000)]
Do not fail on non-rsync URIs in EE cert SIA extensions

The spec allows multiple accessMethod entries, ordered by preference.
While an rsync URI must be present, others are allowed. Do not fail
in that situation and pick the first rsync URI encountered. The logic
is very similar to the one in x509_get_crl().

ok job

2 years agoIn very verbose mode, log unexpected accessMethods
tb [Fri, 4 Nov 2022 23:42:56 +0000 (23:42 +0000)]
In very verbose mode, log unexpected accessMethods

While RFC 6487, 4.8.2.2 is very explicit about allowing id-ad-signedObject
as the only accessMethod, the clear language was lost during the RFC 8182
editing process. APNIC, TWNIC and JPNIC and a few others are currently
known to have an id-ad-rpkiNotify. The verbose logging allows us to check
the ecosystem while waiting for the point in time where we can turn this
into an error. See also https://www.rfc-editor.org/errata/eid7239.

ok job

2 years agoFormat filemode output in a tabular fashion to improve readability
job [Fri, 4 Nov 2022 17:39:36 +0000 (17:39 +0000)]
Format filemode output in a tabular fashion to improve readability

OK tb@ claudio@

2 years agoEFI firmware has bugs which may mean that calling EFI runtime services will
kettenis [Fri, 4 Nov 2022 16:49:31 +0000 (16:49 +0000)]
EFI firmware has bugs which may mean that calling EFI runtime services will
fault because it does memory accesses outside of the regions it told us to
map.  Try to mitigate this by installing a fault handler (using the
pcb_onfault mechanism) and bail out using longjmp(9) if we encounter a
page fault while executing an EFI runtime services call.

Since some firmware bugs result in us executing code that isn't mapped,
make kpageflttrap() handle execution faults as well as data faults.

ok guenther@

2 years agoallow "=" to be "hey only the default value" for pkgspec in dependencies
espie [Fri, 4 Nov 2022 13:22:15 +0000 (13:22 +0000)]
allow "=" to be "hey only the default value" for pkgspec in dependencies
to be used later once it's in snaps.

2 years agoAdd missing field initializer.
tb [Fri, 4 Nov 2022 13:01:19 +0000 (13:01 +0000)]
Add missing field initializer.

ok claudio

2 years agoIn ktrace execve(2) no longer shows meaningless exit code.
bluhm [Fri, 4 Nov 2022 12:59:26 +0000 (12:59 +0000)]
In ktrace execve(2) no longer shows meaningless exit code.
Change regex for kdump output to execve JUSTRETURN.
from anton@

2 years agowhitespace
tb [Fri, 4 Nov 2022 12:05:36 +0000 (12:05 +0000)]
whitespace

2 years agoExtend l3vpn test to insert and remove a route
claudio [Fri, 4 Nov 2022 11:33:26 +0000 (11:33 +0000)]
Extend l3vpn test to insert and remove a route

Also add some scaffolding for IPv6 testing but currently IPv6 is broken
because mpe(4) is unable to configure a local IPv6 address.

2 years agoCatch bad characters in rpkiManifest filenames earlier on
job [Fri, 4 Nov 2022 10:09:09 +0000 (10:09 +0000)]
Catch bad characters in rpkiManifest filenames earlier on

This improves the hard-to-read error:

rpki-client: .rrdp/59B96A4C078FDCEDBB776D5BE8DF45EAC0149157547270EA7D4647A76611E145/rpki-rsync.us-east-2.amazonaws.com/volume/220c3ec2-ccf9-4b8a-bf61-fd4d1e151271/LAXNBPgDnLLjagP8++RFIoaMCGo.mft: RFC 6487 section 4.8.6: CRL: bad CRL distribution point extension
rpki-client: rpki-rsync.us-east-2.amazonaws.com/volume/220c3ec2-ccf9-4b8a-bf61-fd4d1e151271/LAXNBPgDnLLjagP8++RFIoaMCGo.mft: no valid mft available

to:

rpki-client: rpki.ripe.net/repository/DEFAULT/ZMvVW3ZpjFaCVe2TtDEqMlyFk3E.cer: SIA: rpkiManifest filename contains invalid characters

OK tb@

2 years agoDon't show CPS URIs when in filemode
job [Fri, 4 Nov 2022 09:45:19 +0000 (09:45 +0000)]
Don't show CPS URIs when in filemode

OK tb@

2 years agoCheck the SIA signedObject in ROA/MFT/ASPA/TAK/GBR EE certificates
job [Fri, 4 Nov 2022 09:43:13 +0000 (09:43 +0000)]
Check the SIA signedObject in ROA/MFT/ASPA/TAK/GBR EE certificates

Unfortunately we can't yet error out when accessMethods other than
signedObject are encountered in the SubjectInformationAccess extension
because there is pollution in the ecosystem.

OK tb@

2 years agoAssert the VM map lock is held in function used by mmap/mprotect/munmap.
mpi [Fri, 4 Nov 2022 09:36:44 +0000 (09:36 +0000)]
Assert the VM map lock is held in function used by mmap/mprotect/munmap.

Also grab the lock in uvm_map_teardown() and uvm_map_deallocate() to
satisfy the assertions.  Grabbing the lock there shouldn't be strictly
necessary, because no other reference to the map should exist when the
reaper is holding it, but it doesn't hurt and makes our life easier.

Inputs & tests from Ivo van der Sangen, tb@, gnezdo@, kn@

kettenis@ and tb@ agree with the direction, ok kn@

2 years agoUnescape the string for the literal operator (l:) so special characters
nicm [Fri, 4 Nov 2022 08:03:23 +0000 (08:03 +0000)]
Unescape the string for the literal operator (l:) so special characters
work.

2 years agoriscv64 pmap: flush memory writes before remote sfence.vma
jca [Thu, 3 Nov 2022 23:30:55 +0000 (23:30 +0000)]
riscv64 pmap: flush memory writes before remote sfence.vma

As pointed out by the RISC-V privileged spec.  Sadly this is not enough
to solve all existing userland or kernel crashes seen on Unmatched (and
possibly other?) machines.

ok kettenis@

2 years agoZap unused variable
jca [Thu, 3 Nov 2022 23:26:49 +0000 (23:26 +0000)]
Zap unused variable

ok kettenis@

2 years agoreplace recently-added valid_domain() check for hostnames going to
djm [Thu, 3 Nov 2022 21:59:20 +0000 (21:59 +0000)]
replace recently-added valid_domain() check for hostnames going to
known_hosts with a more relaxed check for bad characters; previous
commit broke address literals. Reported by/feedback from florian@

2 years agoWhen decoding a sequence/set, make sure that:
martijn [Thu, 3 Nov 2022 17:58:10 +0000 (17:58 +0000)]
When decoding a sequence/set, make sure that:
- We don't create an uninitialized element when there are no subelements to
  decode
- If subelements overflow we return EINVAL

While here fix an eyesore of a line continuation.

OK claudio@

2 years agodon't needlessy uppercase Nd;
jmc [Thu, 3 Nov 2022 17:43:39 +0000 (17:43 +0000)]
don't needlessy uppercase Nd;

2 years agoEnable smbios0 on arm64 RAMDISK so the code mitigating crashes on the x13s
patrick [Thu, 3 Nov 2022 17:41:22 +0000 (17:41 +0000)]
Enable smbios0 on arm64 RAMDISK so the code mitigating crashes on the x13s
gets correct info from hw.version.

2 years agoAdd an abolute minimal test for L3VPNs. Right now not linked since there
claudio [Thu, 3 Nov 2022 15:39:54 +0000 (15:39 +0000)]
Add an abolute minimal test for L3VPNs. Right now not linked since there
is a bug in the kroute code preventing the VPN route to be added properly.

2 years agoConstrain KeyUsage and ExtendedKeyUsage on both CA & EE certificates
job [Thu, 3 Nov 2022 10:39:19 +0000 (10:39 +0000)]
Constrain KeyUsage and ExtendedKeyUsage on both CA & EE certificates

RFC 6487 section 4.8.4 restricts the KeyUsage extension on EE
certificates to only be digitalSignature.

RFC 6487 section 4.8.5 forbids the ExtendedKeyUsage extension from
appearing on CA certificates. However, this may change in the future
through the standardisation process.

OK tb@

2 years agoIf there are no buffers, reset mode as soon as any key pressed. Fixes
nicm [Thu, 3 Nov 2022 08:41:53 +0000 (08:41 +0000)]
If there are no buffers, reset mode as soon as any key pressed. Fixes
crash reported by Gaoyang Zhang in GitHub issue 3373.