OpenBSD cvs log

created 2021-10-25T14:02:14Z
begin 2021-10-23T00:00:00Z
end 2021-10-24T00:00:00Z
path src/sys
commits 16

date 2021-10-23T09:36:58Z
author sashan
files src/sys/net/pf_table.c log diff annotate
message YIELD() in pf_table.c should preempt for ioctl() callers only

OK @mpi

date 2021-10-23T12:48:17Z
author kettenis
files src/sys/dev/ic/bwfm.c log diff annotate
src/sys/dev/ic/bwfmvar.h log diff annotate
src/sys/dev/pci/if_bwfm_pci.c log diff annotate
src/sys/dev/sdmmc/if_bwfm_sdio.c log diff annotate
message Make sure we have enough space to add padding and final token to the nvram
data. Also add the MAC address to the nvram data when there is a
"local-mac-address" property in the device tree. This makes bwfm(4) work
with the firmware/nvram/clm_blob files provided with MacOS on the Apple
M1 Macs.

ok patrick@

date 2021-10-23T14:08:46Z
author mpi
files src/sys/kern/vfs_subr.c log diff annotate
message Assert that the KERNEL_LOCK() is held in vref(9).

This is a guard against pushing the lock too far in UVM's vnode land.

ok beck@

date 2021-10-23T14:42:07Z
author mpi
files src/sys/kern/vfs_subr.c log diff annotate
src/sys/uvm/uvm_aobj.c log diff annotate
message Sprinkle uvm_obj_destroy() over UVM object recycling code.

For now, only assert that the tree of pages is empty in uvm_obj_destroy().
This will soon be used to free the per-UVM object lock.

While here call uvm_obj_init() when new vnodes are allocated instead of
in uvn_attach(). Because vnodes and there associated UVM object are
currently never freed, it isn't easy to know where/when to garbage
collect the associated lock. So simply check that the reference of a
given object is 0 when uvn_attach().

Tested by many as part of a bigger diff.

ok kettenis@

date 2021-10-23T14:42:08Z
author mpi
files src/sys/uvm/uvm_device.c log diff annotate
src/sys/uvm/uvm_object.c log diff annotate
src/sys/uvm/uvm_vnode.c log diff annotate
message Sprinkle uvm_obj_destroy() over UVM object recycling code.

For now, only assert that the tree of pages is empty in uvm_obj_destroy().
This will soon be used to free the per-UVM object lock.

While here call uvm_obj_init() when new vnodes are allocated instead of
in uvn_attach(). Because vnodes and there associated UVM object are
currently never freed, it isn't easy to know where/when to garbage
collect the associated lock. So simply check that the reference of a
given object is 0 when uvn_attach().

Tested by many as part of a bigger diff.

ok kettenis@

date 2021-10-23T14:53:02Z
author claudio
files src/sys/sys/proc.h log diff annotate
message ps_sigcode, ps_sigcoderet and ps_sigcookie are immutable after a process
is created. Annotate them accordingly.
OK mpi@

date 2021-10-23T14:56:55Z
author claudio
files src/sys/kern/kern_sig.c log diff annotate
message Be consistend and add missing spaces around some of the NOTREACHED comments.

date 2021-10-23T15:00:11Z
author visa
files src/sys/net/bpf.c log diff annotate
message Fix double free after allocation failure in bpf(4).

Reported by Peter J. Philipp.

OK mpi@

date 2021-10-23T15:42:34Z
author tobhe
files src/sys/arch/amd64/amd64/aesni.c log diff annotate
src/sys/arch/amd64/amd64/via.c log diff annotate
message Retire asynchronous crypto API as it is no longer required by any driver and
adds unnecessary complexity. Dedicated crypto offloading devices are not common
anymore. Modern CPU crypto acceleration works synchronously, eliminating the need
for callbacks.

Replace all occurrences of crypto_dispatch() with crypto_invoke(), which is
blocking and only returns after the operation has completed or an error occured.
Invoke callback functions directly from the consumer (e.g. IPsec, softraid)
instead of relying on the crypto driver to call crypto_done().

ok bluhm@ mvs@ patrick@

date 2021-10-23T15:42:35Z
author tobhe
files src/sys/arch/arm64/arm64/cryptox.c log diff annotate
src/sys/arch/i386/i386/via.c log diff annotate
src/sys/arch/i386/pci/glxsb.c log diff annotate
src/sys/arch/octeon/dev/octcrypto.c log diff annotate
src/sys/crypto/crypto.c log diff annotate
src/sys/crypto/cryptodev.h log diff annotate
src/sys/crypto/cryptosoft.c log diff annotate
src/sys/dev/softraid_crypto.c log diff annotate
src/sys/dev/softraid_raid1c.c log diff annotate
src/sys/netinet/ip_ah.c log diff annotate
src/sys/netinet/ip_esp.c log diff annotate
src/sys/netinet/ip_ipcomp.c log diff annotate
src/sys/netinet/ip_ipsp.h log diff annotate
src/sys/netinet/ipsec_input.c log diff annotate
src/sys/netinet/ipsec_output.c log diff annotate
message Retire asynchronous crypto API as it is no longer required by any driver and
adds unnecessary complexity. Dedicated crypto offloading devices are not common
anymore. Modern CPU crypto acceleration works synchronously, eliminating the need
for callbacks.

Replace all occurrences of crypto_dispatch() with crypto_invoke(), which is
blocking and only returns after the operation has completed or an error occured.
Invoke callback functions directly from the consumer (e.g. IPsec, softraid)
instead of relying on the crypto driver to call crypto_done().

ok bluhm@ mvs@ patrick@

date 2021-10-23T16:39:03Z
author dv
files src/sys/dev/acpi/acpireg.h log diff annotate
src/sys/dev/acpi/tpm.c log diff annotate
message tpm(4): add support for tpm2 CRB interface

Some modern tpm2 devices require or prefer drivers communicate via
the CRB interface and not the TIS/fifo interface. This change adds
basic support for detecting CRB start mode and using CRB to issue
commands required for proper S4 hibernation. As a result, this also
defines a new struct definition for the TPM2 acpi table required
for start mode detection.

This fixes recent S4 regressions on the Surface Go 2 caused by a
change in firmware from Microsoft.

Other CRB start methods may need implementing in the future to
support additional hardware.

tested by deraadt@ and many others, ok kettenis@

date 2021-10-23T17:38:00Z
author patrick
files src/sys/tmpfs/tmpfs_vnops.c log diff annotate
message Fix tmpfs_lookup locking for ".." == ".". unveil_find_cover() calls
VFS_LOOKUP(dir, &parent) in a loop and looks up the parent directory
".." repeatedly. VFS_LOOKUP is expected to unlock 'dir' and return
'parent' locked.

So tmpfs_lookup() is called for ISDOTDOT and:
- runs with dvp = dir, vpp = &parent
- gets parent from tmpfs_vnode_get() and
- re-locks dir with vn_lock(dvp)
but skips the call to
VOP_UNLOCK(dvp);
on return because *vpp == dvp

The reason for doing so is the lookup for ".". In this case
tmpfs_lookup() just increases the reference on dvp and copies the
pointer:
*vpp = dvp; vref(dvp);

However, in our case we also have *vpp == dvp, but for a different
lookup (ISDOTDOT), so we must do the unlock.

From markus@

date 2021-10-23T17:39:08Z
author patrick
files src/sys/tmpfs/tmpfs_vnops.c log diff annotate
message Call uvm_vnp_uncache() in tmpfs_write(). We currently only call
uvm_vnp_uncache() in tmpfs_write() when a file grows in size. This
is not enough. We need to invalidate UVM's cache of the vnode every
time the contents of the vnode are modified. Failure to do so might
lead to inconsistencies between read/mmap consumers.

From Pedro Martelletto

date 2021-10-23T20:44:42Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
message sonewconn() returns the pointer to 'socket' struct so check it against
NULL instead of '0'.

ok deraadt@

date 2021-10-23T22:00:51Z
author bluhm
files src/sys/netinet/ip_ipcomp.c log diff annotate
message Fix use-after-free in ipcomp_output() introduced by previous commit.
Retrieve ilen and olen from crypto descriptors before freeing them.
Found by regress/sys/netinet/ipsec.
OK mpi@

date 2021-10-23T22:19:37Z
author bluhm
files src/sys/net/if_bridge.c log diff annotate
src/sys/netinet/ip_ah.c log diff annotate
src/sys/netinet/ip_esp.c log diff annotate
src/sys/netinet/ip_ipcomp.c log diff annotate
src/sys/netinet/ip_ipip.c log diff annotate
src/sys/netinet/ip_ipsp.h log diff annotate
src/sys/netinet/ipsec_input.c log diff annotate
src/sys/netinet/tcp_subr.c log diff annotate
src/sys/netinet/udp_usrreq.c log diff annotate
message There is an m_pullup() down in AH input. As it may free or change
the mbuf, the callers must be careful. Although there is no bug,
use the common pattern to handle this. Pass down an mbuf pointer
mp and let m_pullup() update the pointer in all callers.
It looks like the tcp signature functions should not be called.
Avoid an mbuf leak and return an error.
OK mvs@