OpenBSD cvs log

created 2024-05-19T06:24:38Z
begin 2024-05-17T00:00:00Z
end 2024-05-18T00:00:00Z
path src/sys
commits 10

date 2024-05-17T16:37:10Z
author sf
files src/sys/dev/fdt/virtio_mmio.c log diff annotate
src/sys/dev/pci/virtio_pci.c log diff annotate
src/sys/dev/pv/if_vio.c log diff annotate
src/sys/dev/pv/virtiovar.h log diff annotate
message vio: Fix signal handling and locking in sysctl path

Commits f0b002d01d5 "Release the netlock when sleeping for control
messages in in vioioctl()" and 126b881f71 "Insert a workaround for
per-ifp ioctl being called w/o NET_LOCK()." in vio(4) fixed a deadlock
but may cause a crash with a protection fault trap if addresses are
added/removed concurrently.

The actual issue is that signals are not handled correctly while
sleeping. After a signal, there is a race condition where sc_ctrl_inuse
is first set to FREE and then the interrupt handler sets it to DONE,
causing a hang in the next vio_wait_ctrl() call.

To fix it:

* Revert the NET_LOCK unlocking work-around.

* Remove PCATCH from the sleep call when we wait for control queue,
avoiding the race with vio_ctrleof(). To ensure that we don't hang
forever, use a 5 second timeout.

* If the timeout is hit, or if the hypervisor has set the
DEVICE_NEEDS_RESET status bit, do not try to use the control queue
until the next ifconfig down/up which resets the device.

* In order to allow reading the device status from device drivers, add a
new interface to the virtio transport drivers.

* Avoid a crash if there is outgoing traffic while doing ifconfig down.

OK bluhm@

date 2024-05-17T18:58:26Z
author mvs
files src/sys/net/pfkeyv2.c log diff annotate
message Fix uninitialized memory access in pfkeyv2_sysctl().

pfkeyv2_sysctl() reads the SA type from uninitialized memory if it is
not provided by the caller of sysctl(2) because of a missing length
check.

From Carsten Beckmann.

ok bluhm

date 2024-05-17T19:02:04Z
author mvs
files src/sys/kern/uipc_socket.c log diff annotate
src/sys/net/pfkeyv2.c log diff annotate
message Switch AF_KEY sockets to the new locking scheme.

The simplest case. Nothing to change in sockets layer, only set
SB_MTXLOCK on socket buffers.

ok bluhm

date 2024-05-17T19:11:14Z
author mvs
files src/sys/kern/uipc_socket.c log diff annotate
src/sys/kern/uipc_socket2.c log diff annotate
src/sys/sys/socketvar.h log diff annotate
message Turn sblock() to `sb_lock' rwlock(9) wrapper for all sockets.

Unify behaviour to all sockets. Now sblock() should be always
taken before solock() in all involved paths as sosend(), soreceive(),
sorflush() and sosplice(). sblock() is fine-grained lock which
serializes socket send and receive routines on `so_rcv' or `so_snd'
buffers. There is no big problem to wait netlock while holding sblock().

This unification removes a lot of temporary "sb_flags & SB_MTXLOCK" code
from sockets layer. This unification makes straight "solock()" and
"sblock()" lock order, no more solock() -> sblock() -> sounlock() ->
solock() -> sbunlock() -> sounlock() chains in sosend() and soreceive()
paths. This unification brings witness(4) support for sblock(), include
NFS involved sockets, which is useful.

Since the witness(4) support was introduced to sblock() with this diff,
some new witness reports appeared.

bulk(1) tests by tb, ok bluhm

date 2024-05-17T19:43:45Z
author kettenis
files src/sys/dev/pci/azalia.c log diff annotate
message The INTSTS register is read-only, so the attempt to clear interrupts
by writing to it doesn't actually work. Therefore we have to keep
processing interrupts until all the bits corresponding to enabled
interrupts are cleared. This makes MSIs actually work, also on the AMD
implementations for which we currently disable MSIs.

Based on some digging by martijn@

ok ratchov@, martijn@, stsp@

date 2024-05-17T20:03:13Z
author miod
files src/sys/dev/sbus/esp_sbus.c log diff annotate
message Update comments to match reality.

date 2024-05-17T20:05:08Z
author miod
files src/sys/arch/sparc64/include/autoconf.h log diff annotate
src/sys/arch/sparc64/sparc64/autoconf.c log diff annotate
message Constify the first argument of getdevunit(). NFCI

date 2024-05-17T20:07:33Z
author miod
files src/sys/arch/alpha/include/intr.h log diff annotate
message Cast alpha_pal_swpipl return value to int in splx, to make sure both sides
of the ternary operator have the same type. NFC

date 2024-05-17T20:11:58Z
author miod
files src/sys/dev/wscons/wsmouse.c log diff annotate
message Make sure `row' is not used uninitialized in wsmouse_matching().

date 2024-05-17T20:44:36Z
author bluhm
files src/sys/netinet/ip_ipip.c log diff annotate
message IPv6 has to use ip6_defhlim, not ip_defttl.

OK claudio@