openbsd
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.

2 years agoAdd a -l flag to display-message to disable format expansion, from Aaron
nicm [Thu, 3 Nov 2022 08:33:57 +0000 (08:33 +0000)]
Add a -l flag to display-message to disable format expansion, from Aaron
Jensen. GitHub issue 3372.

2 years agoStyle: always use *retval and never retval[0] in syscalls,
guenther [Thu, 3 Nov 2022 04:56:47 +0000 (04:56 +0000)]
Style: always use *retval and never retval[0] in syscalls,
to reflect that retval is just a single return value.

ok miod@

2 years agoMake scdebug_ret() behave like ktrsysret(), showing the off_t value
guenther [Thu, 3 Nov 2022 04:52:41 +0000 (04:52 +0000)]
Make scdebug_ret() behave like ktrsysret(), showing the off_t value
for lseek() and a single register_t value for all others.

ok miod@

2 years agoshorten Autonomous System Provider Authorizations
job [Thu, 3 Nov 2022 00:48:31 +0000 (00:48 +0000)]
shorten Autonomous System Provider Authorizations

2 years agoAdd notion of ASPA
job [Thu, 3 Nov 2022 00:44:13 +0000 (00:44 +0000)]
Add notion of ASPA

2 years agoPermit only keyCertSign and CRLSign in CA KeyUsage extension
job [Thu, 3 Nov 2022 00:00:53 +0000 (00:00 +0000)]
Permit only keyCertSign and CRLSign in CA KeyUsage extension

OK tb@

2 years agoEmit warnings when unexpected X.509v3 extensions are encountered
job [Wed, 2 Nov 2022 23:20:59 +0000 (23:20 +0000)]
Emit warnings when unexpected X.509v3 extensions are encountered

OK tb@

2 years agoIntroduce conn_info() which combines http_info() and ip_info() to output
claudio [Wed, 2 Nov 2022 16:50:51 +0000 (16:50 +0000)]
Introduce conn_info() which combines http_info() and ip_info() to output
both the host/uri and IP address of a connection.

Adjust http_connect() error handling to make sure conn->res is set to the
last address when hitting the error condition after the loop.
OK tb@

2 years agoAdd regress for Signed TAL (.tak) files
job [Wed, 2 Nov 2022 12:56:38 +0000 (12:56 +0000)]
Add regress for Signed TAL (.tak) files

2 years agoReference RSC RFC-to-be instead of internet-draft
job [Wed, 2 Nov 2022 12:46:49 +0000 (12:46 +0000)]
Reference RSC RFC-to-be instead of internet-draft

2 years agoAdd support for draft-ietf-sidrops-signed-tal-12
job [Wed, 2 Nov 2022 12:43:02 +0000 (12:43 +0000)]
Add support for draft-ietf-sidrops-signed-tal-12

Add support validation of Signed Objects containing Trust Anchor Keys
(TAKs - aka 'Signed TALs'). Signed TALs provide a mechanism for RIRs
to distribute and sign the next Trust Anchor with the current Trust
Anchor. This might be an improvement over visiting RIR websites and
copy+pasting TAL data by hand.

OK tb@

2 years agoDon't free the addrinfo array after connect and refactor http_finish_connect.
claudio [Wed, 2 Nov 2022 11:44:19 +0000 (11:44 +0000)]
Don't free the addrinfo array after connect and refactor http_finish_connect.

In http_connect_done() the addrinfo array was freed but this makes it
impossible to show the IP address of the connection in log messages.
Also refactor http_finish_connect() to call http_connect_failed() instead
of doing the same inline.
OK tb@

2 years agoLength check URI before strncasecmp()
tb [Wed, 2 Nov 2022 11:28:36 +0000 (11:28 +0000)]
Length check URI before strncasecmp()

A priori URI is not NUL terminated, so we should first check it is long
enough before comparing it against proto. As a side effect, this now
rejects "https://" and "rsync://", which are invalid due to the missing
host in the authority section.

ok claudio

2 years agoAlso print IP address of the connection that timed out to aid debugging
job [Wed, 2 Nov 2022 10:41:43 +0000 (10:41 +0000)]
Also print IP address of the connection that timed out to aid debugging

OK claudio@

2 years agoRemove audio(9) speaker_ctl(), let open() handle speakers where needed
kn [Wed, 2 Nov 2022 10:41:34 +0000 (10:41 +0000)]
Remove audio(9) speaker_ctl(), let open() handle speakers where needed

Only five legacy half-duplex hardware drivers require this function to
change between playing and recording:
i386: ess(4), gus(4), pas(4), sb(4)
luna88k: nec86(4)

If defined, it is always called early in audio_open(), so just move the
call from audio(4) to each hardware driver's open() handler.

SPKR_ON/OFF remain defined to leave driver-specific code unchanged.

Further cleanup (unchecked speaker_ctl() return values,
FWRITE -> AUMODE_PLAY -> SPKR_ON dances, etc.) can happen later.

Builds fine on i386.
OK ratchov

2 years agoFix x509_get_time() error checks
tb [Wed, 2 Nov 2022 10:04:41 +0000 (10:04 +0000)]
Fix x509_get_time() error checks

Like most x509_* functions, x509_get_time() returns 0/1 on error/success,
not -1/0.

ok claudio job

2 years agoInstead of always setting the extended flag, set it only when searching.
nicm [Wed, 2 Nov 2022 07:36:07 +0000 (07:36 +0000)]
Instead of always setting the extended flag, set it only when searching.
Allows send-keys to work. From Aaron Jensen.

2 years agoClean up more ancient history: since 2015 the libc stubs for
guenther [Wed, 2 Nov 2022 07:20:07 +0000 (07:20 +0000)]
Clean up more ancient history: since 2015 the libc stubs for
fork/vfork/__tfork haven't cared about the second return register.
So, stop setting retval[1] in kern_fork.c and stop setting the
second return register in the MD child_return() routines.

With the above, we have no multi-register return values on LP64,
so stop touching that register in the trapframe on those archs.

testing miod@ and aoyama@
ok miod@