1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-19 19:54:14 +00:00
Commit Graph

243843 Commits

Author SHA1 Message Date
deraadt
de62a587e2 A binary without a PT_LOAD exec segment would later read a pinsyscall table
and damage it strangely.  Such a binary cannot actually run, but we should
avoid the internal pinsyscall table damage, and fail the execve with EINVAL.
reported by Stuart Thomas
ok guenther
2026-04-11 16:12:40 +00:00
cludwig
54f7a0c00a vmm: Handle reserved bits in debug registers
vmm(4) handles the %dr6 debug register on VMX on its own. It is not
part of the VMCB. The AMD and Intel SDMs mention that a 'MOV DRn'
instruction traps with #GP when any of the upper 32 bits of %dr6/%dr7
is 1. Userland can set arbitrary values in that register, forcing an
Intel machine to crash. An initial bogus %dr7 fails to launch the VM
on both platforms.

Reject such debug register values an all platforms.

ok mlarkin@

Reported-by: syzbot+f386e2f64711877025a6@syzkaller.appspotmail.com
2026-04-11 15:59:44 +00:00
claudio
9b1ce9c8d0 Call repo_check_timeout() before colleting the POLLOUT fds. Since
repo_abort() called by repo_check_timeout() will add messages to
be sent out.

This brings back rev 1.263 which was accidentially reverted by rev 1.293

OK tb@
2026-04-11 12:02:50 +00:00
deraadt
f7e671ebc3 When the pagedaemon is triggered to create free memory, there may be
sleeping pmemrange allocations with multi-page alignment requirements
which can't be satisfied by the simplistic freeing of (solo) pages
which the pagedaemon performs.  As we near starvation, fragmentation
is the main problem.  Our free list could be large enough that the
pagedaemon sees no reason to do more work, but also too fragmented to
satisfy a pending allocation request with complex requirements
(imagine asking for 512K of physically linear memory which is DMA
reachable).  When the requirement isn't satisfied, the pagedaemon is
told to try again, but again doesn't mean harder because it has no
mechanism to try harder.  It's tracking variables do not show the
fragmentation problem.  It spins a lot.  Often this becomes a
deadlock.
Time to change strategy: Overshoot creation of (both) inactive and
free pages each time through the loop. After inspecting existing
variables, we generate minumum 128 inactive pages (which may be
dynamically drawn down asyncronously by accesses), and then try to
convert minumum 128 inactives into free pages (different pages
get freed different ways, including via swapcluster which has been
improved in previous uvm_swap.c commit to absorb more pressure and
indicate when it is full).
As we mow through the freelist, this will eventually create some
(physical address space) defragmention and satisfy these complex
requirements.  Maybe not on the first round, but it will keep trying.
Before this change, it was not trying at all.
ok kettenis kirill beck
2026-04-11 01:57:22 +00:00
deraadt
9bac450dd5 To support swapencrypt, the swapcluster code has a memory allocation codepath.
Since this is runs inside the pagedaemon that is unworkable.  We'd like to
encrypt the pages inplace for IO, but there are architectures not ready for
a high-mem page to be written to a dma-restricted device (work in progress).
So for now we need to bounce through dma-reachable memory buffer.  A previous
attempt had 1 extra bounce buffer, but then slept on allocation inside the
pagedaemon context which is also unworkable.  This version contains 32
pre-allocated swapclusters (64K each), and through a counter signals to the
pagedaemon when it should stop trying to create memory.  32 swap clusters
is comfortably more than the minimum we expect the pagedaemon frantically
generate.  This crummy solution is good enough until we the dma reach problem
is solved (soon)
ok kettenis kirill (who looked into other solutions) beck
2026-04-11 01:36:23 +00:00
kettenis
f1274cd53b Actually smtpinctrl(4) should attach early; messed that up when
transplanting things into a different tree for commit.
2026-04-10 17:55:14 +00:00
kettenis
0347354ca2 Add smtpinctrl(4), a driver for the pin controller on the SpacemiT K1 SoC.
ok mlarkin@, jsing@
2026-04-10 17:37:00 +00:00
kettenis
11a4679ee1 Apparently we shouldn't touch the RTC immediately after restarting the
i8254 clock either when coming out of S3 suspend.  So move the code
that checks whether the RTC alarm went off and clears it all the way to
the end of acpi_cpu_resume.  This fixes a lockup seen on the x220.

Figured out by mlarkin@ who write the initial diff; I just tweaked it.

ok mlarkin@, deraadt@
2026-04-10 16:23:32 +00:00
kirill
560978c3cf sys/vfs_biomem: add missed atop() in buf_alloc_pages()
bufbackoff() operates in pages, but size at this call site was a byte
count; the old loop therefore asked for far too much backoff and
compared reclaimed pages against bytes.

On a low memory machine that made the NOWAIT retry path much less likely
to succeed, so the code dropped into the WAITOK allocation below and
slept.

Using atop() puts the units back in line; backoff can now satisfy the
intended request, and the subsequent NOWAIT retry again has a realistic
chance of success. The WAITOK path remains possible, but it should be
reached less often.

OK deraadt@, beck@
2026-04-10 02:03:40 +00:00
job
411a0c209e Remove unnecessary free before exit calls
OK deraadt@
2026-04-09 18:41:41 +00:00
claudio
f97bb3898e At the end of parsing the http response header do some sanity checks
to ensure that the response includes all needed data.

Right now only the presence of a Location header is checked if a HTTP
redirect was returned (e.g. a 301 status).

Different fix for a report from Daniel Anderson
OK tb@
2026-04-09 18:35:49 +00:00
gkoehler
7bdd0d20c1 In powerpc stacktrace_save(), start at correct return address
I got an empty trace.  It was reading garbage as the 1st return
address and might have accidentally taken the "if (lr & 3) break;".
By using __builtin_return_address(0) and pointing to the correct
frame, I get a trace where #0 is the function calling
stacktrace_save().
2026-04-09 17:57:09 +00:00
job
f24fdfda12 Check cleared memory allocation and free before exit for consistency
From Jan Schreiber, input from Patrick Keshishian

OK tb@
2026-04-09 17:29:04 +00:00
kettenis
cdb0e82ceb Enable Vbus regulator if there is one
Needed on the Banana Pi F3 to power USB devices.

ok jsing@
2026-04-09 15:13:45 +00:00
tb
566debf87d rpki-client: fix pointer used in as_check_overlap()
from Daniel Anderson
ok claudio
2026-04-09 07:47:31 +00:00
dlg
f951d642cc fix how source and state limiters are wired into rbtrees inside pfctl.
i messed up when we added support for names on these things. the
id and names are each supposed to be unique, which is checked by
putting the one limiter into an rb tree based on their id and another
based on their name. unfortunately i used the same RBT_ENTRY fields
for both trees, which meant using both trees on the same limiter
corrupted the topology, which goes badly when you want to use
multiple limiters.

found by, tested, and ok dgl@ (who is not me, this is not a typo)
ok jmatthew@
2026-04-09 06:10:38 +00:00
miod
dee2476c04 Revert r1.7; these defines are required to build apm(8) and apmd(8). 2026-04-09 05:03:42 +00:00
jsg
6d2b925ed3 don't clear non-smt block bits in sysctl_hwsmt()
make hw.smt 1->0 work again
ok deraadt@
2026-04-09 01:30:02 +00:00
kmos
fabd79fdc3 Remove references to tag:kde3 and tag:kde4 as something that one
might find in the current ports tree. kde3/kde4 and their tags are
long gone.

Leave them in place for the historical section describing what
tags are used for in dpb/DPB_PROPERTIES

ok phessler
2026-04-09 01:29:59 +00:00
kettenis
f6ac540182 Take USB hubs out of reset. This makes the on-board USB hub on the Banana
Pi F3 show up.

tested by jsing@
2026-04-08 13:43:32 +00:00
jsg
b0cdb9e75f remove unneeded CPUTYP ifdefs
ok deraadt@
2026-04-08 12:40:12 +00:00
jsg
6e2242fc93 Error with EISDIR when calling open(2) with O_CREAT when the
last component of the path is an existing directory and O_DIRECTORY
is not specified.

This is required by recent versions of POSIX.  We previously did
not return an error.

Flagged by Sortix os-test.

committing on behalf of daniel@, partly based on FreeBSD changes
ok guenther@ jsg@ deraadt@
2026-04-08 12:08:25 +00:00
op
8595ae99f9 EHLO must reset the transaction
RFC5321 §4.1.4 states that an EHLO command MAY be issued by a client
later in the session and, if it's acceptable, it MUST clear all buffers
and reset the state exactly as if a RSET command was issued.

discussed with / okay martijn@
2026-04-08 12:04:56 +00:00
jsg
4629ffe274 mention O_CREAT and O_DIRECTORY error 2026-04-08 11:36:40 +00:00
jsg
52d470d14f error with EINVAL if open(2) is called with both O_CREAT and O_DIRECTORY
Before this change:

If no file or directory matching the last component of a path existed.
A regular file was created, an error was returned and errno set to ENOTDIR.

If a regular file matching the last component of a path existed,
an error was returned and errno set to ENOTDIR.

If a directory matching the last component of a path existed,
it was opened without error.

One possible reading of POSIX is that O_CREAT | O_DIRECTORY is a valid way
to get a file descriptor for an existing directory.  In practice it isn't
used and the combination of O_CREAT and O_DIRECTORY has returned an error
on NetBSD since 2010 and Linux since 2023.

ok deraadt@ daniel@
2026-04-08 11:32:24 +00:00
jmatthew
d0c78f6731 update the list of SoCs this driver works with 2026-04-08 08:58:28 +00:00
tb
15cb22fda4 Bump LibreSSL version for the release
ok deraadt
2026-04-08 05:30:20 +00:00
jmatthew
c13c5d36ef Add support for the RK3528 variant. To make things easier to follow,
pull the hardware differences out into a per-variant structure containing
the different parameters we have to program.

tested on 3528 (radxa e20c), 3568 (nanopi r5s), 3588 (nanopi r6c)
feedback from kettenis@
ok kettenis@ dlg@
2026-04-07 23:12:08 +00:00
kettenis
3581ced548 Add SpacemiT K1 support. 2026-04-07 20:38:51 +00:00
jca
008d370469 Respect DEBUG so we can build perl with debug symbols
Adding -DEBUGGING in CONFIGURE_ARGS activates debug code,
-DEBUGGING=-g passes -g in CFLAGS (only -g is supported),
and -DEBUGGING=both does... both.  This is a bit confusing.
IMO DEBUG=-g should only add -g and disable executable stripping, but
not change the code that is built.  So use -Doptimize which lets us pass
arbitrary compiler flags (eg -g3), just like DEBUG does in our system
Makefiles.

Hints and ok afresh1@
2026-04-07 16:41:33 +00:00
job
7ed665c6a3 Sync - CCR uses an IANA assigned codepoint nowadays
OK tb@
2026-04-07 14:38:04 +00:00
tb
4b39dd3dc4 Rename labellen to label_len
Requested by jsing, ok beck
2026-04-07 13:16:41 +00:00
tb
2fc71f321f Fix NULL deref for malformed OAEP parameters in CMS decryption
This converts rsa_cms_decrypt() to use X509_ALGOR_get0() and fixes a
NULL deref when a parameter is (invalidly) omitted similar to the fix
in ec/ec_ameth.c r1.66 from a couple years back. There is currently
an XXX annotating a hairy leak due to trying to be smart and stealing
the parameters from the oaep object. Instead, just make a copy of the
label string and free it in the exit path.

The diff adds an error for labellen == 0 since that is an invalid
encoding of pSpecifiedEmpty (see RFC 8017) -- per the DER the default
must be omitted. This way we avoid a malloc(0) implementation-defined
behavior.

This minor issue was assigned CVE-2026-28390 by OpenSSL and was reported
by too many to list. The fix is my own. It is similar to OpenSSL's fix
only because I rewiewed theirs and suggested an improvement or two.

This is the last of the "security fixes" in today's OpenSSL release that
"affect" LibreSSL. All the other bugs were already fixed a few years back
or we didn't have the code/bugs in the first place.

ok beck jsing
2026-04-07 13:15:29 +00:00
tb
c74741bda9 Refactor and fix ocsp_find_signer_sk()
Instead of reaching deep inside the OCSP_BASICRESP and ignoring its
semantics and then try to untangle things in ocsp_find_signer_sk(),
pass the OCSP_BASICRESP and use OCSP_resp_get0_id() which has the
logic built in. Avoids a crash if you call OCSP_basic_verify() after
OCSP_BASICRESP_new() without OCSP_basic_sign(). This cannot happen on
a deserialized OCSP object.

Prompted by a report by Kamil Frankowicz, Jan Kaminski, Bartosz Michalowski.

ok jsing
2026-04-07 13:02:50 +00:00
tb
9ad5b7ec74 Add a few to-do items to the crl_cb()
Prompted by the "fix" fighting symptoms of misdesign in Delta CRL processing
rather than addressing the root cause. Probably the best fix is to remove
support for Indirect CRLs and Delta CRLs outright.

ok jsing
2026-04-07 12:52:19 +00:00
tb
842a6bbe14 Stop Delta CRL processing if a CRL number is misssing
A malformed Delta CRL could cause a crash. Funnily enough the deserializer
recognizes this and marks such a CRL as invalid, but nothing ever checks
the EXFLAG_INVALID for CRLs. For certificates this would usually result in
verification failure due to x509v3_cache_extensions() failing.

This is only reachable if the X509_V_FLAG_USE_DELTAS is used, which only
a handful of ports do, plus openssl(1) does if you use the undocumented
-use_deltas flag.

Reported by Igor Morgenstern to OpenSSL who then sat on this since Jan 8
and assigned CVE-2026-28388.

ok jsing
2026-04-07 12:48:37 +00:00
job
333bb2fb25 sync comment 2026-04-07 11:52:21 +00:00
tb
86a725071d rpki-client: clean up ipAddrBlocks and autonomousSysIds naming mess
OpenSSL called these NID_sbgp_ipAddrBlock and NID_sbgp_autonomousSysNum
from which rpki-client derived its own fantasy names. Use the official
names in RFC 3779 instead: id-pe-ipAddrBlocks and id-pe-autonomousSysIds.

ipaddrblk is ugly and can be expanded in the API. Use addrs for the
variable to avoid overlong lines. There's precedent in the constraints
code.

The doubled s in assysnum makes no sense and since autonomoussysids is
long and unreadable, I used asids in the API.

ok claudio
2026-04-07 10:59:19 +00:00
jsg
20856dc533 drm/amd/pm: fix amdgpu_irq enabled counter unbalanced on smu v11.0
From Yang Wang
5eeba3a7bf496d5c24379305d47933c6061e462a in linux-6.18.y/6.18.21
e12603bf2c3d571476a21debfeab80bb70d8c0cc in mainline linux
2026-04-07 10:04:54 +00:00
jsg
7f510eb045 drm/amd/pm: Return -EOPNOTSUPP for unsupported OD_MCLK on smu_v13_0_6
From Asad Kamal
54c143028eb45baec385e8731eb42e22b9c25333 in linux-6.18.y/6.18.21
2f0e491faee43181b6a86e90f34016b256042fe1 in mainline linux
2026-04-07 10:02:36 +00:00
jsg
b7c7c298d9 drm/i915: Unlink NV12 planes earlier
From Ville Syrjala
70e2eb91cb6310a3508439f6f2539dfffa0abf77 in linux-6.18.y/6.18.21
bfa71b7a9dc6b5b8af157686e03308291141d00c in mainline linux
2026-04-07 10:00:26 +00:00
jsg
171185e673 drm/i915: Order OP vs. timeout correctly in __wait_for()
From Ville Syrjala
859b14e0be9e7b0f26630510d337413c7747be51 in linux-6.18.y/6.18.21
6ad2a661ff0d3d94884947d2a593311ba46d34c2 in mainline linux
2026-04-07 09:57:46 +00:00
jsg
48d7b51e7a drm/i915/dp_tunnel: Fix error handling when clearing stream BW in atomic state
From Imre Deak
8581466b827fdf0300a3e2e93900ddefd8240053 in linux-6.18.y/6.18.21
77fcf58df15edcf3f5b5421f24814fb72796def9 in mainline linux
2026-04-07 09:54:43 +00:00
jsg
d9c03210a3 drm/amd/display: Fix drm_edid leak in amdgpu_dm
From Alex Hung
eb95595194e4755b62360aa821f40a79b0953105 in linux-6.18.y/6.18.21
37c2caa167b0b8aca4f74c32404c5288b876a2a3 in mainline linux
2026-04-07 09:52:19 +00:00
jsg
72a6c7ed42 drm/amdgpu: prevent immediate PASID reuse case
From Eric Huang
51ccaf0e30c303149244c34820def83d74c86288 in linux-6.18.y/6.18.21
14b81abe7bdc25f8097906fc2f91276ffedb2d26 in mainline linux

This requires a further change to avoid a sleeping alloc while
holding a mutex.  Not yet in 6.18.y

drm/amdgpu: fix the idr allocation flags

From Prike Liang
62f553d60a801384336f5867967c26ddf3b17038 in mainline linux
2026-04-07 09:50:17 +00:00
jsg
86b8b6dfa4 drm/amdgpu: Fix fence put before wait in amdgpu_amdkfd_submit_ib
From Srinivasan Shanmugam
39820864eacd886f1a6f817414fb8f9ea3e9a2b4 in linux-6.18.y/6.18.21
7150850146ebfa4ca998f653f264b8df6f7f85be in mainline linux
2026-04-07 09:38:36 +00:00
jsg
8237b8a7cb drm/amd/display: Do not skip unrelated mode changes in DSC validation
From Yussuf Khalil
8a5edc97fd9c6415ff2eff872748439a97e3c3d8 in linux-6.18.y/6.18.21
aed3d041ab061ec8a64f50a3edda0f4db7280025 in mainline linux
2026-04-07 09:36:22 +00:00
jsg
afebcd8b6c drm/i915/gmbus: fix spurious timeout on 512-byte burst reads
From Samasth Norway Ananda
842aa6103b6f286e2bcee395b38807d3ae0d0b26 in linux-6.18.y/6.18.21
08441f10f4dc09fdeb64529953ac308abc79dd38 in mainline linux
2026-04-07 09:32:15 +00:00
jsg
f93360f79a drm/amdgpu: fix gpu idle power consumption issue for gfx v12
From Yang Wang
ad696758a45ca0c70fa60b7fd2f921edec7fc600 in linux-6.18.y/6.18.21
a6571045cf06c4aa749b4801382ae96650e2f0e1 in mainline linux
2026-04-07 09:30:23 +00:00
jsg
82bd097ce6 drm/ttm/tests: Fix build failure on PREEMPT_RT
From Maarten Lankhorst
be0c2255d717c8c548cba3b78c6d3c33ecd1feb8 in linux-6.18.y/6.18.21
a58d487fb1a52579d3c37544ea371da78ed70c45 in mainline linux
2026-04-07 09:27:59 +00:00