openbsd
9 months agoTweak previous. Passing "dns" to pledge(2) is suitable for the purpose.
yasuoka [Tue, 6 Feb 2024 05:39:28 +0000 (05:39 +0000)]
Tweak previous.  Passing "dns" to pledge(2) is suitable for the purpose.

input deraadt, ok tobhe

9 months agoAdd risc-v support code for clang -msave-restore
jca [Tue, 6 Feb 2024 05:07:28 +0000 (05:07 +0000)]
Add risc-v support code for clang -msave-restore

ok kettenis@

9 months agoFix RTARCH in our Makefile and lets us access riscv-specific implementations
jca [Tue, 6 Feb 2024 05:00:12 +0000 (05:00 +0000)]
Fix RTARCH in our Makefile and lets us access riscv-specific implementations

This brings us fp_mode.c used in softfloat code, and muldi3.S used when
the target ISA doesn't have the Multiply extension.

ok kettenis@

9 months agodrm/amdgpu: Fix missing error code in 'gmc_v6/7/8/9_0_hw_init()'
jsg [Tue, 6 Feb 2024 04:07:51 +0000 (04:07 +0000)]
drm/amdgpu: Fix missing error code in 'gmc_v6/7/8/9_0_hw_init()'

From Srinivasan Shanmugam
7110e98840ee6b7009304b1e41c8e6930452a48e in linux-6.6.y/6.6.16
16da399091dca3d1e48109086403587af37cc196 in mainline linux

9 months agodrm/amdkfd: only flush mes process context if mes support is there
jsg [Tue, 6 Feb 2024 04:05:39 +0000 (04:05 +0000)]
drm/amdkfd: only flush mes process context if mes support is there

From Jonathan Kim
3c0a7eac9e7883317e2010bc525a3f1c4847587c in linux-6.6.y/6.6.16
24149412dfc71f7f4a54868702e9145e396263d3 in mainline linux

9 months agodrm: using mul_u32_u32() requires linux/math64.h
jsg [Tue, 6 Feb 2024 04:04:12 +0000 (04:04 +0000)]
drm: using mul_u32_u32() requires linux/math64.h

From Stephen Rothwell
8de8f000ffe1c930d0cdf73cfce91b0d1746c3bc in linux-6.6.y/6.6.16
933a2a376fb3f22ba4774f74233571504ac56b02 in mainline linux

9 months agodrm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()'
jsg [Tue, 6 Feb 2024 04:01:06 +0000 (04:01 +0000)]
drm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()'

From Srinivasan Shanmugam
5ea4007636b27800fa01555428aa9c198aeb5bf4 in linux-6.6.y/6.6.16
d7a254fad873775ce6c32b77796c81e81e6b7f2e in mainline linux

9 months agodrm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()'
jsg [Tue, 6 Feb 2024 03:59:48 +0000 (03:59 +0000)]
drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()'

From Srinivasan Shanmugam
25c2de1fbd8ee13008791a3c131f5fed02b3ccec in linux-6.6.y/6.6.16
8a44fdd3cf91debbd09b43bd2519ad2b2486ccf4 in mainline linux

9 months agodrm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()'
jsg [Tue, 6 Feb 2024 03:58:02 +0000 (03:58 +0000)]
drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()'

From Srinivasan Shanmugam
b02831b8a5b687138df4662ff914aa3defc2499e in linux-6.6.y/6.6.16
fac4ebd79fed60e79cccafdad45a2bb8d3795044 in mainline linux

9 months agodrm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_powe...
jsg [Tue, 6 Feb 2024 03:56:23 +0000 (03:56 +0000)]
drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()'

From Srinivasan Shanmugam
0ee4c5829fb3cfb8b168956be9a28ede5996a8f8 in linux-6.6.y/6.6.16
6616b5e1999146b1304abe78232af810080c67e3 in mainline linux

9 months agodrm/amdgpu: fix avg vs input power reporting on smu7
jsg [Tue, 6 Feb 2024 03:55:02 +0000 (03:55 +0000)]
drm/amdgpu: fix avg vs input power reporting on smu7

From Alex Deucher
d0bc6be623ba7270ad71fee9a8af6843420e7191 in linux-6.6.y/6.6.16
25852d4b97572ff62ffee574cb8bb4bc551af23a in mainline linux

9 months agodrm/amdkfd: Fix lock dependency warning with srcu
jsg [Tue, 6 Feb 2024 03:53:15 +0000 (03:53 +0000)]
drm/amdkfd: Fix lock dependency warning with srcu

From Philip Yang
752312f6a79440086ac0f9b08d7776870037323c in linux-6.6.y/6.6.16
2a9de42e8d3c82c6990d226198602be44f43f340 in mainline linux

9 months agodrm/amdkfd: Fix lock dependency warning
jsg [Tue, 6 Feb 2024 03:51:59 +0000 (03:51 +0000)]
drm/amdkfd: Fix lock dependency warning

From Felix Kuehling
28d2d623d2fbddcca5c24600474e92f16ebb3a05 in linux-6.6.y/6.6.16
47bf0f83fc86df1bf42b385a91aadb910137c5c9 in mainline linux

9 months agodrm/amdgpu: apply the RV2 system aperture fix to RN/CZN as well
jsg [Tue, 6 Feb 2024 03:50:16 +0000 (03:50 +0000)]
drm/amdgpu: apply the RV2 system aperture fix to RN/CZN as well

From Alex Deucher
08dde830ab24cfcb855b198f7dbe7d3637f623bc in linux-6.6.y/6.6.16
16783d8ef08448815e149e40c82fc1e1fc41ddbf in mainline linux

9 months agodrm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()'
jsg [Tue, 6 Feb 2024 03:47:54 +0000 (03:47 +0000)]
drm/amdkfd: Fix iterator used outside loop in 'kfd_add_peer_prop()'

From Srinivasan Shanmugam
583e0a336bfbf3f2fb2badc7d1980dadfb3611f0 in linux-6.6.y/6.6.16
b1a428b45dc7e47c7acc2ad0d08d8a6dda910c4c in mainline linux

9 months agodrm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'
jsg [Tue, 6 Feb 2024 03:46:37 +0000 (03:46 +0000)]
drm/amdgpu: Drop 'fence' check in 'to_amdgpu_amdkfd_fence()'

From Srinivasan Shanmugam
ff5aefbbd82ea7eee61606ff7cce56bfac269010 in linux-6.6.y/6.6.16
bf2ad4fb8adca89374b54b225d494e0b1956dbea in mainline linux

9 months agodrm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()'
jsg [Tue, 6 Feb 2024 03:45:17 +0000 (03:45 +0000)]
drm/amdgpu: Fix '*fw' from request_firmware() not released in 'amdgpu_ucode_request()'

From Srinivasan Shanmugam
aa1791b280ed36005226e031a622091fa7e5382e in linux-6.6.y/6.6.16
13a1851f923d9a7a78a477497295c2dfd16ad4a4 in mainline linux

9 months agoRe-revert "drm/amd/display: Enable Replay for static screen use cases"
jsg [Tue, 6 Feb 2024 03:43:45 +0000 (03:43 +0000)]
Re-revert "drm/amd/display: Enable Replay for static screen use cases"

From Ivan Lipski
90df72694a5b7ca2a415eb3baeb9f385cee8033c in linux-6.6.y/6.6.16
d6398866a6b47e92319ef6efdb0126a4fbb7796a in mainline linux

9 months agodrm/amdgpu: Let KFD sync with VM fences
jsg [Tue, 6 Feb 2024 03:40:18 +0000 (03:40 +0000)]
drm/amdgpu: Let KFD sync with VM fences

From Felix Kuehling
0d35c8977be8f220931d437d568f64a7028d0115 in linux-6.6.y/6.6.16
ec9ba4821fa52b5efdbc4cdf0a77497990655231 in mainline linux

9 months agodrm/amd/display: Fix minor issues in BW Allocation Phase2
jsg [Tue, 6 Feb 2024 03:38:48 +0000 (03:38 +0000)]
drm/amd/display: Fix minor issues in BW Allocation Phase2

From Meenakshikumar Somasundaram
cef7f96a0a4c00f761248cd714b086c1256992cb in linux-6.6.y/6.6.16
aa5dc05340eb97486a631ce6bccb8d020bf6b56b in mainline linux

9 months agodrm/amdgpu: Fix ecc irq enable/disable unpaired
jsg [Tue, 6 Feb 2024 03:36:14 +0000 (03:36 +0000)]
drm/amdgpu: Fix ecc irq enable/disable unpaired

From Stanley Yang
0a8fc4e007b933d46f079a1d9ab8539a4d8439ef in linux-6.6.y/6.6.16
a32c6f7f5737cc7e31cd7ad5133f0d96fca12ea6 in mainline linux

9 months agodrm/amd/display: Only clear symclk otg flag for HDMI
jsg [Tue, 6 Feb 2024 03:34:28 +0000 (03:34 +0000)]
drm/amd/display: Only clear symclk otg flag for HDMI

From Alvin Lee
49b4cab7bcbdfe621162405502283fc9cb3ef77f in linux-6.6.y/6.6.16
dff45f03f508c92cd8eb2050e27b726726b8ae0b in mainline linux

9 months agodrm/amd/display: make flip_timestamp_in_us a 64-bit variable
jsg [Tue, 6 Feb 2024 03:32:50 +0000 (03:32 +0000)]
drm/amd/display: make flip_timestamp_in_us a 64-bit variable

From Josip Pavic
4033887acddcbb15280091f0a125ac0829cffdc8 in linux-6.6.y/6.6.16
6fb12518ca58412dc51054e2a7400afb41328d85 in mainline linux

9 months agodrm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap
jsg [Tue, 6 Feb 2024 03:29:53 +0000 (03:29 +0000)]
drm/amdgpu: fix ftrace event amdgpu_bo_move always move on same heap

From Wang Beyond
e7a0ee45c653784edda5e36bae6ae3c75fd5e7a8 in linux-6.6.y/6.6.16
94aeb4117343d072e3a35b9595bcbfc0058ee724 in mainline linux

9 months agodrm/amdkfd: fix mes set shader debugger process management
jsg [Tue, 6 Feb 2024 03:25:50 +0000 (03:25 +0000)]
drm/amdkfd: fix mes set shader debugger process management

From Jonathan Kim
3a950c56dea199d65bc98db348c017856aa2f194 in linux-6.6.y/6.6.16
bd33bb1409b494558a2935f7bbc7842def957fcd in mainline linux

9 months agodrm/amd/display: Force p-state disallow if leaving no plane config
jsg [Tue, 6 Feb 2024 03:23:27 +0000 (03:23 +0000)]
drm/amd/display: Force p-state disallow if leaving no plane config

From Alvin Lee
e9ca61a7e6b0d323547067e1dde64a97476e1696 in linux-6.6.y/6.6.16
9a902a9073c287353e25913c0761bfed49d75a88 in mainline linux

9 months agodrm/amd/display: For prefetch mode > 0, extend prefetch if possible
jsg [Tue, 6 Feb 2024 03:21:45 +0000 (03:21 +0000)]
drm/amd/display: For prefetch mode > 0, extend prefetch if possible

From Alvin Lee
6750d1de747f4d2db0046a25b069e15341f6a9ba in linux-6.6.y/6.6.16
dd4e4bb28843393065eed279e869fac248d03f0f in mainline linux

9 months agodrm/mipi-dsi: Fix detach call without attach
jsg [Tue, 6 Feb 2024 03:20:00 +0000 (03:20 +0000)]
drm/mipi-dsi: Fix detach call without attach

From Tomi Valkeinen
daf57c5ce16e907405d8a59a4f2be20e204906e4 in linux-6.6.y/6.6.16
90d50b8d85834e73536fdccd5aa913b30494fef0 in mainline linux

9 months agodrm/framebuffer: Fix use of uninitialized variable
jsg [Tue, 6 Feb 2024 03:17:19 +0000 (03:17 +0000)]
drm/framebuffer: Fix use of uninitialized variable

From Tomi Valkeinen
9b3fbff86a623a0ec053d5a4ab432956cb025c1f in linux-6.6.y/6.6.16
f9af8f0c1dc567a5a6a6318ff324c45d80d4a60f in mainline linux

9 months agodrm/drm_file: fix use of uninitialized variable
jsg [Tue, 6 Feb 2024 03:15:49 +0000 (03:15 +0000)]
drm/drm_file: fix use of uninitialized variable

From Tomi Valkeinen
2cde325e185b43accae56a23c18b2e735245197a in linux-6.6.y/6.6.16
1d3062fad9c7313fff9970a88e0538a24480ffb8 in mainline linux

9 months agodrm/amd/display: Fix MST PBN/X.Y value calculations
jsg [Tue, 6 Feb 2024 03:14:23 +0000 (03:14 +0000)]
drm/amd/display: Fix MST PBN/X.Y value calculations

From Ilya Bakoulin
01e7578c7cd3d8815fae130ac74b1303c056bd2d in linux-6.6.y/6.6.16
94bbf802efd0a8f13147d6664af6e653637340a8 in mainline linux

9 months agodrm/amd/display: Fix tiled display misalignment
jsg [Tue, 6 Feb 2024 03:13:06 +0000 (03:13 +0000)]
drm/amd/display: Fix tiled display misalignment

From Meenakshikumar Somasundaram
1c563c04509080b374af5adf8e1c45718e3f37bf in linux-6.6.y/6.6.16
c4b8394e76adba4f50a3c2696c75b214a291e24a in mainline linux

9 months agoInvert broken check of panic string in if_linkstate().
bluhm [Tue, 6 Feb 2024 00:18:53 +0000 (00:18 +0000)]
Invert broken check of panic string in if_linkstate().

original bug report from syzkaller
Reported-by: syzbot+d19060a65721eb432a72@syzkaller.appspotmail.com
broken fix found by Hrvoje Popovski
hint to the problem and OK deraadt@

9 months agoAdd netstat counter for route cache.
bluhm [Mon, 5 Feb 2024 23:16:39 +0000 (23:16 +0000)]
Add netstat counter for route cache.

To optimize route caching, count cache hits and misses.  This is
shown in netstat -s for both inet and inet6.  Reuse the old IPv6
forward cache counter.  Sort ip6s_wrongif consistently.  For now
only IPv4 cache counter has been implemented.

OK mvs@

9 months agoCleanup fcntl(3) usage and fd lifetimes in vmd(8).
dv [Mon, 5 Feb 2024 21:58:09 +0000 (21:58 +0000)]
Cleanup fcntl(3) usage and fd lifetimes in vmd(8).

Remove extraneous fcntl(3) usage for setting fd features that can
be set at time of open(2), pipe2(2), or socketpair(2). Also cleans
up pty creation switching to using functions from libutil instead
of direct ioctl(2) calls.

ok mlarkin@, original diff ok claudio@ as well.

9 months agosync
deraadt [Mon, 5 Feb 2024 21:41:52 +0000 (21:41 +0000)]
sync

9 months agoremove /f from "show buf", which was used for softdep info
jmc [Mon, 5 Feb 2024 21:33:00 +0000 (21:33 +0000)]
remove /f from "show buf", which was used for softdep info
and is no longer relevant after softdep removal;

confirmed by miod

9 months agoUse `sb_mtx' mutex(9) to protect `sb_timeo_nsecs'. In most places
mvs [Mon, 5 Feb 2024 20:21:38 +0000 (20:21 +0000)]
Use `sb_mtx' mutex(9) to protect `sb_timeo_nsecs'. In most places
solock() is still held because other 'sockbuf' members require it, but
in so{g,s}etopt() paths solock() is avoided.

ok bluhm

9 months agoCheck whether all data in eContent has been consumed
job [Mon, 5 Feb 2024 19:23:58 +0000 (19:23 +0000)]
Check whether all data in eContent has been consumed

It is possible that a given ASN.1 template generated d2i_*() function
didn't consume all data, so there is a potential for malleability.
The econtent is a sequence (which means it could be the concatenation
of several DER "blobs"). d2i_*() would only deserialize the first one
and not notice blobs following it.

OK tb@

9 months agosupport newer mfii devices; ok jmatthew
deraadt [Mon, 5 Feb 2024 19:08:29 +0000 (19:08 +0000)]
support newer mfii devices; ok jmatthew

9 months agosync
deraadt [Mon, 5 Feb 2024 19:08:10 +0000 (19:08 +0000)]
sync

9 months agonewer mfii devices; ok jmatthew
deraadt [Mon, 5 Feb 2024 19:07:45 +0000 (19:07 +0000)]
newer mfii devices; ok jmatthew

9 months agoDon't send route messages while rebooting after panic. Syskaller exposed
mvs [Mon, 5 Feb 2024 18:27:47 +0000 (18:27 +0000)]
Don't send route messages while rebooting after panic. Syskaller exposed
[1] that if_downall() tries to send route messages and triggers panic
again but in knote(9) layer.

1. https://syzkaller.appspot.com/bug?extid=d19060a65721eb432a72

ok bluhm

9 months agoUpdate to 2024agtz from https://github.com/JodaOrg/global-tz
millert [Mon, 5 Feb 2024 17:07:23 +0000 (17:07 +0000)]
Update to 2024agtz from https://github.com/JodaOrg/global-tz
  o Kazakhstan unifies on UTC+5 beginning 2024-03-01.
  o Palestine springs forward a week later after Ramadan.

9 months agoIncrease interval's rate to speed up tests.
mpi [Mon, 5 Feb 2024 15:34:11 +0000 (15:34 +0000)]
Increase interval's rate to speed up tests.

9 months agoRegress test for undefined probe arguments fixed in in btrace.c,v 1.83.
mpi [Mon, 5 Feb 2024 15:30:04 +0000 (15:30 +0000)]
Regress test for undefined probe arguments fixed in in btrace.c,v 1.83.

Adapted from a submission from Christian Ludwig.

9 months agoAdapt map regress test to cover associated arrays fixed in btrace.c r1.82.
mpi [Mon, 5 Feb 2024 15:18:19 +0000 (15:18 +0000)]
Adapt map regress test to cover associated arrays fixed in btrace.c r1.82.

From Christian Ludwig.

9 months agoPrint statistics on stderr to be able to redirect bt(5) script output.
mpi [Mon, 5 Feb 2024 15:11:35 +0000 (15:11 +0000)]
Print statistics on stderr to be able to redirect bt(5) script output.

From Christian Ludwig.

9 months agoMove route_cache() declaration from net/route.h to netinet/in.h.
aoyama [Mon, 5 Feb 2024 12:52:11 +0000 (12:52 +0000)]
Move route_cache() declaration from net/route.h to netinet/in.h.

This prevents gcc3's 'parameter has incomplete type' warning that
causes kernel build failure.

Suggested by claudio@, ok bluhm@

9 months agoAdd a bunch of IANA/IETF MIBs that are (partially) supported by OpenBSD.
martijn [Mon, 5 Feb 2024 11:46:58 +0000 (11:46 +0000)]
Add a bunch of IANA/IETF MIBs that are (partially) supported by OpenBSD.
These will soon be picked up by snmpd(8) for debugging output and
OID names used in snmpd.conf(5).

Go ahead sthen@ and tb@

9 months agoAdd a 1ms delay before starting the MHI channels. This is a hack; we're
kettenis [Mon, 5 Feb 2024 10:45:47 +0000 (10:45 +0000)]
Add a 1ms delay before starting the MHI channels.  This is a hack; we're
probably not waiting iproperly for some sort of firmware state transition.
But this gets us going on the x13s.

ok stsp@, phessler@

9 months agoCope with recent ctype.h prefix changes.
anton [Mon, 5 Feb 2024 06:48:04 +0000 (06:48 +0000)]
Cope with recent ctype.h prefix changes.

9 months agoMore missing void
tb [Sun, 4 Feb 2024 20:51:21 +0000 (20:51 +0000)]
More missing void

From Christian Andersen

9 months agoOf course libssl also has a few missing void
tb [Sun, 4 Feb 2024 20:50:23 +0000 (20:50 +0000)]
Of course libssl also has a few missing void

From Christian Andersen

9 months agoTweak codepatch_control_flow():
guenther [Sun, 4 Feb 2024 20:18:48 +0000 (20:18 +0000)]
Tweak codepatch_control_flow():
 * it should be in .cptext so it gets unmapped when codepatching is done
 * when doing a JMP, fill the area after it with INT3s instead of NOPs

ok deraadt@

9 months agoAdd a DMA constraint for the x13s. Some brilliant person at Qualcomm
kettenis [Sun, 4 Feb 2024 18:44:23 +0000 (18:44 +0000)]
Add a DMA constraint for the x13s.  Some brilliant person at Qualcomm
decided that tying a wifi interface that can only do 32-bit DMA to their
compute platform that typically comes with at least 8G of memory was a
sensible thing to do.

Maybe we should be able to use an IOMMU to work around that.  But they
fucked that up as well.

ok patrick@, phessler@

9 months agoFix cases where the size of the complete firmware file is used instead of
kettenis [Sun, 4 Feb 2024 17:51:59 +0000 (17:51 +0000)]
Fix cases where the size of the complete firmware file is used instead of
the carved out board firmware.

ok phessler@, stsp@

9 months agoAdd minimal support for GNU_PROPERTY
deraadt [Sun, 4 Feb 2024 16:44:45 +0000 (16:44 +0000)]
Add minimal support for GNU_PROPERTY

9 months agoRemove dead code and fix null deref if vm is not found.
dv [Sun, 4 Feb 2024 14:57:00 +0000 (14:57 +0000)]
Remove dead code and fix null deref if vm is not found.

Return early if no vm is found in vmd(8)'s primary vm fork/exec
function, preventing null deref in the 'fail' section. Also remove
inner return from the parent routine to prevent unreachable code.

Found by smatch, reported by and ok jsg@.

9 months agoPrevent null pointer deref is vm isn't found.
dv [Sun, 4 Feb 2024 14:56:45 +0000 (14:56 +0000)]
Prevent null pointer deref is vm isn't found.

This area of code in vmd(8) is suspect, but the null dereference
is easily avoided.

Found by smatch, reported by and ok jsg@

9 months agoInitialize result in vioblk notification handler.
dv [Sun, 4 Feb 2024 14:54:51 +0000 (14:54 +0000)]
Initialize result in vioblk notification handler.

In the event the driver kicks the vioblk device, but the guest
doesn't have any available virtqueue space, vmd will return an
uninitialized value. If non-zero, it results in a notification to
the driver and effectively a spurious interrupt.

Found by smatch, reported by and ok jsg@

9 months agoReverse calloc args.
dv [Sun, 4 Feb 2024 14:53:12 +0000 (14:53 +0000)]
Reverse calloc args.

Found by smatch "double check that we're allocating correct size"
warning. Reported by and ok jsg@.

9 months agoZap a useless comment followed by a stray semicolon
tb [Sun, 4 Feb 2024 13:08:29 +0000 (13:08 +0000)]
Zap a useless comment followed by a stray semicolon

Noticed by Christian Andersen

9 months agoFix asn1_integer_null_data_test()
tb [Sun, 4 Feb 2024 13:07:02 +0000 (13:07 +0000)]
Fix asn1_integer_null_data_test()

The failed variable was erroneously initialized to 0, making this test
always pass.

From Christian Andersen, thanks!

9 months agoAdapt base libstdc++ to the new ctype.h defines
jca [Sun, 4 Feb 2024 13:03:26 +0000 (13:03 +0000)]
Adapt base libstdc++ to the new ctype.h defines

ctype_base.h is correctly installed by make includes so the transition should
be automatic.  If you hit a failure with this header, make sure ctype.h and
ctype_base.h are in sync.

ok miod@ tb@

9 months agoMove ctype.h defines to the _CTYPE_ prefix, avoids clashes with identifiers in ports
jca [Sun, 4 Feb 2024 13:03:18 +0000 (13:03 +0000)]
Move ctype.h defines to the _CTYPE_ prefix, avoids clashes with identifiers in ports

Even if those _[BCNLPSUX] defines are in the reserved namespace, some
ports make use of those identifiers and thus need pointless
headscratching and patches.  Just use a longer reserved prefix.
We can't just #undef those defines as they are used in libc.

Change similar to what NetBSD did around 2010.  Went through base builds
and an amd64 bulk build, the only fallout was lib(e)stdc++ base_ctype.h.
"make includes" will install the latest ctype.h and libstdc++ ctype_base.h.

"makes sense" deraadt@, ok sthen@ tb@

9 months agoChange rune-specific #defines from _CTYPE_ prefix to _RUNETYPE_ prefix
jca [Sun, 4 Feb 2024 12:46:01 +0000 (12:46 +0000)]
Change rune-specific #defines from _CTYPE_ prefix to _RUNETYPE_ prefix

Similar to what NetBSD did around 2010, this lets us move some defines
in ctype.h to the _CTYPE_ prefix.  No functional change.

"makes sense" deraadt, ok sthen@ tb@

9 months agoSplit X509_get_ext_count() out of for loop again
tb [Sun, 4 Feb 2024 07:43:27 +0000 (07:43 +0000)]
Split X509_get_ext_count() out of for loop again

The compiler can't know that the count doesn't change, so avoid evaluating
X509_get_ext_count() in each iteration. Also use a separate loop variable
in the ASid non-inheritance check to avoid a silly cast.

ok claudio

9 months agoUse x509_get_time() to get the Manifest thisUpdate / nextUpdate
job [Sun, 4 Feb 2024 00:53:27 +0000 (00:53 +0000)]
Use x509_get_time() to get the Manifest thisUpdate / nextUpdate

From the moment d2i_Manifest() was introduced, it was automatically
checked whether the thisUpdate/nextUpdate are ASN1_GENERALIZEDTIME.

Unfortunately, an additional check is needed, because OpenSSL doesn't
require RFC 5280 conformance for GeneralizedTime DER encoding.

OK tb@

9 months agoRework socket buffers locking for shared netlock.
mvs [Sat, 3 Feb 2024 22:50:08 +0000 (22:50 +0000)]
Rework socket buffers locking for shared netlock.

Shared netlock is not sufficient to call so{r,w}wakeup(). The following
sowakeup() modifies `sb_flags' and knote(9) stuff. Unfortunately, we
can't call so{r,w}wakeup() with `inp_mtx' mutex(9) because sowakeup()
also calls pgsigio() which grabs kernel lock.

However, `so*_filtops' callbacks only perform read-only access to the
socket stuff, so it is enough to hold shared netlock only, but the klist
stuff needs to be protected.

This diff introduces `sb_mtx' mutex(9) to protect sockbuf. This time
`sb_mtx' used to protect only `sb_flags' and `sb_klist'.

Now we have soassertlocked_readonly() and soassertlocked(). The first
one is happy if only shared netlock is held, meanwhile the second wants
`so_lock' or pru_lock() be held together with shared netlock.

To keep soassertlocked*() assertions soft, we need to know mutex(9)
state, so new mtx_owned() macro was introduces. Also, the new optional
(*pru_locked)() handler brings the state of pru_lock().

Tests and ok from bluhm.

9 months agoAdd tap(4) read events after rx virtqueue notification.
dv [Sat, 3 Feb 2024 21:41:35 +0000 (21:41 +0000)]
Add tap(4) read events after rx virtqueue notification.

The recent vmd(8) vionet refactor caused cpu spinning when the
device would be activated by a driver but before virtqueues were
provided. (e.g. booting a ramdisk kernel and not running `ifconfig
vio0 up`)

Defer adding the tap and packet injection read events until after
the first RX queue notification from the driver.

ok mlarkin@

9 months agomissing "s" after apostrophe;
jmc [Sat, 3 Feb 2024 20:46:57 +0000 (20:46 +0000)]
missing "s" after apostrophe;

9 months agoTry to fetch the board variant from the device tree on platforms that have
kettenis [Sat, 3 Feb 2024 20:07:19 +0000 (20:07 +0000)]
Try to fetch the board variant from the device tree on platforms that have
one (e.g. on arm64).  Needed to extract the right information from the
qwx(4) firmware on the x13s.

ok stsp@

9 months agoRework the exit path of tls13_handshake_recv_action()
tb [Sat, 3 Feb 2024 19:57:14 +0000 (19:57 +0000)]
Rework the exit path of tls13_handshake_recv_action()

If an error occurs in action->recv() for a handshake that needs to
downgrade to legacy TLS, the artistic exit path led to hiding the
error under TLS13_IO_USE_LEGACY. Rework the exit path to be easier
to follow, preserving behavior except that the error can no longer
be masked.

Detailed analysis and initial diff by Masaru Masuda.
Fixes https://github.com/libressl/openbsd/issues/146

ok beck

9 months agoRemove Softdep.
beck [Sat, 3 Feb 2024 18:51:57 +0000 (18:51 +0000)]
Remove Softdep.

Softdep has been a no-op for some time now, this removes it to get
it out of the way.

Flensing mostly done in Talinn, with some help from krw@

ok deraadt@

9 months agoStop spamming syslog when the network does something silly.
florian [Sat, 3 Feb 2024 18:30:17 +0000 (18:30 +0000)]
Stop spamming syslog when the network does something silly.
From Stefan R. Filipek, thanks!

9 months agoRemove last peeking at TLS1_FLAGS_SKIP_CERT_VERIFY
tb [Sat, 3 Feb 2024 18:03:49 +0000 (18:03 +0000)]
Remove last peeking at TLS1_FLAGS_SKIP_CERT_VERIFY

This was used for some GOST weirdness. The flag is unused in ports and
there is no user in Debian's codesearch.

ok beck

9 months agoZap a trailing blank that snuck into ssl3_get_client_hello()
tb [Sat, 3 Feb 2024 17:39:17 +0000 (17:39 +0000)]
Zap a trailing blank that snuck into ssl3_get_client_hello()

9 months agoAdd new amd64-only sysctl machdep.retpoline which says whether the cpu
deraadt [Sat, 3 Feb 2024 16:21:20 +0000 (16:21 +0000)]
Add new amd64-only sysctl machdep.retpoline which says whether the cpu
requires retpoline.  If 0, we should do everything in our power to avoid
pure retpoline (replacing it with a simple thunk where possible), because
by it's nature retpoline converts an indirect-branch into a direct branch
(push to stack & ret), and therefore it is an IBT (endbr64) bypass method.
This sysctl leverages guenther's decision-making logic in the kernel, which
already uses codepatch to fix the kernel retpoline thunk.
In my opinion, the retpoline-using logic really should be flipped; ROP
execution bypassing IBT to re-enter regular control flow is more dangerous
than spectre.
ok kettenis

9 months agoRemove GOST and STREEBOG support from libssl.
beck [Sat, 3 Feb 2024 15:58:33 +0000 (15:58 +0000)]
Remove GOST and STREEBOG support from libssl.

This version of GOST is old and not anywhere close to compliant with
modern GOST standards. It is also very intrusive in libssl and
makes a mess everywhere.  Efforts to entice a suitably minded anyone
to care about it have been unsuccessful.

At this point it is probably best to remove this, and if someone
ever showed up who truly needed a working version, it should be
a clean implementation from scratch, and have it use something
closer to the typical API in libcrypto so it would integrate less
painfully here.

This removes it from libssl in preparation for it's removal from
libcrypto with a future major bump

ok tb@

9 months agoleave the command for mbox delivery unset
op [Sat, 3 Feb 2024 15:50:00 +0000 (15:50 +0000)]
leave the command for mbox delivery unset

The mbox delivery is handled apart from the other delivery methods.
Since the mda is already hardcoded in mda_mbox(), there's no need to
fill the command string in parse.y.  While here also assess that for
mbox deliveries the command is unset at delivery time too.

based on a diff by gilles

ok gilles@, millert@

9 months agodocument that when an alternate delivery user is provided in a
op [Sat, 3 Feb 2024 15:41:02 +0000 (15:41 +0000)]
document that when an alternate delivery user is provided in a
dispatcher, no .forward file except that of the alternate delivery user
is processed.

ok gilles@, millert@

9 months agoFix X509_get_ext_count() usage
tb [Sat, 3 Feb 2024 14:43:15 +0000 (14:43 +0000)]
Fix X509_get_ext_count() usage

It doesn't return a value < 0. If it did, someone could feed rpki-client
a bad cert that makes it error out, which is bad. There are various checks
that will reject a cert without extensions, so we don't need to check this
explicitly.

ok job

9 months agoRefactor handling of stale manifests
job [Sat, 3 Feb 2024 14:30:47 +0000 (14:30 +0000)]
Refactor handling of stale manifests

No need to hoist a staleness indicator through the whole process and
count it explicitly.

OK tb@

9 months agoproc_parser_mft: simplify logic slightly
tb [Sat, 3 Feb 2024 11:27:55 +0000 (11:27 +0000)]
proc_parser_mft: simplify logic slightly

This aligns the mft2 case with mft1. There's still a bunch of cleanup
needed in here, but the logic seems to converge to something mere mortals
can follow.

ok job

9 months agoOn OpenBSD we always want IBT-compatible PLT entries. Currently we use
kettenis [Sat, 3 Feb 2024 11:03:48 +0000 (11:03 +0000)]
On OpenBSD we always want IBT-compatible PLT entries.  Currently we use
repoline PLT entries that were changed to include the necessary endbr64
instructions.  But with -Wl,-znoretpolineplt we would still emit non-BIT
PLT entries under certain circumstances.  Fix this.

ok deraadt@, guenther@

9 months agoImplement Multiple Message MSI support on arm64. As on amd64 this is
kettenis [Sat, 3 Feb 2024 10:37:25 +0000 (10:37 +0000)]
Implement Multiple Message MSI support on arm64.  As on amd64 this is
experimental code to assis qwx(4) development.  Currently this only works
on systems that use agintcmsi(4) as the MSI controller combined with the
dwpcie(4) Hots/PCIe bridge.

ok patrick@

9 months agoimplement qwx_tx()
stsp [Sat, 3 Feb 2024 10:03:18 +0000 (10:03 +0000)]
implement qwx_tx()

This gets the 4-way handshake working. Unfortunately, no traffic is
passing yet, apparently because of CCMP decryption errors in Rx.

9 months agonot enough bits for L1 cache size to be >= 1M
jsg [Sat, 3 Feb 2024 09:53:15 +0000 (09:53 +0000)]
not enough bits for L1 cache size to be >= 1M

found by "mask and shift to zero: expr='totalsize >> 10'" smatch warning

9 months agofix off-by-one in bounds check
jsg [Sat, 3 Feb 2024 09:26:52 +0000 (09:26 +0000)]
fix off-by-one in bounds check

found by "buffer overflow 'peer->capa.add_path' 7 <= 7" smatch error
ok claudio@

9 months agoreturn early if malloc fails to avoid use after free
jsg [Sat, 3 Feb 2024 09:15:57 +0000 (09:15 +0000)]
return early if malloc fails to avoid use after free

found by "passing freed memory 'edid'" smatch warning

9 months agofix off-by-one in bounds test
jsg [Sat, 3 Feb 2024 00:54:14 +0000 (00:54 +0000)]
fix off-by-one in bounds test

found by "buffer overflow 'peerxfs' 6 <= 6" smatch error

tobhe@ had a remote peer attempt a transform type of 6 and it is caught
by earlier checks before getting here.

ok tobhe@

9 months agocorrect buffer size argument to snprintf in print_proto()
jsg [Sat, 3 Feb 2024 00:38:08 +0000 (00:38 +0000)]
correct buffer size argument to snprintf in print_proto()

found by "snprintf() is printing too much 8192 vs 1024" smatch error
ok tobhe@ stsp@

9 months agofix vmd vioblk fd closing bounds test
jsg [Sat, 3 Feb 2024 00:28:07 +0000 (00:28 +0000)]
fix vmd vioblk fd closing bounds test

found by "buffer overflow 'vioblk->disk_fd' 4 <= 15" smatch error
ok dv@

9 months agofix off-by-one in bounds check
jsg [Sat, 3 Feb 2024 00:20:21 +0000 (00:20 +0000)]
fix off-by-one in bounds check

found by "buffer overflow 'ContextVarbind' 3 <= 3" smatch error
ok miod@ stsp@

9 months agoadd missing fatal() call in rde_peer_send_rrefresh()
jsg [Sat, 3 Feb 2024 00:11:34 +0000 (00:11 +0000)]
add missing fatal() call in rde_peer_send_rrefresh()

found by "if statement not indented" smatch warning
ok claudio@

9 months agowhen an alternate delivery user is provided in a dispatcher, do not process
gilles [Fri, 2 Feb 2024 23:33:42 +0000 (23:33 +0000)]
when an alternate delivery user is provided in a dispatcher, do not process
any recipient .forward file except that of the alternate delivery user.

ok millert@

9 months agoRework proc_parser_mft() further
tb [Fri, 2 Feb 2024 22:09:56 +0000 (22:09 +0000)]
Rework proc_parser_mft() further

By making proc_parser_mft_check() fail on a NULL manifest, we can
simplify the manifest selection logic further. This way we can see if
the new manifest has all the files it lists with correct hashes and
fall back to mft2 if not. This is still more complicated and uglier
than it should be, but far les convoluted and mind-bending than a day
ago.

ok job

9 months agothere's no good reason to allow smtpd to execute custom command set by root
gilles [Fri, 2 Feb 2024 22:02:12 +0000 (22:02 +0000)]
there's no good reason to allow smtpd to execute custom command set by root
in a .forward file so disallow custom commands and file reading, only allow
setting forward addresses and users.

as root is no longer allowed to run any MDA but mbox, we can be stricter on
the setup of the MDA process and refuse to exec anything that's not an mbox
dispatcher.

tested by op@ who edited a root envelope to simulate an exploit injecting a
custom command in a root envelope, smtpd refused to exec.

ok millert@ and op@

9 months agoFix vector number check.
kettenis [Fri, 2 Feb 2024 21:13:35 +0000 (21:13 +0000)]
Fix vector number check.

ok kevlo@, patrick@