openbsd
21 months agotypo, fix variable name
espie [Tue, 31 Jan 2023 13:53:49 +0000 (13:53 +0000)]
typo, fix variable name

21 months agoRemove the last ones route lock references from comments.
mvs [Tue, 31 Jan 2023 13:41:54 +0000 (13:41 +0000)]
Remove the last ones route lock references from comments.
No functional change.

21 months agoRoute lock was reverted, adjust forgotten commentary.
mvs [Tue, 31 Jan 2023 11:47:35 +0000 (11:47 +0000)]
Route lock was reverted, adjust forgotten commentary.
No functional changes.

21 months agoRemove the now empty bn_asm.c.
jsing [Tue, 31 Jan 2023 06:17:10 +0000 (06:17 +0000)]
Remove the now empty bn_asm.c.

This rather misnamed file (bn_asm.c) previously contained the C code that
was needed to build libcrypto bignum on platforms that did not have
assembly implementations of the functions it contained.

21 months agoSimplify bn_div_3_words().
jsing [Tue, 31 Jan 2023 06:08:23 +0000 (06:08 +0000)]
Simplify bn_div_3_words().

Make use of bn_umul_hilo() and remove the tangle of preprocessor directives
that implement different code paths depending on what defines exist.

ok tb@

21 months agoProvide inline assembly bn_umul_hilo() for alpha/powerpc64/riscv64.
jsing [Tue, 31 Jan 2023 05:57:08 +0000 (05:57 +0000)]
Provide inline assembly bn_umul_hilo() for alpha/powerpc64/riscv64.

These should work, but are currently untested and disabled.

ok tb@

21 months agoProvide inline assembly versions of bn_umul_hilo() for aarch64/amd64/i386.
jsing [Tue, 31 Jan 2023 05:53:49 +0000 (05:53 +0000)]
Provide inline assembly versions of bn_umul_hilo() for aarch64/amd64/i386.

ok tb@

21 months agoProvide bn_umul_hilo().
jsing [Tue, 31 Jan 2023 05:48:39 +0000 (05:48 +0000)]
Provide bn_umul_hilo().

The bignum code needs to be able to multiply two words, producing a
double word result. Some architectures do not have native support for
this, hence a pure C version is required. bn_umul_hilo() provides this
functionality.

There are currently two implementations, both of which are branch free.
The first uses bitwise operations for the carry, while the second uses
accumulators. The accumulator version uses fewer instructions, however
requires more variables/registers and seems to be slower, at least on
amd64/i386. The accumulator version may be faster on architectures that
have more registers available. Further testing can be performed and one
of the two implementations can be removed at a later date.

ok tb@

21 months agoCorrectly detect b < a in BN_usub().
jsing [Tue, 31 Jan 2023 05:16:52 +0000 (05:16 +0000)]
Correctly detect b < a in BN_usub().

BN_usub() requires that a >= b and should return an error in the case that
b < a. This is currently only detected by checking the number of words in
a versus b - if they have the same number of words, the top word is not
checked and b < a, which then succeeds and produces an incorrect result.

Fix this by checking for the case where a and b have an equal number of
words, yet there is a borrow returned from bn_sub_words().

ok miod@ tb@

21 months agoAdd bn/arch/${MACHINE_CPU} to the include path.
jsing [Tue, 31 Jan 2023 05:13:28 +0000 (05:13 +0000)]
Add bn/arch/${MACHINE_CPU} to the include path.

This will be needed once headers pull in bn_arch.h.

21 months agoAdd more regress tests for BN_usub().
jsing [Tue, 31 Jan 2023 05:12:16 +0000 (05:12 +0000)]
Add more regress tests for BN_usub().

This adds more tests for BN_usub(), particularly where b > a, which should
be an error condition. One of these currently succeeds and produces
incorrect results.

21 months agoRemove sparc related files from libcrypto.
jsing [Tue, 31 Jan 2023 05:09:34 +0000 (05:09 +0000)]
Remove sparc related files from libcrypto.

The sparc platform got retired a while back, however some parts remained
hiding in libcrypto. Mop these up (along with the bn_arch.h that I
introduced).

Spotted by and ok tb@

21 months agoExecute-only for macppc G5
gkoehler [Tue, 31 Jan 2023 01:27:58 +0000 (01:27 +0000)]
Execute-only for macppc G5

The G5 PowerPC 970 has a Data Address Compare mechanism that can trap
loads and stores to pages with PTE_AC_64, while allowing instruction
fetches.  Use this for execute-only mappings, like we do on powerpc64.

Add a check to pte_spill_v for execute-only mappings.  Without this,
we would forever retry reading an execute-only page.

In altivec_assist, copyin would fail to read the instruction from an
execute-only page.  Add copyinsn to bypass x-only, like sparc64.

with help from abieber@ deraadt@ kettenis@
ok deraadt@

21 months agopowerpc xonly for G5 is coming. ld.so can have xonly text.
deraadt [Tue, 31 Jan 2023 00:50:17 +0000 (00:50 +0000)]
powerpc xonly for G5 is coming.  ld.so can have xonly text.
ok gkoehler

21 months agovmd(8): fix an interrupt storm in ns8250.
dv [Mon, 30 Jan 2023 21:43:12 +0000 (21:43 +0000)]
vmd(8): fix an interrupt storm in ns8250.

On slower hosts, such as those in a nested virtualization scenario
of OpenBSD guest inside OpenBSD atop Linux KVM, ns8250 can cause a
race between the kevent firing and the vcpu being kicked by an
assert/deassert of the irq.

The end user experiences a "stuck" serial console and the host will
see a vmd process peg the cpu.

This change only toggles the irq if we were in a position of being
ready to receive data on the device so while the kevent might
continuously fire, the vcpu will not be kicked repeatedly.

OK mlarkin@

21 months agoRework cpu_init_secondary() such that it can be used for both the initial
kettenis [Mon, 30 Jan 2023 20:05:31 +0000 (20:05 +0000)]
Rework cpu_init_secondary() such that it can be used for both the initial
powerup and for wakeup from deeper sleep states.

Adjust cpu_suspen_primary() to use pmap_extract() to find the physical
address of the entry point and struct cpu_info.

ok phessler@

21 months agoFix logic of picmeup() to only produce one set of statements on OpenBSD; this
miod [Mon, 30 Jan 2023 19:26:16 +0000 (19:26 +0000)]
Fix logic of picmeup() to only produce one set of statements on OpenBSD; this
got accidentally lost in 1.4.

21 months agoExtend community unittests to cover more bits
claudio [Mon, 30 Jan 2023 17:02:48 +0000 (17:02 +0000)]
Extend community unittests to cover more bits

21 months agosync --execute-only archs described in the manual with current code
sthen [Mon, 30 Jan 2023 16:54:56 +0000 (16:54 +0000)]
sync --execute-only archs described in the manual with current code
ok deraadt

21 months agoSame parseextvalue() change as in parse.y rev 1.441
claudio [Mon, 30 Jan 2023 16:53:24 +0000 (16:53 +0000)]
Same parseextvalue() change as in parse.y rev 1.441
Use 2-byte ASnum encoding as a default when local-as/neighbor-as is used.

21 months agoAlter the way extended communities are matched when part of the value
claudio [Mon, 30 Jan 2023 16:51:34 +0000 (16:51 +0000)]
Alter the way extended communities are matched when part of the value
is auto-expanded or masked off.
Try to match against both 2- and 4-byte AS encoding and on insertion
check if expansion is actually possible and deny communities where both
community values are > USHRT_MAX.
OK tb@

21 months agoThe APM_IOC_NEXTEVENT ioctl was removed in the mickey era, remove
jcs [Mon, 30 Jan 2023 14:43:29 +0000 (14:43 +0000)]
The APM_IOC_NEXTEVENT ioctl was removed in the mickey era, remove
documentation about it

ok deraadt, miod

21 months agovmm(4): expose PKU cpuid bit if in use on host.
dv [Mon, 30 Jan 2023 14:05:36 +0000 (14:05 +0000)]
vmm(4): expose PKU cpuid bit if in use on host.

We are using {rd,wr}pkru instructions for saving and restoring the
PKRU, so tie the exposure of PKU feature bit to vmm having the
ability to properly handle the guest state.

21 months agopart of a future diff snuck into the previous commit
deraadt [Mon, 30 Jan 2023 11:21:26 +0000 (11:21 +0000)]
part of a future diff snuck into the previous commit

21 months agoremove unneeded includes in arch/i386
jsg [Mon, 30 Jan 2023 10:49:04 +0000 (10:49 +0000)]
remove unneeded includes in arch/i386
ok krw@ miod@

21 months agoReplace selwakeup() with KNOTE() in pppac(4) and pppx(4)
visa [Mon, 30 Jan 2023 03:31:59 +0000 (03:31 +0000)]
Replace selwakeup() with KNOTE() in pppac(4) and pppx(4)

Use the same mutex for read and write side klists. It would be overkill
to have dedicated locks.

Remove klist_invalidate() from pppacclose() because pppac(4) does not
have forced device detach. When the close routine gets called, there
should be no open file descriptors pointing the device, and consequently
the klists should be empty.

OK mvs@

21 months agovmm(4): save and restore guest pkru.
dv [Mon, 30 Jan 2023 02:32:01 +0000 (02:32 +0000)]
vmm(4): save and restore guest pkru.

Take a simple approach for saving and restoring PKRU if the host
has PKE support enabled. Uses explicit rdpkru/wrpkru instructions
for now instead of xsave.

This functionality is still gated behind amd64 pmap checking for
operation under a hypervisor as well as vmm masking the cpuid bit
for PKU.

"if your diff is good, then commit it" -deraadt@

21 months agoWe have determined that enough HV have correct PKU handling now,
deraadt [Mon, 30 Jan 2023 00:10:39 +0000 (00:10 +0000)]
We have determined that enough HV have correct PKU handling now,
so don't be paranoid about it anymore.  What does this mean?  If the HV
above you is broken, userland programs in the guest could crash, the guest
might even be quite unusable.  So fix the hypervisor.  The best way to
raise the bar on hypervisor quality is for guests to behave like they
are on a real machine, and then sucky hypervisors have to get fixed.
ps.  if using vmd as your hypervisor, use syspatch...

21 months agoAccumulate intermediate imutables locally before applying
gnezdo [Sun, 29 Jan 2023 20:30:56 +0000 (20:30 +0000)]
Accumulate intermediate imutables locally before applying

OK deraadt

21 months agoUnite all nitems copies in ld.so/util.h
gnezdo [Sun, 29 Jan 2023 20:30:21 +0000 (20:30 +0000)]
Unite all nitems copies in ld.so/util.h

OK deraadt

21 months agosign another typo
deraadt [Sun, 29 Jan 2023 16:23:15 +0000 (16:23 +0000)]
sign another typo

21 months ago32-bit powerpc should also allow the --exec-only flag.
deraadt [Sun, 29 Jan 2023 16:09:32 +0000 (16:09 +0000)]
32-bit powerpc should also allow the --exec-only flag.
but it isn't the default yet

21 months agoUse utime in order to make benchmarks less noisy and more consistent.
jsing [Sun, 29 Jan 2023 15:51:26 +0000 (15:51 +0000)]
Use utime in order to make benchmarks less noisy and more consistent.

21 months agoSet BN_FLG_CONSTTIME on benchmark inputs.
jsing [Sun, 29 Jan 2023 15:33:43 +0000 (15:33 +0000)]
Set BN_FLG_CONSTTIME on benchmark inputs.

The public APIs still change behaviour based on BN_FLG_CONSTTIME - set it
to avoid benchmark noise.

21 months agoAdd benchmarks for BN_div()
jsing [Sun, 29 Jan 2023 15:26:55 +0000 (15:26 +0000)]
Add benchmarks for BN_div()

21 months agoCorrect setup for BN_mul/BN_sqr benchmarks.
jsing [Sun, 29 Jan 2023 15:22:12 +0000 (15:22 +0000)]
Correct setup for BN_mul/BN_sqr benchmarks.

BN_rand() takes a bit length, not the top bit.

21 months agoRename bn_mul.c regress to bn_mul_div.c.
jsing [Sun, 29 Jan 2023 15:18:49 +0000 (15:18 +0000)]
Rename bn_mul.c regress to bn_mul_div.c.

21 months agoRemove the now empty/unused bn_depr.c.
jsing [Sun, 29 Jan 2023 14:06:58 +0000 (14:06 +0000)]
Remove the now empty/unused bn_depr.c.

21 months agoUse s2n-bignum assembly implementations for libcrypto bignum on amd64.
jsing [Sun, 29 Jan 2023 14:00:41 +0000 (14:00 +0000)]
Use s2n-bignum assembly implementations for libcrypto bignum on amd64.

This switches the core bignum assembly implementations from x86_64-gcc.c to
s2n-bignum for amd64.

ok miod@ tb@

21 months agoFix ^^D and 0^D description; pointed out by Tomas Rippl; ok jmc@
otto [Sun, 29 Jan 2023 09:28:57 +0000 (09:28 +0000)]
Fix ^^D and 0^D description; pointed out by Tomas Rippl; ok jmc@

21 months agopowerpc64 xonly works; ld.so can be switched over
deraadt [Sun, 29 Jan 2023 07:37:34 +0000 (07:37 +0000)]
powerpc64 xonly works; ld.so can be switched over

21 months agosync
tb [Sat, 28 Jan 2023 21:24:40 +0000 (21:24 +0000)]
sync

21 months agosync
deraadt [Sat, 28 Jan 2023 21:17:58 +0000 (21:17 +0000)]
sync

21 months agosync
tb [Sat, 28 Jan 2023 19:15:05 +0000 (19:15 +0000)]
sync

21 months agoStop installing x509_verify.h
tb [Sat, 28 Jan 2023 19:14:38 +0000 (19:14 +0000)]
Stop installing x509_verify.h

ok jsing

21 months agoSwitch regress to using x509_verify.h from libcrypto instead of the
tb [Sat, 28 Jan 2023 19:12:20 +0000 (19:12 +0000)]
Switch regress to using x509_verify.h from libcrypto instead of the
one in /usr/include/openssl.

21 months agoStop relying on x509_verify.h being public
tb [Sat, 28 Jan 2023 19:08:09 +0000 (19:08 +0000)]
Stop relying on x509_verify.h being public

Use x509_verify.h from the libcrypto sources instead of the public copy.

The x509_verify.h header was installed as a public header since early on
we had ideas of using a public API in libtls, but we eventually decided
against that. It makes no sense to install a public header that hides
everything behind LIBRESSL_INTERNAL. The public API will not be exposed
anytime soon if at all.

ok jsing

21 months agocreate enough wskbd* device nodes at runtime in the ramdisk so we can set
phessler [Sat, 28 Jan 2023 18:44:31 +0000 (18:44 +0000)]
create enough wskbd* device nodes at runtime in the ramdisk so we can set
the keyboard layout on all of them during install.

tested with a Thinkpad X13s with a silly amount of kezboards connected.

OK miod@ kn@

21 months agoinstall sbin/kbd on arm64's ramdisk, so a user can set a keyboard layout if
phessler [Sat, 28 Jan 2023 18:40:53 +0000 (18:40 +0000)]
install sbin/kbd on arm64's ramdisk, so a user can set a keyboard layout if
they are using a glass console and kezboard.

tested with a Thinkpad X13s with a DE kezboard.

OK deraadt@ miod@ kn@

21 months agoPermit the --exec-only option on i386 also. This does not make it the default.
deraadt [Sat, 28 Jan 2023 17:58:58 +0000 (17:58 +0000)]
Permit the --exec-only option on i386 also.  This does not make it the default.

I wonder if we should allow --exec-only option on all architectures
(but not as default), because this pre-check list now covers all
architectures, and we haven't seen a ld.lld problem.  We only switch
an architecture to --exec-only default when other aspects (mostly
compiler or .S files), that is a seperate switch block.

Even though i386 has no mmu means to enforce xonly, uvm will fail a
memcpy read of region which hasn't been previously faulted (by
executing code in the region). This definately blocks reads of
"contigious entire libc text", because very few programs "execute code
in all libc code pages", even with uvm_fault's behaviour of wide
faulting a 32K region.  The random relinking also means an attacker
cannot know what subset of libc text can be read because pre-faulted
chunks are unknown, but now they can't copy it all (if they could find
the location and bounds).  This neat behaviour applies to all
architectures.  It seems we should try to always hint text segment
permission as PROT_EXEC-only to the kernel and be happy that blocks a
read, even if that blocking isn't 100% reliable.

note: unfortunately binutils --exec-only isn't bug-free yet on most
architectures, taking the same approach there will take longer.

21 months agoRemove comment referencing bn_depr.c.
jsing [Sat, 28 Jan 2023 17:13:26 +0000 (17:13 +0000)]
Remove comment referencing bn_depr.c.

21 months agoMove the three functions that are in bn_depr.c back to bn_prime.c.
jsing [Sat, 28 Jan 2023 17:09:00 +0000 (17:09 +0000)]
Move the three functions that are in bn_depr.c back to bn_prime.c.

They should go away, but they have not yet disappeared and this
consolidates the source files.

Discussed with tb@

21 months agoMove the more readable version of bn_mul_mont() from bn_asm.c to bn_mont.c.
jsing [Sat, 28 Jan 2023 17:07:02 +0000 (17:07 +0000)]
Move the more readable version of bn_mul_mont() from bn_asm.c to bn_mont.c.

Nothing actually uses this code, as OPENSSL_BN_ASM_MONT is not defined
unless there is an assembly implementation available (not to mention that
defining both OPENSSL_NO_ASM and OPENSSL_BN_ASM_MONT at the same time is
extra strange).

Discussed with tb@

21 months agoFix previous.
jsing [Sat, 28 Jan 2023 16:58:24 +0000 (16:58 +0000)]
Fix previous.

21 months agoProvide bn_div_rem_words() and make use of it.
jsing [Sat, 28 Jan 2023 16:33:34 +0000 (16:33 +0000)]
Provide bn_div_rem_words() and make use of it.

Provide a function that divides a double word (h:l) by d, returning the
quotient q and the remainder r, such that q * d + r is equal to the
numerator. Call this from the three places that currently implement this
themselves.

This is implemented with some slight indirection, which allows for per
architecture implementations, replacing the define/macro tangle, which
messes with variables that are not passed to it.

Also remove a duplicate of bn_div_words() for the BN_ULLONG && BN_DIV2W
case - this is already handled.

ok tb@

21 months agoMove some header definitions from vmm(4) to vmd(8).
dv [Sat, 28 Jan 2023 14:40:53 +0000 (14:40 +0000)]
Move some header definitions from vmm(4) to vmd(8).

Part of an ongoing effort to move userland-specific information out
of a kernel header and directly into vmd(8). No functional change.

ok mlarkin@

21 months agoNuke unused variable.
krw [Sat, 28 Jan 2023 13:14:01 +0000 (13:14 +0000)]
Nuke unused variable.

21 months agosync
deraadt [Sat, 28 Jan 2023 11:47:25 +0000 (11:47 +0000)]
sync

21 months agoMake --execute-only the default on powerpc64. Sort case statements in
kettenis [Sat, 28 Jan 2023 11:13:59 +0000 (11:13 +0000)]
Make --execute-only the default on powerpc64.  Sort case statements in
alphabetical order while I'm there.

ok deraadt@

21 months agoUpdate the number of default wskbd entries
phessler [Sat, 28 Jan 2023 11:04:47 +0000 (11:04 +0000)]
Update the number of default wskbd entries

OK deraadt@

21 months agoRevert the `rt_lock' rwlock(9) diff to fix the recursive
mvs [Sat, 28 Jan 2023 10:17:16 +0000 (10:17 +0000)]
Revert the `rt_lock' rwlock(9) diff to fix the recursive
rwlock(9) acquisition.

Reported-by: syzbot+fbe3acb4886adeef31e0@syzkaller.appspotmail.com
21 months agotypo in comment
deraadt [Sat, 28 Jan 2023 05:58:47 +0000 (05:58 +0000)]
typo in comment

21 months agoOnly use the CPU_OFF PSCI call if SYSTEM_SUSPEND is supported. This means
kettenis [Fri, 27 Jan 2023 23:11:59 +0000 (23:11 +0000)]
Only use the CPU_OFF PSCI call if SYSTEM_SUSPEND is supported.  This means
that secondary CPUs will get parked in a WFI loop like we already do on
Apple Silicon systems.  This requires some small changes in agintc(4) to
make sure we ack the "halt" IPI such that we can send a "wakeup" IPI later.

ok patrick@

21 months agodmtimer(4): initialize stathz, profhz as other drivers, platforms do
cheloha [Fri, 27 Jan 2023 22:16:52 +0000 (22:16 +0000)]
dmtimer(4): initialize stathz, profhz as other drivers, platforms do

Don't hardcode stathz to 100 and profhz to 1000.  Instead, set stathz
to hz and profhz to (stathz * 10).  This is what we do in all other
armv7 clock interrupt drivers and most other platforms.

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

21 months agopowerpc64: initialize stathz, profhz as on other platforms
cheloha [Fri, 27 Jan 2023 22:14:43 +0000 (22:14 +0000)]
powerpc64: initialize stathz, profhz as on other platforms

Don't hardcode stathz to 100 and profhz to 1000.  Instead, set stathz
to hz and profhz to (stathz * 10).  This is what we do on most other
platforms.

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

21 months agomacppc: initialize stathz, profhz as on other platforms
cheloha [Fri, 27 Jan 2023 22:13:48 +0000 (22:13 +0000)]
macppc: initialize stathz, profhz as on other platforms

Don't hardcode stathz to 100 and profhz to 1000.  Instead, set stathz
to hz and profhz to (stathz * 10).  This is what we do on most other
platforms.

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

21 months agoRecommit the switch to use llvm-strip on architectures that use ld.lld.
kettenis [Fri, 27 Jan 2023 22:01:02 +0000 (22:01 +0000)]
Recommit the switch to use llvm-strip on architectures that use ld.lld.

ok naddy@, sthen@

21 months agoChange the emitted .glink stub on powerpc64 to use an instruction sequence
kettenis [Fri, 27 Jan 2023 21:35:02 +0000 (21:35 +0000)]
Change the emitted .glink stub on powerpc64 to use an instruction sequence
to compose the offset to the PLT instead of having a constant pool in .text.
Make --execute-only work on powerpc64.

ok miod@

21 months agoPush solock() down to sogetopt(). It is not required for the most cases.
mvs [Fri, 27 Jan 2023 21:01:59 +0000 (21:01 +0000)]
Push solock() down to sogetopt(). It is not required for the most cases.
Also, some cases could be protected with solock_shared().

ok bluhm@

21 months agoReplace selinfo structure by klist in sockbuf. No reason to keep it,
mvs [Fri, 27 Jan 2023 18:46:34 +0000 (18:46 +0000)]
Replace selinfo structure by klist in sockbuf. No reason to keep it,
selinfo is just wrapper to klist. netstat(1) and libkvm use socket
structure, but don't touch so_{snd,rcv}.sb_sel.

ok visa@

21 months agoUse the same inline assembly constraints as for libc fp*(), when operating
miod [Fri, 27 Jan 2023 16:43:33 +0000 (16:43 +0000)]
Use the same inline assembly constraints as for libc fp*(), when operating
on the floating-point control register.

21 months agoRemove fast round(3) implementation for hppa. It is a nice idea, but does not
miod [Fri, 27 Jan 2023 16:42:03 +0000 (16:42 +0000)]
Remove fast round(3) implementation for hppa. It is a nice idea, but does not
round in the right direction for halfway values.
(noticed in the perl test results thanks to afresh1@)

21 months agoTest the behaviour of round() on halfway values.
miod [Fri, 27 Jan 2023 16:39:58 +0000 (16:39 +0000)]
Test the behaviour of round() on halfway values.

21 months agoAdd a few more -fno-builtin to make sure we test libm, not the compiler.
miod [Fri, 27 Jan 2023 16:39:22 +0000 (16:39 +0000)]
Add a few more -fno-builtin to make sure we test libm, not the compiler.

21 months agoriscv64: initialize stathz, profhz like other platforms do
cheloha [Fri, 27 Jan 2023 15:37:16 +0000 (15:37 +0000)]
riscv64: initialize stathz, profhz like other platforms do

Don't hardcode 100 and 1000.  Use hz(9) for stathz, compute profhz
using stathz, just like most other platforms.

Link: https://marc.info/?l=openbsd-tech&m=167479021815637&w=2
ok jca@

21 months agoDelete get_plane_numbers() function.
aoyama [Fri, 27 Jan 2023 13:58:17 +0000 (13:58 +0000)]
Delete get_plane_numbers() function.

Different from original LUNA(68k), the number of planes is directly
stored as an integer value on LUNA-88K.

Tested on LUNA-88K2 by me.

21 months agoUse stricter constraints in the assembly statements in fpset{mask,round,sticky}
miod [Fri, 27 Jan 2023 11:25:16 +0000 (11:25 +0000)]
Use stricter constraints in the assembly statements in fpset{mask,round,sticky}
and make them behave as intended again.
The existing constraints are too weak; this used to work in older days, but
got broken when the system compiler was updated to gcc 4 (or maybe even gcc 3).

21 months agoAdd openssl 3.0 interop tests
tb [Fri, 27 Jan 2023 08:28:36 +0000 (08:28 +0000)]
Add openssl 3.0 interop tests

The plan is to retire the 1.0.2 interop tests soon so as to be able to
drop the dead and dangerous OpenSSL 1.0.2 port.

The cert part is extremely slow on arm64: the whole interop test on an m1
is about 10x slower (~45 min!) than on a modern amd64 laptop, so people
running regress may want to wait a bit with adding OpenSSL 3 to their test
boxes until this is sorted out.

21 months agosync
deraadt [Fri, 27 Jan 2023 02:48:39 +0000 (02:48 +0000)]
sync

21 months agoRework the secondary CPU spinup code to take advantage of the context
kettenis [Thu, 26 Jan 2023 13:09:18 +0000 (13:09 +0000)]
Rework the secondary CPU spinup code to take advantage of the context
parameter that PSCI gives us.

ok patrick@

21 months agodelete repeated word
deraadt [Thu, 26 Jan 2023 07:44:31 +0000 (07:44 +0000)]
delete repeated word

21 months agobacking "consolidate mbuf header parsing on device driver layer"
deraadt [Thu, 26 Jan 2023 07:32:39 +0000 (07:32 +0000)]
backing "consolidate mbuf header parsing on device driver layer"
easily repeatable ASSERT happens seconds after starting compiles over nfs.

21 months agoIn the previous commit, FIXPROT would upgrade a PROT_NONE mapping too far.
deraadt [Wed, 25 Jan 2023 23:42:03 +0000 (23:42 +0000)]
In the previous commit, FIXPROT would upgrade a PROT_NONE mapping too far.
Correct the logic, still blocking PROT_EXEC
ok anton kettenis

21 months agoUse getpartno() in editor_delete(), enhancing getpartno() to
krw [Wed, 25 Jan 2023 21:44:08 +0000 (21:44 +0000)]
Use getpartno() in editor_delete(), enhancing getpartno() to
allow '*' to select all partitions when the action is 'delete'.

No intentional functional change.

21 months agoFix CVE-2023-24056, unbounded variable expansion in pkg-config.
millert [Wed, 25 Jan 2023 19:06:50 +0000 (19:06 +0000)]
Fix CVE-2023-24056, unbounded variable expansion in pkg-config.
We now die with an error when trying to expand a variable that is
already longer than 64K.  This was never a buffer overflow in our
pkg-config, but rather an unbounded memory allocation that would
eventually run up against resource limits.  OK sthen@ jasper@

21 months agogptimer(4): switch to clockintr
cheloha [Wed, 25 Jan 2023 14:14:39 +0000 (14:14 +0000)]
gptimer(4): switch to clockintr

- Remove custom clock interrupt scheduling code.
- Remove local evcount structs.
- Wire up gptimer_intrclock.
- Switch stathz from 128 to hz
- Switch profhz from 1024 to (stathz * 10).

This change is untested.  Nobody seems to have hardware that actually uses
the gptimer(4) as an interrupt clock.  If this patch doesn't work, the driver
is probably not too distant from a working state.

Compile-tested by jca@.  Discussed with kettenis@, jca@, drahn@, patrick@,
jsg@, and uwe@.

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

21 months agochange naming convention for the lru "save history" cache, so that
espie [Wed, 25 Jan 2023 13:25:07 +0000 (13:25 +0000)]
change naming convention for the lru "save history" cache, so that
ports like "lang/chicken/core" do generate files like lang.chicken.core.lru
instead of lang.chicken.core (which can create confusion in people's mind)

do so transparently by reading the old file if need be, and removing it
afterwards.

Funny thing noticed by tb@

ok tb@, sthen@

21 months agoDelete TAB only line.
asou [Wed, 25 Jan 2023 10:53:15 +0000 (10:53 +0000)]
Delete TAB only line.

21 months agoImplement execute-only mappings by using the Virtual Page Class Key
kettenis [Wed, 25 Jan 2023 09:53:53 +0000 (09:53 +0000)]
Implement execute-only mappings by using the Virtual Page Class Key
Protection mechanism provided by modern POWER CPUs.  This is implemented
in a way data allows us to use the Data Address Compare mechanism that
was available on older versions of the architecture if we ever add support
for these older CPUs (e.g. the PowerPC 970 aka G5).

Special thanks to gkoehler@ for spotting the bug in my initial
implementation that made this not work at all.

ok deraadt@, gkoehler@

21 months agodrm/amdgpu: correct MEC number for gfx11 APUs
jsg [Wed, 25 Jan 2023 02:46:45 +0000 (02:46 +0000)]
drm/amdgpu: correct MEC number for gfx11 APUs

From Lang Yu
6da17ac15e354ce483044c924c801a1b25ec8e4a in linux-6.1.y/6.1.8
0ddadc3a2208aedb1b27dbb76d0b4e722b5b527a in mainline linux

21 months agodrm/amdgpu: add tmz support for GC IP v11.0.4
jsg [Wed, 25 Jan 2023 02:44:50 +0000 (02:44 +0000)]
drm/amdgpu: add tmz support for GC IP v11.0.4

From Tim Huang
40a66b6ca4781cb65449ff0794924fc39f599d74 in linux-6.1.y/6.1.8
2aecbe492a3c0bf4c21f78c099a6f6c205fab0c7 in mainline linux

21 months agodrm/amdgpu: add tmz support for GC 11.0.1
jsg [Wed, 25 Jan 2023 02:43:17 +0000 (02:43 +0000)]
drm/amdgpu: add tmz support for GC 11.0.1

From Yifan Zhang
a63bd0539bf395bd57ad7bb2fb6d7581bc19bff0 in linux-6.1.y/6.1.8
97074216917b4188f0af3e52cc5b3f2b277bbbca in mainline linux

21 months agodrm/amdgpu: enable GFX Clock Gating control for GC IP v11.0.4
jsg [Wed, 25 Jan 2023 02:42:07 +0000 (02:42 +0000)]
drm/amdgpu: enable GFX Clock Gating control for GC IP v11.0.4

From Tim Huang
a74805429d38775ac5cc24a8b04df74afe449ffb in linux-6.1.y/6.1.8
f9caa237372b106b5e70ba1a4bfd4222eb79ec71 in mainline linux

21 months agodrm/amdgpu: enable GFX Power Gating for GC IP v11.0.4
jsg [Wed, 25 Jan 2023 02:40:03 +0000 (02:40 +0000)]
drm/amdgpu: enable GFX Power Gating for GC IP v11.0.4

From Tim Huang
834a9142586542f7de693135caf9cc43c0b1e1b2 in linux-6.1.y/6.1.8
a89e2965da6e644729a8ee9c318b7fa9a2990353 in mainline linux

21 months agodrm/amdgpu: enable GFX IP v11.0.4 CG support
jsg [Wed, 25 Jan 2023 02:38:08 +0000 (02:38 +0000)]
drm/amdgpu: enable GFX IP v11.0.4 CG support

From Tim Huang
09af1ee53ced112a69b2a8f5d3b0c0e3818fcb4e in linux-6.1.y/6.1.8
f2b91e5a7cc0368709964994ca253781b51a486a in mainline linux

21 months agodrm/amdgpu: enable PSP IP v13.0.11 support
jsg [Wed, 25 Jan 2023 02:35:51 +0000 (02:35 +0000)]
drm/amdgpu: enable PSP IP v13.0.11 support

From Tim Huang
8cbe04b2e0a1a0197a47e14fbbbcf0ef18299bce in linux-6.1.y/6.1.8
2c83e3fd928b9cb1e35340e58d4b1bd2eea23ed6 in mainline linux

21 months agodrm/amdgpu/discovery: enable nbio support for NBIO v7.7.1
jsg [Wed, 25 Jan 2023 02:33:28 +0000 (02:33 +0000)]
drm/amdgpu/discovery: enable nbio support for NBIO v7.7.1

From Yifan Zhang
11ffb993373095468936788ecdec3cd237f8983d in linux-6.1.y/6.1.8
7308ceb44663f40bf9e7373c3b1aa4f7f433d625 in mainline linux

21 months agodrm/amdgpu/pm: use the specific mailbox registers only for SMU IP v13.0.4
jsg [Wed, 25 Jan 2023 02:31:13 +0000 (02:31 +0000)]
drm/amdgpu/pm: use the specific mailbox registers only for SMU IP v13.0.4

From Tim Huang
703011b41c4f0d333e731edbb632eab62c0e1810 in linux-6.1.y/6.1.8
069a5af97ce3a1448a3566ce8b63b60e51e19958 in mainline linux

21 months agodrm/amdgpu/soc21: add mode2 asic reset for SMU IP v13.0.11
jsg [Wed, 25 Jan 2023 02:29:27 +0000 (02:29 +0000)]
drm/amdgpu/soc21: add mode2 asic reset for SMU IP v13.0.11

From Tim Huang
fe4d9fb3326ecac3d2cdd1acbc0011013b1d7a94 in linux-6.1.y/6.1.8
18ad18853cf2d8b94cef0112ba94f7a7535a9e89 in mainline linux

21 months agodrm/amdgpu/pm: add GFXOFF control IP version check for SMU IP v13.0.11
jsg [Wed, 25 Jan 2023 02:27:48 +0000 (02:27 +0000)]
drm/amdgpu/pm: add GFXOFF control IP version check for SMU IP v13.0.11

From Yifan Zhang
c776433afefde3f0dd74d43fb2cc5791bbd1caaf in linux-6.1.y/6.1.8
9f83e61201bb21957e4993736532edad7a11c7fa in mainline linux