1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-30 00:56:33 +00:00
Commit Graph

242807 Commits

Author SHA1 Message Date
schwarze
0fede2ff61 Avoid statement that was misleading by being overly specific:
without -T, the format of the last modification column varies.
Being less specific is actually better because that indicates
to the reader that it's intended for human consumption, and that
trying to parse it programmatically is likely not a good idea.

Issue reported by Jan Stary <hans@stare.cz> on tech.
Patch by me, OK sthen@.
2026-01-18 14:05:29 +00:00
tb
3d38296448 Rewrite ec_point_cmp()
This removes some complications due to handling the fast path for affine
points and general points at the same time. The result is a bit more code
but both paths should be much easier to follow.

ok jsing kenjiro
2026-01-18 10:07:44 +00:00
tb
ed05f7f172 mlkem: fix mklem_{generate_key,encap}_external_entropy() declarations
The prototypes used sized arrays appropriate only for MLKEM768 while the
declarations used pointers. For some reason clang doesn't flag this but
gcc does. In any case it was wrong. The callers of these functions check
that they pass in the correct size. Which is weird but the mlkem directory
has an unbelievable amount of mess and bad code.

found by/ok jsing
2026-01-18 08:58:31 +00:00
tb
37562c1521 mlkem: garbage collect the unusd mlkem_{generate_key,encap}()
These are flagged by more recent gcc since declarations and definitions
don't match (sized array vs pointer). Also an array was checked for NULL.

found by/ok jsing
2026-01-18 08:49:42 +00:00
kn
a09e8894fa stub 'time' command; OK miod
octeon (like loongson at least) lacks clock code and thus the 'time'
command besides MD boot* manuals.

Since unsupported commands are treated as file names and explicit
kernels overrule any /bsd.{boot,upgrade} fallback in general,
this causes sysupgrade to not kick in until boot.conf is fixed:

	>> OpenBSD/octeon BOOT 1.5
	upgrade detected: switching to /bsd.upgrade
	failed to load kernel sd0a:time: No such file or directory
	will try /bsd
	boot>
	NOTE: random seed is being reused.
	booting sd0a:/bsd

Make 'time' do nothing and return success to ensure it doesn't effect
subsequent execution.
2026-01-18 07:54:36 +00:00
kn
8be1667ad8 prune previous libLLVM; OK jca deraadt
Reclaiming ~10% of that gigabyte sysupgrade now wants in /usr/ seems nice:

octeon  -r--r--r--  1 root  bin   106M Apr 14  2025 /usr/lib/libLLVM.so.8.0
amd64   -r--r--r--  1 root  bin  82.6M Jun 10  2025 /usr/lib/libLLVM.so.8.0

distrib/sets/lists/base/md.* shows macppc as last arch to switch to 9.0
(even bigger) on 01.08.25, so nothing should use old libs anymore by now.
2026-01-17 21:49:39 +00:00
kn
4409e1965d Check absoloute free space rather than usage percentage
10% on big (single filesystem) disks can still be plenty enough;
on the flip side, e.g. 10% of 3G /usr is often still too tight.

So instead of ">= 90% used", use "< 1G free" to bail out early.

Input OK sthen
2026-01-17 21:20:44 +00:00
jsing
6903f04951 Provide LIBRESSL_USE_.*_ASSEMBLY defines.
Make life easier for portable by providing LIBRESSL_USE_.*_ASSEMBLY
defines, which enable/disable assembly for a specific algorithm. This
means that selected platforms can include the assembly files and specify
a define, rather than having to try to patch the crypto_arch.h headers.

Discussed with tb@
2026-01-17 16:18:31 +00:00
jsing
f5df22e61f Replace MD5_ASM with function specific defines.
Use the same pattern that is now used for most other code - provide
HAVE_MD5_BLOCK_DATA_ORDER and use this to selectively enable source code.
2026-01-17 14:53:09 +00:00
jsing
aab30bc8bd Replace GHASH_ASM with function specific defines.
Use the same pattern that is now used for most other code - provide HAVE_*
defines for functions and use these to selectively enable source code.
2026-01-17 14:30:37 +00:00
jsing
2a97c3df37 Mop up unused AES_ASM and RSA_ASM defines.
These have not been used for quite some time.
2026-01-17 13:55:30 +00:00
tb
187ef9f0f5 rpki-client.8: zap a trailing blank 2026-01-17 13:39:53 +00:00
tb
9e958fc9db rpki-client: tweak previous to keep the portable diff simple
ok job
2026-01-17 13:39:03 +00:00
jsing
14fe603b27 Use .section before .rodata to appease gas.
gas dislikes bare .rodata - add .section before .rodata to make it happier
(LLVM does not care and is happy with either). For consistency, do the same
with .text.
2026-01-17 06:31:45 +00:00
jsing
ef7982221d Use local label prefix for loop labels. 2026-01-17 06:23:42 +00:00
tb
f49d58abbf mlkem_internal.h: formate -> format 2026-01-16 18:31:12 +00:00
tb
7f11c9d677 mlkem_internal.h: some very basic copy editing 2026-01-16 18:29:58 +00:00
tb
84603685f9 mlkem.h: Thie -> This (2x) 2026-01-16 18:28:04 +00:00
tb
5ea2c47247 mlkem.c: becuase -> because 2026-01-16 18:27:22 +00:00
schwarze
5569d0f08b fix previous: remove stray .It macro 2026-01-16 17:06:50 +00:00
job
16f94533ef Inflate gzip compressed CCR files on the fly in filemode
Turns out CCR data is highly compressable (~50% reduction with gzip).
Filemode recognizes compressed files by the .gz filename extension and
handles those transparently, i.e. 'rpki-client -jf *.ccr.gz *.mft.gz'
will output the hash identifier for a given file's uncompressed form.

OK tb@
2026-01-16 11:25:27 +00:00
tb
8105fbd98b asn1t.h: whitespace tweaks
Add missing space after commas, shorten a couple comments in structs,
reflow weirdly wrapped long comments and improve the random line
breaks in typedefs and prototypes.
2026-01-16 09:25:15 +00:00
tb
36d7273084 asn1t.h: Otherwiser -> Otherwise 2026-01-16 09:21:48 +00:00
tb
cbcd61754d asn1t.h: more macro cleanup, add missing C99 initializers for ADB_ENTRY()
ok kenjiro
2026-01-16 09:19:20 +00:00
sf
fc069c766a un-ifdef i8259
We don't need different code variants for the legacy PIC. Just keep the
default variant and remove lots of #ifdefs

always defined:
        ICU_HARDWARE_MASK

never defined:
        ICU_SPECIAL_MASK_MODE
        AUTO_EOI_1
        AUTO_EOI_2
        PIC_MASKDELAY
        MASKDELAY
        REORDER_IRQ

ok kettenis@ hshoexer@
2026-01-15 15:43:44 +00:00
cludwig
28304016fe bcmsdhost: Set bus clock after reset
The host reset during attach nukes SDCDIV that the bus clock setup has
initialized right before. Reorder to keep the correct value in SDCDIV.

ok kettenis@
2026-01-15 14:36:43 +00:00
hshoexer
81aba1088b In SEV-ES mode, guest userland is allowed to execute the vmgexit
instruction, although it has no control over the GHCB.  Therefore,
it is important that the GHCB does not contain a valid request after
use.

In all "vmgexit paths" the GHCB is cleared by ghcb_sync_in() (it
calls ghcb_clear()) after returning from the hypervisor back into
the guest.

However, in _ghcb_mem_rw() I missed this when requesting MMIO writes
from the hypervisor.  The diff below corrects this.

I want to keep this pattern in all vmgexit paths:

        ghcb_sync_out
        vmgexit
        ghcb_verify_bm
        ghcb_sync_in

Therefore, I shuffled some code around instead of just calling
vmgexit_clear() in the else branch.

ok mlarkin@
2026-01-15 12:11:51 +00:00
hshoexer
1dbea96db2 As vmd(8) direct kernel launch now uses 32-bit legacy mode (with
paging disabled) we do not need the 64-bit #VC handling in locore0
anymore.

ok mlarkin@
2026-01-15 12:09:49 +00:00
sashan
c600931321 pfctl(8): change default limiter action from no-match to block
pf(4) users who use limiters in current should update the rules
accordingly to reflect the change in default behavior. The existing
rule which reads as follows:

    pass in from any to any state limiter test

needs to be changed to:

    pass in from any to any state limiter test (no-match)

OK dlg@
2026-01-15 09:23:37 +00:00
sf
dbd3071e8d vio: Support MTU feature
Add support for the VIRTIO_NET_F_MTU which allows to get the hardmtu
from the hypervisor. Also set the current mtu to the same value. The
virtio standard is not clear if that is recommended, but Linux does
this, too.

Use ETHER_MAX_HARDMTU_LEN as upper hardmtu limit instead of MAXMCLBYTES,
as this seems to be more correct.

If the hypervisor requests a MTU larger than ETHER_MAX_HARDMTU_LEN,
redo feature negotiation without VIRTIO_NET_F_MTU.

With this commit, OpenBSD finally works on Apple Virtualization.

Input and testing from @helg

ok jan@
2026-01-15 09:06:19 +00:00
dlg
3f8240b635 make aq_start check the link is up before putting packets on the ring.
without link the hardware seems to hold onto the packets. if you
keep pushing packets onto the interface then the driver goes oactive
and then the ifqs fill up and then the system ends up short of
mbufs.

reported by Alisdair MacLeod on misc@ and narrowed down with sthen@
ok jmatthew@
2026-01-15 06:41:21 +00:00
jmatthew
13e9d42c29 Move the function reset and qportcfg operations to prepare for host memory
allocations required to support newer hardware generations.

tested by bluhm@ and stsp@ (as part of a larger diff)
ok bluhm@
2026-01-15 04:38:41 +00:00
mvs
1f32effba9 Make the output of bse(4) mp-safe. Use consumer and provider indexes
instead of sc_tx.queued to determine the number of used tx slots.

Tested on RPI4.

Feedback and OK from jmatthew@/
2026-01-15 03:12:49 +00:00
dv
c1b67e90d0 Emulate AMD SysCfg MSR in vmm(4).
Linux kernels like to poke this to check for memory encryption
settings. Return 0's on reads instead of injecting #GP. Writes
continue to be ignored.

This reduces some noise for Linux guests on boot.

ok hshoexer@, mlarkin@
2026-01-14 22:42:34 +00:00
mlarkin
ac9e191703 Increase MAXCPUs on amd64 to 255
Now that we have larger bitmask support for more than 64 CPUs, we can increase
the max to 255. 255 is the max that xapic can support; this number can be
bumped later if we want to discriminate x2apic vs xapic.

with input from and ok deraadt. also ok kettenis
2026-01-14 21:31:03 +00:00
mlarkin
b89fc303bb Support more than 64 bits for amd64 TLB shootdown IPI masks
The TLB shootdown code used a uint64_t to track which CPUs needed to have
their TLB remotely flushed during pmap operations. This allowed for up to
64 CPUs maximum on amd64.

This diff changes the single uint64_t mask to an array of uint8_t masks,
sized based on MAXCPUS, and utilizes the bitmask macros in param.h to
manipulate these masks.

with input from and ok deraadt. also ok kettenis
2026-01-14 21:25:26 +00:00
deraadt
b94b5c27db pmap functions send various TLB shootdown operations by IPI to other cpus.
A lock is grabbed to serialize this. Then recipient cpus get sent an IPI
demanding this work.  The lock is reused as a counter of cpus doing the work,
and each cpu's IPI handler decrements the counter.
The local cpu can do some operations in the parallel, before verifying
the TLB operations have completed in pmap_tlb_shootwait() which spins
for the counter to reach 0.  But the counter is also a lock, and 0
means other cpu can grab it.  So if the latency for the local work
exceeds the latency on the recepient cpus, the "counter-lock" can be
grabbed by a different cpu for its own TLB shootdown operations.  The
original cpu will now spin waiting for this second cpu's work to
finish, creating pmap function latency.
To fix this, I create per-cpu counters which are seperate from the lock.
The IPI functions written in asm now decrement this per-cpu counter, and
when it reaches 0, the shared lock is cleared allowing another cpu to
being shootdowns tracked by its own per-cpu counter.  The waiting
function only spins on the correct per-cpu counter.
As a bonus, the lock (and new variable indicating the shooting cpu)
are now in cache-aligned.
In snaps for 2 weeks
Many comments from chris; ok mlarkin chris
2026-01-14 20:43:56 +00:00
nicm
b108cc5d0c Add -e flag to command-prompt to close if empty, from Dane Jensen in
GitHub issue 4812.
2026-01-14 19:43:43 +00:00
tb
2365de6bcf stack.c: avoid arithmetic on pointers to void
In stack.c r1.34 I converted one 'char *' too many to 'void *', thereby
relying on a gcc/clang extension which interprets the fictional void
type as a type of size 1 (that's what the stack code wants, fortunately).
As pointed out in the link below, -Wpointer-arith would have caught this:
https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html

MSVC flags this as follows:

D:\a\portable\portable\crypto\stack\stack.c(211,23): error C2036: 'const void *': unknown size [D:\a\portable\portable\build\crypto\crypto_obj.vcxproj].

Pull in workaround from the portable repo which undoes the char * -> void *
conversion.

ok jsing millert
2026-01-14 17:43:49 +00:00
sf
81734853e4 vio: Fix dmamap size
sc_rx_mbuf_size already includes the virtio header size, no need to add
it again.

noticed by helg@

ok dv@
2026-01-14 12:19:36 +00:00
dv
ce533a79e5 Simplify vmd(8) structs, removing embedded vmm(4) structs.
This removes some hard dependencies from vmctl(8) on the structures
from vmm(4) and makes naming of identifiers more explicit.

Oh the surface, this is cosmetic, but the intention is to decouple
as much as possible from the dev/vmm/vmm.h to allow for upcoming
work to change vmm(4) without causing a large blast radius.

Testing help from mlarkin@ & bluhm@.

ok mlarkin@
2026-01-14 03:09:05 +00:00
jmatthew
bf518416d6 Use scsi_io_get rather than nvme_ccb_get for passthrough commands, so we'll
sleep if there are no ccbs available, avoiding a panic that mlarkin@ ran into.
While here, take the rwlock around passthrough commands that come in through
the scsi ioctl path for consistency with the bioctl path.

ok dlg@ krw@
2026-01-14 01:07:57 +00:00
job
791c86ff37 Remove support for validating Geofeed data
RPKI-based Geofeed authentication (RFC 9632) perhaps was a bit of a ruse
to pass IESG review. Nobody is planning on using it. Time to take it
behind the barn.

OK tb@
2026-01-13 21:36:17 +00:00
sf
3d903ed542 vio: Add more feature bit definitions
Add all non-legacy feature bit definitions from virtio 1.3 and the
definitions from 1.4 that are not >= bit 64. Remove VIRTIO_NET_F_GSO
which never worked and has been removed in virtio 1.x. Also add config
register definitions, fix a comment.
2026-01-13 10:15:07 +00:00
sf
9a2f86529e vio: Improve feature negotiation for LRO/TSO
OpenBSD requires that LRO can be switched on and off for things like
bridged vlan(4), vxlan(4), bpe(4). We currently only support switching
LRO on/off if the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature was
negotiated. But this means if the hypervisor only offers
VIRTIO_NET_F_GUEST_TSO4/6 but not VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,
things will break. In this case we must redo feature negotation without
the GUEST_TSO4/6 features.

Also, if the hypervisor offers GUEST_TSO4/6 but not the
VIRTIO_NET_F_MRG_RXBUF feature, we currently put rx buffers with a
single 4k mbuf into the rx queue while the standard says we SHOULD
insert buffers of at least 65562 bytes. Apple Virtualization refuses to
work with this configuration. As 65562 is larger than MAXMCLBYTES, we
would need to rework how we allocate our rx buffers to make this work.
For now, we would to like to simply disable GUEST_TSO4/6 if MRG_RXBUF is
missing.  Unfortunately, Apple Virtualization still refuses to work
unless HOST_TSO4/6 is also disabled. Therefore, we disable all TSO if
MRG_RXBUF is missing.

With lots of input from and tested by helg@

ok mlarkin@
2026-01-13 10:10:14 +00:00
tb
c53725c2e4 x509_utl.c: zap two useless comments 2026-01-12 22:08:34 +00:00
helg
67ddd48175 viogpu_wsmmap() returns a kva but instead should return a physical
address via bus_dmamem_mmap(9). Without this, QEMU would only show a
black screen when starting X11. On the Apple Hypervisor, the kernel
would panic.

Also add calls to bus_dmamap_sync(9) before transferring the framebuffer
to host memory. It was working for me without this, but this ensures
that the host running on another CPU will see updates to the
framebuffer.

Thanks to kettenis@ for reviewing and providing feedback.

ok sf@
2026-01-12 18:15:33 +00:00
tb
a9df5e8d09 rpki-client 9.7 is long overdue 2026-01-12 10:56:50 +00:00
tb
f860e216f2 rpki-client: only accept BGPsec certs with a single AS number
We've long been pointing out that the possibility of adding multiple AS
numbers and in particular AS ranges to BGPsec Router Certificates is at
best dubious. Enforce that there is a single AS, encoded as an ASID, not
as an ASRange with a single element (cf. eid7653 to RFC 3779).

Prompted by a report by Xie Yifan
with/ok claudio job
2026-01-12 10:56:16 +00:00
tb
8b200efe29 rpki-client: check purpose for .cer files in Manifests
Only intermediate CAs and BGPsec certificates are allowed in a Manifest
fileList. Check this is the case, otherwise stop processing the cert.

Missing check reported by Xie Yifan
ok claudio job
2026-01-12 10:48:20 +00:00