OpenBSD cvs log

created 2023-08-09T17:05:21Z
begin 2022-12-13T00:00:00Z
end 2022-12-20T00:00:00Z
path src/sys
commits 30

date 2022-12-13T17:30:36Z
author cheloha
files src/sys/kern/kern_tc.c log diff annotate
src/sys/sys/time.h log diff annotate
message timecounting: add getbinruntime(), getnsecruntime()

The networking people want a fast, monotonic clock that only advances
while the system is not suspended. The runtime clock satisfies most
of these requirements, so introduce getnsecruntime() to provide a fast
means for reading it.

Based on patches from jca@ and claudio@.

ok yasuoka@

date 2022-12-13T18:10:55Z
author claudio
files src/sys/netinet/tcp_var.h log diff annotate
message In tcp_now() switch from getnsecuptime() to getnsecruntime()

The tcp timer is not supposed to run during suspend but getnsecuptime() does
and because of this sessions with TCP_KEEPALIVE on reset after a few hours
of sleep.

Problem noticed by mlarkin@, investigation by yasuoka@ additional testing jca@
OK yasuoka@ jca@ cheloha@

date 2022-12-14T13:55:11Z
author kettenis
files src/sys/arch/armv7/armv7/autoconf.c log diff annotate
message Put an splhigh() at the start of cpu_configure() to prevent splasserts
trigger in autoconf. Matches what we do on (many) other architectures.

ok miod@

date 2022-12-14T23:28:31Z
author jsg
files src/sys/dev/pci/pcidevs log diff annotate
message add id for Navi 31, Radeon RX 7900 XT/XTX (gfx1100, GC 11.0.0)

date 2022-12-14T23:29:09Z
author jsg
files src/sys/dev/pci/pcidevs.h log diff annotate
src/sys/dev/pci/pcidevs_data.h log diff annotate
message regen

date 2022-12-14T23:50:31Z
author jsg
files src/sys/arch/sparc64/conf/files.sparc64 log diff annotate
src/sys/lib/libkern/ctzdi2.c log diff annotate
message add __ctzdi2 to sparc64 kernel

If __builtin_ctzl() is used on sparc64, gcc 4.2 will emit a call to
__ctzdi2. For userland this is in libgcc or compiler-rt. In the kernel
we put these functions in libkern.

'looks good' deraadt@ miod@

date 2022-12-16T02:05:44Z
author dlg
files src/sys/net/pf.c log diff annotate
src/sys/net/pfvar.h log diff annotate
message always keep pf_state_keys attached to pf_states.

pf_state structures don't contain ip addresses, protocols, ports,
etc. that information is stored in a pf_state_key struct, which is
used to wire a state into the state table. when things like pfsync
or the pf state ioctls want to export information about a state,
particularly the addresses on it, they needs the pf_state_key struct
to read from.

before this diff the code assumed that when a state was removed
from the state tables it could throw the pf_state_key structs away
as part of that removal. this code changes it so once pf_state_insert
succeeds, a pf_state will keep its references to the pf_state_key
structs until the pf_state struct itself is being destroyed.

this allows anything that holds a reference to a pf_state to also
look at the pf_state_key structs because they're now effectively
an immutable part of the pf_state struct.

this is by far the simplest and most straightforward fix for pfsync
crashing on pf_state_key dereferences we've come up with so far.
it has been made possible by the addition of reference counts to
pf_state and pf_state_key structs, which allows us to properly
account for this adjusted lifecycle for pf_state_keys on pf_state
structs.

sashan@ and i have been kicking this diff around for a couple of
weeks now.
ok sashan@ jmatthew@

date 2022-12-16T02:05:45Z
author dlg
files src/sys/net/pfvar_priv.h log diff annotate
message always keep pf_state_keys attached to pf_states.

pf_state structures don't contain ip addresses, protocols, ports,
etc. that information is stored in a pf_state_key struct, which is
used to wire a state into the state table. when things like pfsync
or the pf state ioctls want to export information about a state,
particularly the addresses on it, they needs the pf_state_key struct
to read from.

before this diff the code assumed that when a state was removed
from the state tables it could throw the pf_state_key structs away
as part of that removal. this code changes it so once pf_state_insert
succeeds, a pf_state will keep its references to the pf_state_key
structs until the pf_state struct itself is being destroyed.

this allows anything that holds a reference to a pf_state to also
look at the pf_state_key structs because they're now effectively
an immutable part of the pf_state struct.

this is by far the simplest and most straightforward fix for pfsync
crashing on pf_state_key dereferences we've come up with so far.
it has been made possible by the addition of reference counts to
pf_state and pf_state_key structs, which allows us to properly
account for this adjusted lifecycle for pf_state_keys on pf_state
structs.

sashan@ and i have been kicking this diff around for a couple of
weeks now.
ok sashan@ jmatthew@

date 2022-12-16T13:49:35Z
author stsp
files src/sys/dev/pci/if_iwm.c log diff annotate
message Prevent KASSERT in iwm(4) if firmware image is missing or corrupt.

Same fix as for iwx(4) in CVS commit YakAvDYHWiUF3c4m, r1.113 if_iwx.c.
ok deraadt, mpi

date 2022-12-16T18:08:08Z
author patrick
files src/sys/dev/fdt/qcpdc.c log diff annotate
message qcpdc(4)'s establish routine needs to return the wrapped cookie, not the
cookie it received from establishing the interrupt.

date 2022-12-17T11:54:32Z
author kettenis
files src/sys/dev/ofw/ofw_misc.c log diff annotate
message Make nvmem_read_cell() and nvmem_write_cell() work for hardware that
requires word-sized access.

ok patrick@

date 2022-12-17T11:56:44Z
author kettenis
files src/sys/arch/arm64/conf/GENERIC log diff annotate
src/sys/arch/arm64/conf/files.arm64 log diff annotate
src/sys/arch/arm64/dev/aplefuse.c log diff annotate
message Add aplefuse(4), a driver for the eFuses on Apple Silicon SoCs.

ok patrick@

date 2022-12-17T13:42:59Z
author kn
files src/sys/kern/syscalls.master log diff annotate
message Unlock minherit(2)

struct uvm_map's .addr is protected by the map's lock and .{min,max}_offset
are immutable.

uvm_map_inherit() locks the VM map upon entry, sets the desired inheritance
mode for the given address range (validated outside the lock) and unlocks
the map itself.

fork(2), i.e. uvm_mapent_forkcopy(), first locks both old and new maps and
then copies entries over as per the inheritance type.

futex(2), another user of struct vm_map_entry's .inheritance member, also
locks the map accordingly.

OK mpi

date 2022-12-17T13:45:00Z
author kn
files src/sys/kern/init_sysent.c log diff annotate
src/sys/kern/syscalls.c log diff annotate
src/sys/sys/syscall.h log diff annotate
src/sys/sys/syscallargs.h log diff annotate
message regen after minherit(2) unlock

date 2022-12-18T10:00:53Z
author mglocker
files src/sys/dev/acpi/qcgpio.c log diff annotate
message Disable the keyboard on the Samsung Galaxy Book Go until we can fix the
resulting interrupt storm. It's causing bad system performance, and breaks
the installer.

date 2022-12-18T10:29:28Z
author kettenis
files src/sys/dev/pci/pcidevs log diff annotate
message Add Union Memory NVMe devices.

ok jsg@

date 2022-12-18T10:29:53Z
author kettenis
files src/sys/dev/pci/pcidevs.h log diff annotate
src/sys/dev/pci/pcidevs_data.h log diff annotate
message regen

date 2022-12-18T13:10:08Z
author kn
files src/sys/dev/softraid.c log diff annotate
message Prevent detaching the boot volume

bioctl(8)'s -d has no sanity checks and happily "deletes" any volume,
whether currently in use or not.

For now, refuse to detach the boot volume as a (too) simple safety guard,
until proper logic around mounted file systems on top is implemented.

Found the hard way through "bioctl -d sd1" with sd1 hosting /, after which
it took both fsck(8) and installboot(8) from a miniroot USB to recover.

regress/sys/dev/softraid also triggers it if root is on softraid.

OK claudio op jsing

date 2022-12-18T13:18:36Z
author aoyama
files src/sys/arch/luna88k/luna88k/locore0.S log diff annotate
message Do not save bootdev and boothowto when invalid value has passed.

This occurs the kernel has booted from old boot loader or directly
booted by command line parameter on emulator.

Tested by LUNA-88K2 and nono emulator.

date 2022-12-18T17:42:23Z
author daniel
files src/sys/dev/pci/pcidevs log diff annotate
message add two transmeta devices

According to the "Efficeon BIOS Programmers Guide", the Efficeon
processor has a virtual north bridge that can communicate with the
south bridge over HyperTransport (device 0x0060) and with the
graphics controller over an AGP bridge (device 0x0061).

ok jsg@

date 2022-12-18T17:42:56Z
author daniel
files src/sys/dev/pci/pcidevs.h log diff annotate
src/sys/dev/pci/pcidevs_data.h log diff annotate
message regen

date 2022-12-18T23:41:17Z
author deraadt
files src/sys/uvm/uvm_map.c log diff annotate
message spelling

date 2022-12-19T00:22:11Z
author guenther
files src/sys/sys/wait.h log diff annotate
message Add WTRAPPED opiton for waitid(2) to control whether CMD_TRAPPED
state changes are reported. That's the 6th bit, so switch to hex
constants. Adjust #if tests for consistency

ok kettenis@

date 2022-12-19T00:22:12Z
author guenther
files src/sys/kern/kern_exit.c log diff annotate
message Add WTRAPPED opiton for waitid(2) to control whether CMD_TRAPPED
state changes are reported. That's the 6th bit, so switch to hex
constants. Adjust #if tests for consistency

ok kettenis@

date 2022-12-19T04:35:33Z
author dlg
files src/sys/net/pfvar.h log diff annotate
message move pf_state_item and pf_state_key structs from pfvar.h to pfvar_priv.h.

both of these are kernel private data structures and do not need
to be visible to userland. moving them to pfvar_priv.h makes this
explicit, and makes it leass scary to tweak them in the future.

ok deraadt@ kn@ sashan@

date 2022-12-19T04:35:34Z
author dlg
files src/sys/net/pfvar_priv.h log diff annotate
message move pf_state_item and pf_state_key structs from pfvar.h to pfvar_priv.h.

both of these are kernel private data structures and do not need
to be visible to userland. moving them to pfvar_priv.h makes this
explicit, and makes it leass scary to tweak them in the future.

ok deraadt@ kn@ sashan@

date 2022-12-19T04:48:07Z
author dlg
files src/sys/arch/amd64/amd64/Attic/vmm.c log diff annotate
message rework the synchronisation around suspend/resume.

the idea is that access to vmm from userland is gated by the vmm_softc
sc_status field, and then accounted for by the refcnt. you take a read
lock to check the gate, and if it is open then you can take a reference
and do your thing. once you've finished the work then you rele the
refcnt on the way out of the ioctl handler.

the suspend code takes a write lock to close the sc_status gate,
and then uses refcnt_finalise to wait for things in the ioctl handler
to get out.

on resume, the code takes the write lock, sets the refcnt up again for
userland to use, and then opens the gate.

tested by and ok dv@

date 2022-12-19T08:16:36Z
author kn
files src/sys/dev/softraidvar.h log diff annotate
message Say "discipline" not "dis" in comment, latter looks like typoed "disk"

date 2022-12-19T15:10:40Z
author visa
files src/sys/dev/usb/ugen.c log diff annotate
message Invalidate ugen(4) knote lists after device detach

This prevents the kernel from crashing when a ugen(4) device is detached
while kqueue still holds a reference to that device.

Crash reported and fix tested by xavier.s on bugs@.

OK mpi@

date 2022-12-19T15:27:06Z
author kn
files src/sys/dev/softraidvar.h log diff annotate
message Remove unused *sd_scsibus_dev member from struct sr_discipline

Under _KERNEL, dead since 2011 r1.100
Simplify softraid(4) to behave like other HBAs [...]

OK krw