openbsd
2 years agoRewrite RMD-160 tests to be table-driven.
tb [Fri, 2 Sep 2022 15:45:52 +0000 (15:45 +0000)]
Rewrite RMD-160 tests to be table-driven.

From Joshua Sing

2 years agowc(1): accelerate word counting
cheloha [Fri, 2 Sep 2022 15:21:40 +0000 (15:21 +0000)]
wc(1): accelerate word counting

wc(1) counts a word whenever a whitespace byte is followed by a
non-whitespace byte.  Because the state machine transition occurs
within the space of a single byte we don't need to use getline(3).

Counting words in a big buffer with read(2) is much faster.  The
overhead varies with the length of a line, but for files with 60-100
byte lines, word counting is about twice as fast when we avoid
getline(3).  In the pathological case where each line is a single
byte, word counting is about ten times as fast when we avoid
getline(3).

Link1: https://marc.info/?l=openbsd-tech&m=163715995626532&w=2
Link2: https://marc.info/?l=openbsd-tech&m=165956826103639&w=2

"Seems reasonable." deraadt@

2 years agoMove mkpath logic after checking for 'noop' to prevent creation of directories in...
job [Fri, 2 Sep 2022 15:09:19 +0000 (15:09 +0000)]
Move mkpath logic after checking for 'noop' to prevent creation of directories in -n mode

OK claudio@

2 years agoDon't ignore an OpenBSD GPT partition just because the GPT says
krw [Fri, 2 Sep 2022 14:18:47 +0000 (14:18 +0000)]
Don't ignore an OpenBSD GPT partition just because the GPT says
it extends beyond the edge of the disk the GPT currently
inhabits. We only care if enough of it is addressable that a
disklabel is accessible.

Brings GPT handling of 'OpenBSD partitions extending too far'
into line with the MBR handling of the same situation.

2 years agoFix TSO large receive offloading in ix(4).
jan [Fri, 2 Sep 2022 14:08:09 +0000 (14:08 +0000)]
Fix TSO large receive offloading in ix(4).

Without this diff it might happen that content of different
TCP connection get mixed up, when reading coalesced buffers
from the receive ring.

Thanks, for a lot of testing effort to mbuhl.

OK mbuhl@

2 years agoRetire the old crap. Thanks, Joshua
tb [Fri, 2 Sep 2022 13:46:23 +0000 (13:46 +0000)]
Retire the old crap. Thanks, Joshua

2 years agoUnhook the old md4 and md5 tests
tb [Fri, 2 Sep 2022 13:45:18 +0000 (13:45 +0000)]
Unhook the old md4 and md5 tests

2 years agoLink new md test to regress.
tb [Fri, 2 Sep 2022 13:38:56 +0000 (13:38 +0000)]
Link new md test to regress.

2 years agoNew md4/md5 regress tests
tb [Fri, 2 Sep 2022 13:34:48 +0000 (13:34 +0000)]
New md4/md5 regress tests

These exercise MD4 and MD5 with the test vectors from RFCs 1320 and 1321.

From Joshua Sing <joshua () hypera ! dev>

2 years agoregen
mbuhl [Fri, 2 Sep 2022 13:23:33 +0000 (13:23 +0000)]
regen

2 years agoAdd two const
tb [Fri, 2 Sep 2022 13:23:05 +0000 (13:23 +0000)]
Add two const

2 years agoMake test tables static const and fix a style nit
tb [Fri, 2 Sep 2022 13:21:32 +0000 (13:21 +0000)]
Make test tables static const and fix a style nit

2 years agoEnable apldc(4), apldchidev(4), apldckbd(4) and aplrtk(4) here as well.
kettenis [Fri, 2 Sep 2022 13:20:46 +0000 (13:20 +0000)]
Enable apldc(4), apldchidev(4), apldckbd(4) and aplrtk(4) here as well.

2 years agoadd the recvmmsg syscall that allows receiving multiple msghdrs at
mbuhl [Fri, 2 Sep 2022 13:18:06 +0000 (13:18 +0000)]
add the recvmmsg syscall that allows receiving multiple msghdrs at
once. libc, man page, and regress parts to come.
With input from jca@, guenther@, bluhm@.
OK bluhm@

2 years agoMove PRU_CONTROL request to (*pru_control)().
mvs [Fri, 2 Sep 2022 13:12:31 +0000 (13:12 +0000)]
Move PRU_CONTROL request to (*pru_control)().

The 'proc *' arg is not used for PRU_CONTROL request, so remove it from
pru_control() wrapper.

Split out {tcp,udp}6_usrreqs from {tcp,udp}_usrreqs and use them for
inet6 case.

ok guenther@ bluhm@

2 years agoRework the rsync proc code. Use a proper queue of requests and enforce
claudio [Fri, 2 Sep 2022 13:04:16 +0000 (13:04 +0000)]
Rework the rsync proc code. Use a proper queue of requests and enforce
the limit on that queue instead of stopping to read new messages.
This is needed to implement an abort request.
"There is not enough RB_TREE in this diff" tb@

2 years agoReduce differences to amd64.
mlarkin [Fri, 2 Sep 2022 12:46:18 +0000 (12:46 +0000)]
Reduce differences to amd64.

ok kettenis

2 years agoNuke TEMPLATE variable and just do it, like amd64/ramdisk_cd does.
krw [Fri, 2 Sep 2022 12:40:02 +0000 (12:40 +0000)]
Nuke TEMPLATE variable and just do it, like amd64/ramdisk_cd does.

ok deraadt@

2 years agoNuke variable partlba that is set but not used.
krw [Fri, 2 Sep 2022 12:28:12 +0000 (12:28 +0000)]
Nuke variable partlba that is set but not used.

2 years agoRelax GTP header validity check by allowing 1 sector size usable
krw [Fri, 2 Sep 2022 12:24:26 +0000 (12:24 +0000)]
Relax GTP header validity check by allowing 1 sector size usable
LBA area (gh_lba_start == gh_lba_end) and allowing either or both
of gh_lba_start and gh_lba_end to exceed the size of the disk the
GPT currently inhabits.

Reduces false negatives and inappropriate fall through to MBR
spoofing and allows repair of otherwise valid GPT.

2 years agoSimplify and clean up the ecdsa test a little. Use stdio instead of BIO
tb [Fri, 2 Sep 2022 11:47:25 +0000 (11:47 +0000)]
Simplify and clean up the ecdsa test a little. Use stdio instead of BIO
for output, use 'err' as a label and avoid some silly repetitions.

2 years agoRetire old SHA tests
tb [Fri, 2 Sep 2022 11:18:09 +0000 (11:18 +0000)]
Retire old SHA tests

The old tests were incomplete, some of them had no license and the code
quality was questionable. The new tests by Joshua Sing cover what they
did (and additionally SHA-224 and SHA-384). Many thanks!

2 years agoUnhook old SHA tests
tb [Fri, 2 Sep 2022 11:16:03 +0000 (11:16 +0000)]
Unhook old SHA tests

2 years agoAdd tests for 1 million repeated "a"
tb [Fri, 2 Sep 2022 11:13:34 +0000 (11:13 +0000)]
Add tests for 1 million repeated "a"

From Joshua Sing

2 years agosync
jsg [Fri, 2 Sep 2022 10:41:05 +0000 (10:41 +0000)]
sync

2 years agodrm/i915: Add new ADL-S pci id
jsg [Fri, 2 Sep 2022 10:39:31 +0000 (10:39 +0000)]
drm/i915: Add new ADL-S pci id

From Jose Roberto de Souza
in drm-intel-next

2 years agoregen
jsg [Fri, 2 Sep 2022 10:34:43 +0000 (10:34 +0000)]
regen

2 years agosync Intel ADL-S devices with Mesa git
jsg [Fri, 2 Sep 2022 10:34:07 +0000 (10:34 +0000)]
sync Intel ADL-S devices with Mesa git
adds 0x468b, removes 0x4691

2 years agoNow that boot blocks are able to parse ufs2, there is no need to force ufs1
miod [Fri, 2 Sep 2022 10:16:51 +0000 (10:16 +0000)]
Now that boot blocks are able to parse ufs2, there is no need to force ufs1
for the / file system. Brings landisk into the wonderful world of y2k38
compliance.

2 years agoAdd UFS2 support, with libsa for boot and with a specific ufs-and-ufs2-in-one
miod [Fri, 2 Sep 2022 10:15:35 +0000 (10:15 +0000)]
Add UFS2 support, with libsa for boot and with a specific ufs-and-ufs2-in-one
flavour for xxboot, due to its size constraints.

2 years agoAdd ufs2 to the list of filesystem, for the sake of boot blocks which do not
miod [Fri, 2 Sep 2022 10:14:02 +0000 (10:14 +0000)]
Add ufs2 to the list of filesystem, for the sake of boot blocks which do not
provide an explicit list of files to build in libsa.

2 years agoRemove non-_KERNEL code path for division by zero. This will allow the
miod [Fri, 2 Sep 2022 10:12:46 +0000 (10:12 +0000)]
Remove non-_KERNEL code path for division by zero. This will allow the
bootblocks to shrink a little.

2 years agoWrite /etc/resolv.conf in a more atomic manner.
florian [Fri, 2 Sep 2022 09:39:55 +0000 (09:39 +0000)]
Write /etc/resolv.conf in a more atomic manner.

There were few reports were /etc/resolv.conf would lose user-managed
lines, possibly caused by a system crash.

While here add a call to fsync(2) which might also help.

input otto
input & OK deraadt, kn

2 years agoGet the retguard region's phys address from pmap, instead of using linker
mlarkin [Fri, 2 Sep 2022 09:02:37 +0000 (09:02 +0000)]
Get the retguard region's phys address from pmap, instead of using linker
script symbols. This is needed since we don't have those symbols on all
archs where we want hibernate.

ok kettenis, and input and help from miod.

2 years agoAdd softraid(4) RAID 1C boot support
kn [Fri, 2 Sep 2022 08:13:03 +0000 (08:13 +0000)]
Add softraid(4) RAID 1C boot support

Equivalent of sys/arch/arm64/stand/efiboot/softraid_arm64.c r1.4:
(commitid: Ka484R3swI5xSRWO) "Add softraid(4) RAID 1C boot support".

Tell the boot loader to decrypt 1C like C volumes and check the number of
disks in 1C like in 1C volumes -- no new code rquired.

Tested on T4-2 guest domains
"Looks reasonable" kettenis
OK stsp

NB: While kernel and boot loader support root on softraid on sparc64,
installboot(8) still needs a pending fix for installations on multi-chunk
softraid volumes.  Until then, the usual installation process will fail on
1C volumes and requires manual fixup.

2 years agoAdopt a terser specification of an MBR partition table of
krw [Fri, 2 Sep 2022 07:46:03 +0000 (07:46 +0000)]
Adopt a terser specification of an MBR partition table of
64 zeros, suggested by miod@ a while ago.

ok mlarkin@

2 years agoMake newer mime type definitions take precedence over existing ones.
benno [Fri, 2 Sep 2022 07:38:14 +0000 (07:38 +0000)]
Make newer mime type definitions take precedence over existing ones.

Patch from Ben Fuller <ben -AT- bvnf -DOT- space>,
helped along by florian@
ok florian@ and some mumblings from claudio who does not want okays in httpd.

2 years agoopenpty() family of functions use /dev/ptm PTMGET to open a master+slave fd
deraadt [Fri, 2 Sep 2022 07:37:57 +0000 (07:37 +0000)]
openpty() family of functions use /dev/ptm PTMGET to open a master+slave fd
pair, and also provides their names.  Internally, 3 NDINIT+namei operations
access /dev/[tp]ty[p-zP-T][0-9a-zA-Z], of these 2 followed unveil restrictions.
I argue if you unveil /dev/ptm, (and not the 372 other nodes), you still want
openpty() to provide you with working fd's, and the names, which the caller
will probably never open manually, because the fd's are given.
So change all NDINIT to use KERNELPATH, bypassing unveil.
ok semarie

2 years agoThe sysORTable doesn't have 10 entries anymore.
martijn [Fri, 2 Sep 2022 07:07:45 +0000 (07:07 +0000)]
The sysORTable doesn't have 10 entries anymore.
Adjust the test for now to -Cr4, which isn't exactly in the spirit of the
test but fixes things for now.

Now that we have agentx I should write a backend with more predictable
output to make regress more stable.

pointed out by anton@

2 years agoUse a shorter system call invocation template for system calls in the range
miod [Fri, 2 Sep 2022 06:19:04 +0000 (06:19 +0000)]
Use a shorter system call invocation template for system calls in the range
0-127, where immediate addressing can be used to load the system call number
in r0, rather than performing a memory load using pc-relative addressing.

No functional change, but rm(1) runs a couple cycles faster per file now.

2 years agosk-usbhid: fix key_lookup() on tokens with built-in UV
djm [Fri, 2 Sep 2022 04:20:02 +0000 (04:20 +0000)]
sk-usbhid: fix key_lookup() on tokens with built-in UV

explicitly test whether the token performs built-in UV (e.g. biometric
tokens) and enable UV in that case. From Pedro Martelletto via GHPR#388

2 years agoZap IRR RFC reference for the 'bgpctl irrfilter' command which was deprecated in 6.6
job [Thu, 1 Sep 2022 22:24:40 +0000 (22:24 +0000)]
Zap IRR RFC reference for the 'bgpctl irrfilter' command which was deprecated in 6.6

2 years agovmm(4): send all port io emulation to userland
dv [Thu, 1 Sep 2022 22:01:40 +0000 (22:01 +0000)]
vmm(4): send all port io emulation to userland

Simplify things by sending any io exits from IN/OUT instructions
to userland instead of trying to emulate anything in the kernel.
vmm was sending most pertinent exits to vmd anyways, so this
functionally changes little.

An added benefit is this solves an issue reported by tb@ where i386
OpenBSD guests would probe for a pc keyboard repeatedly and cause
excessive vm exits. (The emulation in vmm was not properly handling
these port reads.)

While here, make the assignment of the VEI_DIR_{IN,OUT} enum values
not assume the underlying integer the compiler may assign.

ok mlarkin@

2 years agowhitespace
mlarkin [Thu, 1 Sep 2022 21:50:19 +0000 (21:50 +0000)]
whitespace

2 years agoAdd forest (-f) mode
job [Thu, 1 Sep 2022 21:15:54 +0000 (21:15 +0000)]
Add forest (-f) mode

In -f mode group & display parent/child process relationships using ASCII art.

Borrows heavily from Brian Somers' work on FreeBSD ps(1).

With input from deraadt@ and tb@

OK benno@ claudio@

2 years agougly whitespace
tb [Thu, 1 Sep 2022 20:36:25 +0000 (20:36 +0000)]
ugly whitespace

2 years agoMove PRU_CONNECT2 request to (*pru_connect2)().
mvs [Thu, 1 Sep 2022 18:21:22 +0000 (18:21 +0000)]
Move PRU_CONNECT2 request to (*pru_connect2)().

ok bluhm@

2 years agosync
sthen [Thu, 1 Sep 2022 18:18:24 +0000 (18:18 +0000)]
sync

2 years agochange part of entry description for tf from "cat" to "C/A/T";
jmc [Thu, 1 Sep 2022 18:15:04 +0000 (18:15 +0000)]
change part of entry description for tf from "cat" to "C/A/T";
from josiah frentsos

2 years agoFill the gaps for armv7, powerpc64 and riscv64
kn [Thu, 1 Sep 2022 17:23:36 +0000 (17:23 +0000)]
Fill the gaps for armv7, powerpc64 and riscv64

These still fail early on due to the opendev(3)/diskmap(4) race condition,
so only hook them up after the kernel is fixed.

Note to self: some distrib/${MACHINE}/ramdisk/install.md pass explicit
newfs(8) flags -- this might be needed here;  test once all the relevant
kernel and installboot(8) bugs are squashed and this regress suite can be
run normally.

2 years agowhitespace
mlarkin [Thu, 1 Sep 2022 17:07:09 +0000 (17:07 +0000)]
whitespace

2 years agod_bbsize and d_sbsize are entirely absent from the tree.
krw [Thu, 1 Sep 2022 15:48:51 +0000 (15:48 +0000)]
d_bbsize and d_sbsize are entirely absent from the tree.

Rename them d_spare2 and d_spare3.

ok otto@ as part of larger diff

2 years agofix unveil(2) in vmctl(8), unix socket needs :w:
benno [Thu, 1 Sep 2022 15:43:07 +0000 (15:43 +0000)]
fix unveil(2) in vmctl(8), unix socket needs :w:
ok mestre@ martijn@

2 years agoUpdate awk to Aug 30, 2022 version.
millert [Thu, 1 Sep 2022 15:21:28 +0000 (15:21 +0000)]
Update awk to Aug 30, 2022 version.
Various leaks and use-after-free issues plugged/fixed.

2 years agoCheck sk_SSL_CIPHER_push() return value
tb [Thu, 1 Sep 2022 15:19:16 +0000 (15:19 +0000)]
Check sk_SSL_CIPHER_push() return value

CID 24797

ok jsing

2 years agoAdd privilege separation to snmpd.
martijn [Thu, 1 Sep 2022 14:34:17 +0000 (14:34 +0000)]
Add privilege separation to snmpd.

This uses the just imported snmpd_metrics as a new (agentx-based) backend.
Snmpd(8) executes all files in /usr/libexec/snmpd and treats regions
registered by these binaries as authorative, so that no other agentx
backends can overwrite them. The snmpe process is now pledged
"stdio recvfd inet unix".

This removes quite a few entries from the sysORTable, but the current
entries are non-compliant anyway and should be completely revisisted at a
later time.

Reduces the time for a full walk by about a factor of 4, bringing us close
to the original speed before application.c was introduced.

General design discussed with claudio@
Tested by and OK sthen
Release build test and OK tb@

2 years agoadd checks that unveil() is doing the right thing irt. bind() and connect()
benno [Thu, 1 Sep 2022 14:23:25 +0000 (14:23 +0000)]
add checks that unveil() is doing the right thing irt. bind() and connect()

2 years agoHook up snmpd_metrics
martijn [Thu, 1 Sep 2022 14:22:55 +0000 (14:22 +0000)]
Hook up snmpd_metrics

OK tb@, sthen@

2 years agoImport snmpd_metrics.
martijn [Thu, 1 Sep 2022 14:20:32 +0000 (14:20 +0000)]
Import snmpd_metrics.

This contains snmpd's mib.c (and friends) adjusted for libagentx.
This standalone binary is to be used by snmpd to achieve privilege
separation.

If people need net-snmpd, but want some of the base snmpd metrics they can
start this binary as a normal daemon and connect to net-snmpd's agentx
socket.

Tested, Feedback, and OK sthen@
Release build test, and OK tb@

2 years agoLink sha test to regress
tb [Thu, 1 Sep 2022 14:03:29 +0000 (14:03 +0000)]
Link sha test to regress

2 years agoAdd a nicely licensed, table-driven test for SHA
tb [Thu, 1 Sep 2022 14:02:41 +0000 (14:02 +0000)]
Add a nicely licensed, table-driven test for SHA

This tests covers the NIST vectors for SHA-{1,224,256,384,256} and will
soon be able to replace the old SHA tests entirely.

From Joshua Sing <joshua () hypera ! dev>

2 years agoDrop support for unused attributes 'bs' (d_bbsize) and 'sb'
krw [Thu, 1 Sep 2022 13:56:21 +0000 (13:56 +0000)]
Drop support for unused attributes 'bs' (d_bbsize) and 'sb'
(d_sbsize).

ok otto@ as part of larger diff

2 years agoStop setting d_bbsize and d_sbsize. Nobody has paid
krw [Thu, 1 Sep 2022 13:45:26 +0000 (13:45 +0000)]
Stop setting d_bbsize and d_sbsize. Nobody has paid
any attention for some time.

ok otto@ as part of larger diff

2 years agoNuke comment about not using d_sbsize.
krw [Thu, 1 Sep 2022 13:37:57 +0000 (13:37 +0000)]
Nuke comment about not using d_sbsize.

ok otto@ as part of larger diff

2 years agod_bbsize and d_sbsize have become write-only fields.
krw [Thu, 1 Sep 2022 13:35:02 +0000 (13:35 +0000)]
d_bbsize and d_sbsize have become write-only fields.

No need to set them or check that they are set.

ok otto@ as part of larger diff

2 years agoAt the moment unveil(2) doesn't check the path for bind(2) or connect(2).
martijn [Thu, 1 Sep 2022 13:24:28 +0000 (13:24 +0000)]
At the moment unveil(2) doesn't check the path for bind(2) or connect(2).
This is about to change and connect(2) will require "w", not "r".

OK deraadt@ florian@ mestre@

2 years agoSwitch the rde_peer hashtable and peer list to a single RB tree.
claudio [Thu, 1 Sep 2022 13:23:24 +0000 (13:23 +0000)]
Switch the rde_peer hashtable and peer list to a single RB tree.
Only the RDE used a hashtable for lookups while the session engine
switched from a list to RB tree some time ago.
Use peer_foreach() in the mrt code instead of passing the peer list
as an argument.
OK benno@ tb@

2 years agoThis code no longer needs siphash.h and also cleanup some leftover
claudio [Thu, 1 Sep 2022 13:19:11 +0000 (13:19 +0000)]
This code no longer needs siphash.h and also cleanup some leftover
prototypes and members that were not removed in the previous RB tree
conversions.
OK benno@ tb@

2 years agothe VNDIOCSET ioctl path handling bypassed the unveil, so root (or .operator)
deraadt [Thu, 1 Sep 2022 12:28:53 +0000 (12:28 +0000)]
the VNDIOCSET ioctl path handling bypassed the unveil, so root (or .operator)
could read a file outside the space.
ok semarie benno tb

2 years agoFix logic bug
kn [Thu, 1 Sep 2022 08:52:30 +0000 (08:52 +0000)]
Fix logic bug

USE_SOFTRAID=Yes means the softraid volume itself *does* need to be
formatted.

2 years agoDelete force CHS remnants here too.
krw [Thu, 1 Sep 2022 08:18:20 +0000 (08:18 +0000)]
Delete force CHS remnants here too.

Makes file identical to amd64 version again.

ok mlarkin@

2 years agoremove exec_makecmds() and exec_runcmds() prototypes
jsg [Thu, 1 Sep 2022 07:26:56 +0000 (07:26 +0000)]
remove exec_makecmds() and exec_runcmds() prototypes
removed from kern_exec.c between NetBSD 0.9 and NetBSD 1.0

2 years agoAdd a new action: "configtest", to check configuration syntax of the daemon.
ajacoutot [Thu, 1 Sep 2022 07:25:32 +0000 (07:25 +0000)]
Add a new action: "configtest", to check configuration syntax of the daemon.
A few adjustments will be done in the next days (like disabling this action if
there's no specific rc_configtest function defined).

e.g.
/etc/rc.d/sshd configtest
rcctl configtest sshd

idea from naddy@

2 years agoDo not embed ident(1) strings in object code.
miod [Thu, 1 Sep 2022 05:49:04 +0000 (05:49 +0000)]
Do not embed ident(1) strings in object code.
ok daniel@ deraadt@ jca@

2 years agoremove ppath_destroy() prototype; function was never committed
jsg [Thu, 1 Sep 2022 05:40:46 +0000 (05:40 +0000)]
remove ppath_destroy() prototype; function was never committed

2 years agoremove sb_lock() prototype; removed in uipc_socket2.c 1.64
jsg [Thu, 1 Sep 2022 05:31:49 +0000 (05:31 +0000)]
remove sb_lock() prototype; removed in uipc_socket2.c 1.64

2 years agoremove unused prototypes from buf.h
jsg [Thu, 1 Sep 2022 05:24:51 +0000 (05:24 +0000)]
remove unused prototypes from buf.h

bufcache_getanycleanbuf() removed in vfs_bio.c 1.181
buf_acquire_unmapped() removed in vfs_biomem.c 1.22
buf_print() removed in vfs_bio.c 1.47
cluster_write() removed along with vfs_cluster.c in 2016

2 years agoDon't print device name on failure
kn [Thu, 1 Sep 2022 01:52:08 +0000 (01:52 +0000)]
Don't print device name on failure

Noticed by mistake (wanted `-l'):
# vnconfig l
vnd0
vnconfig: VNDIOCSET: No such file or directory

Same happens if you try to load a bogus file:
# vnconfig ./empty
vnd0
vnconfig: VNDIOCSET: Input/output error

In both cases, the info on stdout is useless as vnd0 is not used.
Defer printing the device until after the file is set up:
# ./obj/vnconfig l
vnconfig: VNDIOCSET: No such file or directory
# ./obj/vnconfig ./empty
vnconfig: VNDIOCSET: Input/output error

OK deraadt

2 years agoMinor internal target names and spacing tweaks, add dry-toofew test
kn [Thu, 1 Sep 2022 01:09:19 +0000 (01:09 +0000)]
Minor internal target names and spacing tweaks, add dry-toofew test

2 years agoAdd macppc bits, hook up installboot(8) tests on macppc
kn [Thu, 1 Sep 2022 00:43:14 +0000 (00:43 +0000)]
Add macppc bits, hook up installboot(8) tests on macppc

Default tests (USE_SOFTRAID=No, NDISKS=1) pass except for 'vnd0 ./ofwboot'
as reported on tech@ (fix pending).

2 years agots(1): parse user format string only once
cheloha [Thu, 1 Sep 2022 00:14:36 +0000 (00:14 +0000)]
ts(1): parse user format string only once

Currently, ts(1) reparses the user format string every time it prints
a timestamp.  This is wasteful.

If we isolate the parsing loop in fmtfmt() and move the rest of the
work into a new function, fmtprint(), we can cut some overhead out
of the hot loop.

We still need to update any microsecond substrings in the parsed
format string every time we print a timestamp.  So during parsing in
fmtfmt() we build a list of pointers to locations in the parsed buffer
where the microsecond substring needs to be copied during fmtprint().

With input from deraadt@.

Link1: https://marc.info/?l=openbsd-tech&m=165769139318084&w=2
Link2: https://marc.info/?l=openbsd-tech&m=165910022501353&w=2

OK job@

2 years agoHook up installboot(8) tests on sparc64
kn [Thu, 1 Sep 2022 00:13:35 +0000 (00:13 +0000)]
Hook up installboot(8) tests on sparc64

Default tests (USE_SOFTRAID=Yes, NDISKS='1 2') pass except for '-r mnt',
as mentioned (fix pending).

USE_SOFTRAID=no and/or NDISKS=1 make '-r mnt' work.

2 years agoIntroduce USE_SOFTRAID to allow testing on vnd(4) directly
kn [Wed, 31 Aug 2022 23:53:22 +0000 (23:53 +0000)]
Introduce USE_SOFTRAID to allow testing on vnd(4) directly

This is mostly for architectures which don't have softraid(4) support
in installboot(8), but should also be useful in general to test different
setups and thus increase coverage.

Default to root on softraid on vnd on all architectures that support it:
amd64, arm64, i386 and sparc64;  use root on vnd on others (yet to come).

2 years agoCompare equality of looked up node using pointers instead of
patrick [Wed, 31 Aug 2022 23:31:35 +0000 (23:31 +0000)]
Compare equality of looked up node using pointers instead of
strings, as the component name provided in the IORT might be
specified in a different way than our ACPI stack would do.

ok kettenis@

2 years agoSilence cleanup, rename internal setup targets for clarity
kn [Wed, 31 Aug 2022 23:10:01 +0000 (23:10 +0000)]
Silence cleanup, rename internal setup targets for clarity

2 years agoAlways run prepare
kn [Wed, 31 Aug 2022 22:54:41 +0000 (22:54 +0000)]
Always run prepare

Not all architectures require/implement -p, but installboot(8) provides stubs,
so leave it to the program to (not) do something.

2 years agouse the posix phrasing to improve the description of "shift";
jmc [Wed, 31 Aug 2022 22:27:14 +0000 (22:27 +0000)]
use the posix phrasing to improve the description of "shift";
nudge from luka krmpotic

2 years agoAdd an empty line for consistency.
tb [Wed, 31 Aug 2022 21:34:14 +0000 (21:34 +0000)]
Add an empty line for consistency.

2 years agoMove PRU_SENDOOB request to (*pru_sendoob)().
mvs [Wed, 31 Aug 2022 21:23:02 +0000 (21:23 +0000)]
Move PRU_SENDOOB request to (*pru_sendoob)().

PRU_SENDOOB request always consumes passed `top' and `control' mbufs. To
avoid dummy m_freem(9) handlers for all protocols release passed mbufs
in the pru_sendoob() EOPNOTSUPP error path.

Also fix `control' mbuf(9) leak in the tcp(4) PRU_SENDOOB error path.

ok bluhm@

2 years agoReplace "newfs_msdos" and "fsck_msdos" with "newfs -t msdos" and "fsck -t
krw [Wed, 31 Aug 2022 20:52:15 +0000 (20:52 +0000)]
Replace "newfs_msdos" and "fsck_msdos" with "newfs -t msdos" and "fsck -t
msdos".

Add some missing spaces after "=".

Constify the static strings.

Prodded a while ago by deraadt@, tweaks from kn@, ok kn@

2 years agoRecommit -r1.45 but without error checking EVP_PKEY_copy_parameters()
tb [Wed, 31 Aug 2022 20:49:37 +0000 (20:49 +0000)]
Recommit -r1.45 but without error checking EVP_PKEY_copy_parameters()

EVP_PKEY_copy_parameters() will unconditionally fail if the pkey's ameth
has no copy_params(). Obviously this is indistinguishable from actual
failure...

ok jsing

2 years agoSupport SMMUv3 IORT nodes as well in the midlayers. This allows IOMMU
patrick [Wed, 31 Aug 2022 20:49:12 +0000 (20:49 +0000)]
Support SMMUv3 IORT nodes as well in the midlayers.  This allows IOMMU
mappings to reach a future SMMUv3 implementation.

ok kettenis@, mlarkin@

2 years agoRename helper vars/files under obj/
kn [Wed, 31 Aug 2022 20:48:55 +0000 (20:48 +0000)]
Rename helper vars/files under obj/

Up-front cleanup for a future diff to run directly on vnd(4) without softraid(4).
No functional change.

2 years agoPut MD fdisk usage into new FORMAT_DISK, also softraid volume after chunks
kn [Wed, 31 Aug 2022 20:23:57 +0000 (20:23 +0000)]
Put MD fdisk usage into new FORMAT_DISK, also softraid volume after chunks

2 years agoRevert r1.46. Causes fireworks in regress.
tb [Wed, 31 Aug 2022 20:20:53 +0000 (20:20 +0000)]
Revert r1.46. Causes fireworks in regress.

2 years agoMSIs on the x13s are routed through both a "normal" SMMU and a "v3" SMMU.
kettenis [Wed, 31 Aug 2022 20:16:02 +0000 (20:16 +0000)]
MSIs on the x13s are routed through both a "normal" SMMU and a "v3" SMMU.
So handle this case in acpipci(4) and kill the hack to disable MSIs.

ok patrick@, mlarkin@, deraadt@

2 years agoLog copy of /ofwboot
kn [Wed, 31 Aug 2022 19:40:37 +0000 (19:40 +0000)]
Log copy of /ofwboot

Another step towards more consistent behaviour across platforms.

This leaves only hppa and landisk **not** logging such copies,
but I can't test on those.

OK miod

2 years agoDenote possible answers in the usual manner
kn [Wed, 31 Aug 2022 19:38:42 +0000 (19:38 +0000)]
Denote possible answers in the usual manner

OK miod

2 years agoMake installboot on landisk aware of a possible MBR on the disk, and in this
miod [Wed, 31 Aug 2022 18:46:06 +0000 (18:46 +0000)]
Make installboot on landisk aware of a possible MBR on the disk, and in this
case install the first level bootstrap at the beginning of the of the wd0a
filesystem, rather than at the beginning of the disk.

Both locations work but the previous behaviour overwriting an existing MBR
is a violation of POLA.

tweaks & ok krw@

2 years agorelayd(8): change agentx_getsock to return void
dv [Wed, 31 Aug 2022 16:17:18 +0000 (16:17 +0000)]
relayd(8): change agentx_getsock to return void

Only has one return value and it's never checked.

ok martijn@, tb@