OpenBSD cvs log

created 2021-11-21T19:56:34Z
begin 2021-11-10T00:00:00Z
end 2021-11-17T00:00:00Z
path src/sys
commits 46

date 2021-11-10T04:45:15Z
author dlg
files src/sys/net/bpf.c log diff annotate
message whitespace tweaks, no functional change.

date 2021-11-10T04:46:25Z
author dlg
files src/sys/net/if_media.h log diff annotate
message whitespace tweak, no functional change.

enjoy rebuilding all the things cos i deleted a space.

date 2021-11-10T06:33:30Z
author anton
files src/sys/dev/usb/uhidev.c log diff annotate
src/sys/dev/usb/uhidev.h log diff annotate
message Second attempt to resolve UHIDEV_CLAIM_MULTIPLE_REPORTID conflict, this
time without using sentinel that cannot be represented using a single
byte. Instead, use 0 as this report ID is reserved according to the USB
HID specification. Fixes attachment of some upd devices which exposes up
to 256 report IDs.

Thanks to Damien Couderc <openbsd at petrocore dot eu> for reporting and
testing.

date 2021-11-10T15:04:26Z
author bket
files src/sys/net/if_sppp.h log diff annotate
src/sys/net/if_spppsubr.c log diff annotate
message sppp(4) - support PPP IPCP extensions for DNS

RFC 1877 extends the family of network control protocols for
establishing and configuring the IPCP over PPP, defining the negotiation
of primary and secondary DNS addresses. After negotiation,
rtm_proposal() is used to send out DNS updates.

Feedback from claudio@ and kn@.

OK claudio@, kn@

date 2021-11-10T20:24:22Z
author bket
files src/sys/net/if_spppsubr.c log diff annotate
src/sys/net/route.h log diff annotate
message Give sppp(4) its own RTP_PROPOSAL priority

OK semarie@

date 2021-11-11T07:04:45Z
author anton
files src/sys/dev/usb/uhidev.c log diff annotate
src/sys/dev/usb/uhidev.h log diff annotate
message Here we go again, revert the second attempt to resolve the
UHIDEV_CLAIM_MULTIPLE_REPORTID conflict.

Breaks fido(4) as reported by gnezdo@

date 2021-11-11T09:34:27Z
author tb
files src/sys/uvm/uvm_swap.c log diff annotate
message Convert a for loop into LIST_FOREACH to reduce the diff to NetBSD.

ok millert mpi

date 2021-11-11T10:03:08Z
author claudio
files src/sys/arch/alpha/alpha/conf.c log diff annotate
src/sys/arch/amd64/amd64/conf.c log diff annotate
src/sys/arch/arm/arm/conf.c log diff annotate
src/sys/arch/arm64/arm64/conf.c log diff annotate
message Retire switch(4) it never really was production ready and the OpenFlow
API implemented is a deadend.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

date 2021-11-11T10:03:09Z
author claudio
files src/sys/arch/hppa/hppa/conf.c log diff annotate
src/sys/arch/i386/i386/conf.c log diff annotate
src/sys/arch/landisk/landisk/conf.c log diff annotate
src/sys/arch/loongson/loongson/conf.c log diff annotate
src/sys/arch/luna88k/luna88k/conf.c log diff annotate
src/sys/arch/macppc/macppc/conf.c log diff annotate
src/sys/arch/octeon/octeon/conf.c log diff annotate
src/sys/arch/powerpc64/powerpc64/conf.c log diff annotate
src/sys/arch/riscv64/riscv64/conf.c log diff annotate
src/sys/arch/sparc64/sparc64/conf.c log diff annotate
message Retire switch(4) it never really was production ready and the OpenFlow
API implemented is a deadend.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

date 2021-11-11T10:03:10Z
author claudio
files src/sys/conf/GENERIC log diff annotate
src/sys/conf/files log diff annotate
src/sys/net/if.c log diff annotate
src/sys/net/if_bridge.h log diff annotate
src/sys/net/Attic/if_switch.c log diff annotate
src/sys/net/Attic/if_switch.h log diff annotate
src/sys/net/Attic/switchctl.c log diff annotate
src/sys/net/Attic/switchofp.c log diff annotate
src/sys/sys/sockio.h log diff annotate
message Retire switch(4) it never really was production ready and the OpenFlow
API implemented is a deadend.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

date 2021-11-11T12:35:01Z
author sashan
files src/sys/net/if_pfsync.c log diff annotate
src/sys/net/pf_if.c log diff annotate
src/sys/net/pf_ioctl.c log diff annotate
src/sys/net/pf_table.c log diff annotate
src/sys/net/pfvar.h log diff annotate
message Allow pfi_kif_get() callers to pre-allocate buffer for new kif. If kif
object exists already, then caller must free the pre-allocated buffer.
If caller does not pre-allocate buffer, the pfi_kif_get() will get
memory from pool using M_NOWAIT flag.

Commit is also polishing pfi_initialize() a bit so it uses M_WAITOK
allocation for pfi_all.

there is no change in current behaviour.

feedback by bluhm@

OK bluhm@

date 2021-11-11T13:36:58Z
author stsp
files src/sys/dev/pci/if_iwn.c log diff annotate
src/sys/dev/pci/if_iwnreg.h log diff annotate
src/sys/dev/pci/if_iwnvar.h log diff annotate
message Fix iwn(4) with 4965 devices.

Our driver was using the wrong data structure for RXON_ASSOC commands on
4965 devices. This resulted in fatal firmware errors during association.

Problem found and fix tested on 4965 by jsg@.
Patch also tested on 6200 by me.

date 2021-11-11T14:03:21Z
author kn
files src/sys/.gitignore log diff annotate
message Ignore tags files

Besides obj (and all the build objects inside), tags seem to be the only
thing that's automatically created by our build infrastructure which should
never be committed.

CVS ignores "tags" due to its builtin list of ignore patterns.
Git does not ignore tags, although it has a builtin list (e.g. "*.o").
Got has no such builtin list.

Add "**/tags" to .gitignore specifically to provide a sane default for
Got checkouts.

Mirror .gitignore with sys/.gitignore to have the same experience with
kernel-only checkouts, as is common practise with Got.

OK stsp sthen

date 2021-11-11T16:35:09Z
author mvs
files src/sys/kern/uipc_socket.c log diff annotate
message Destroy protocol control block before perform `so_q0' and `so_q' queues
cleanup.

The dying socket is already unlinked from the file descriptor layer, but
still accessible from the stack or from the file system layer. We need to
unlink the socket to prevent concurrent connection when we unlocked dying
socket while we perform `so_q0' or `so_q' queues cleanup or while we
perform (*pr_detach)(). This unlocking will be appeared with the upcoming
fine grained locked sockets diffs.

ok bluhm@

date 2021-11-11T17:20:02Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
message Use vnode(9) lock to protect `v_socket' dereference.

The bind(2)ed UNIX socket hat the reference from the file system layer.
When we bind(2) such socket we link it to `v_socket' of associated
vnode(9). When we connect(2) to the socket we previously bind(2)ed we
finding it by namei(9) and obtain it's reference through `v_socket'. When
we close(2) this socket we set `v_socket' of associated vnode(9) to NULL.

This time the global `unp_lock' rwlock(9) protects the whole layer and the
dereference of `v_socket'. With the upcoming fine grained locking diffs it
will be replaced by per-socket solock(). So the dereference of `v_socket'
will be unsafe because it will be unlocked and has no extra reference in
the associated file descriptor.

Actually we have vnode(9) locked while we perform unp_bind() and
unp_connect() paths so use vnode(9) lock in the unp_detach() path too when
we disconnect dying socket from the associated vnode(9). This makes
`v_socket' locking consistent because `v_socket' relies to vnode(9) layer.
Also this makes `v_socket' dereference safe for the upcoming fine grained
locking diffs.

Do `v_socket' unlinking before `unp_refs' list cleanup to prevent
concurrent connections while dying socket `so' is unlocked.

ok bluhm@

date 2021-11-11T18:08:17Z
author bluhm
files src/sys/net/if_bridge.c log diff annotate
message Do not call ip_deliver() recursively from IPsec. As there is no
crypto task anymore, it is possible to return the next protocol.
Then ip_deliver() will walk the header chain in its loop.
IPsec bridge(4) tested by jan@
OK mvs@ tobhe@ jan@

date 2021-11-11T18:08:18Z
author bluhm
files 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/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 Do not call ip_deliver() recursively from IPsec. As there is no
crypto task anymore, it is possible to return the next protocol.
Then ip_deliver() will walk the header chain in its loop.
IPsec bridge(4) tested by jan@
OK mvs@ tobhe@ jan@

date 2021-11-11T18:36:59Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
message Fix GENERIC kernel compilation.

date 2021-11-11T18:43:05Z
author kettenis
files src/sys/arch/arm64/dev/apldart.c log diff annotate
message The Apple DART has a nifty feature that allows us protection of subranges
of a page with a granularity of 32-bit words. Use this to expose just
those parts of memory to devices that we want the device to see. This
means that handing down a small mbuf to a network card driver no longer
gives the hardware access to other mbufs in the same page.

It turns out that bge(4) always does aligned 64-bit access to memory though.
So round up/down to the nearest 64-bit boundary to prevent triggering an
IOMMU fault.

ok patrick@

date 2021-11-12T04:34:22Z
author visa
files src/sys/kern/kern_event.c log diff annotate
src/sys/kern/sys_generic.c log diff annotate
message Keep knotes between poll/select systems calls

Reduce the time overhead of kqueue-based poll(2) and select(2) by
keeping knotes registered between the system calls. It is expected that
the set of monitored file descriptors is relatively unchanged between
consecutive iterations of these system calls. By keeping the knotes,
the system saves the effort of repeated knote unregistering and
re-registering.

To avoid receiving events from file descriptors that are no longer in
the monitored set, each poll/select knote is assigned an increasing
serial number. Every iteration of poll/select uses a previously unused
range of serials for its knotes. In the setup stage, kqueue_register()
updates the serials of any existing knotes in the currently monitored
set. Function kqueue_scan() delivers only the events whose serials are
recent enough; expired knotes are dropped. When the serial range is
about to wrap around, all the knotes in the kqueue backend are dropped.

This change is a space-time tradeoff. Memory usage is increased somewhat
because of the retained knotes. The increase is limited by the number
of open file descriptors and active threads.

Idea from DragonFly BSD, initial patch by mpi@, kqueue_scan()-based
approach by me.

Tested by anton@ and mpi@
OK mpi@

date 2021-11-12T04:34:23Z
author visa
files src/sys/sys/event.h log diff annotate
message Keep knotes between poll/select systems calls

Reduce the time overhead of kqueue-based poll(2) and select(2) by
keeping knotes registered between the system calls. It is expected that
the set of monitored file descriptors is relatively unchanged between
consecutive iterations of these system calls. By keeping the knotes,
the system saves the effort of repeated knote unregistering and
re-registering.

To avoid receiving events from file descriptors that are no longer in
the monitored set, each poll/select knote is assigned an increasing
serial number. Every iteration of poll/select uses a previously unused
range of serials for its knotes. In the setup stage, kqueue_register()
updates the serials of any existing knotes in the currently monitored
set. Function kqueue_scan() delivers only the events whose serials are
recent enough; expired knotes are dropped. When the serial range is
about to wrap around, all the knotes in the kqueue backend are dropped.

This change is a space-time tradeoff. Memory usage is increased somewhat
because of the retained knotes. The increase is limited by the number
of open file descriptors and active threads.

Idea from DragonFly BSD, initial patch by mpi@, kqueue_scan()-based
approach by me.

Tested by anton@ and mpi@
OK mpi@

date 2021-11-12T11:40:35Z
author stsp
files src/sys/dev/pci/if_iwn.c log diff annotate
message Sync the iwn(4) "enhanced Tx power" eeprom data structure with Linux.
No functional change, as this data is not being used anywhere yet.

date 2021-11-12T11:40:36Z
author stsp
files src/sys/dev/pci/if_iwnreg.h log diff annotate
message Sync the iwn(4) "enhanced Tx power" eeprom data structure with Linux.
No functional change, as this data is not being used anywhere yet.

date 2021-11-12T11:41:04Z
author stsp
files src/sys/dev/pci/if_iwn.c log diff annotate
src/sys/dev/pci/if_iwnreg.h log diff annotate
src/sys/dev/pci/if_iwnvar.h log diff annotate
message Add support for 40MHz channels to the iwn(4) driver.

Tested:
4965: jsg
5300: stsp, Jan Stary
6030: Fred Crowsons
6200: stsp
6205: stsp, Josh Grosse
6300: okan, afresh1

date 2021-11-12T15:49:41Z
author deraadt
files src/sys/net/route.h log diff annotate
message "netconfigd" is now better known as resolvd(8)

date 2021-11-12T17:04:32Z
author kettenis
files src/sys/arch/arm64/dev/aplspi.c log diff annotate
message Use a mutex to lock the bus such that we can safely access the bus from
interrupt handlers and process context.

ok patrick@

date 2021-11-12T17:05:15Z
author kettenis
files src/sys/arch/arm64/dev/aplhidev.c log diff annotate
message Add support for controlling keyboard LEDs.

ok patrick@

date 2021-11-12T17:57:13Z
author cheloha
files src/sys/kern/kern_sig.c log diff annotate
message sigsuspend(2): sleep on &nowake channel

sigsuspend(2) only returns upon delivery of a signal: we do not expect
a wakeup(9). Indicate this by sleeping on &nowake instead of
&p->p_p->ps_sigacts. We still need to loop here to handle spurious
wakeups, though.

Spurious wakeup case pointed out by kettenis@.

ok claudio@

date 2021-11-12T22:20:57Z
author guenther
files src/sys/sys/exec_elf.h log diff annotate
message Add #defines and typedefs for RELR, a compressed form for relative relocations

ok kettenis@

date 2021-11-13T06:04:02Z
author visa
files src/sys/kern/kern_event.c log diff annotate
src/sys/kern/vfs_vnops.c log diff annotate
message Let filt_fileattach() run without the kernel lock

This makes it possible to attach pipe, socket and kqueue event filters
without acquiring the kernel lock. Event filters behind vn_kqfilter()
are not MP-safe yet, so vn_kqfilter() has to take KERNEL_LOCK().
dmabuf_kqfilter() can skip locking because it has no side effects.

OK anton@, mpi@

date 2021-11-13T18:18:59Z
author kn
files src/sys/msdosfs/msdosfs_vfsops.c log diff annotate
message Use long filenames by default on FAT filesystems

These days, 8.3 filenames are often a problem, filesystems containing
firmware with long names must not truncate them -- it's also a sane default
as portable file system between OSes, anyway.

Altough undocumented in mount_msdos(8), the default for FAT32 already is to
use long filenames: ever since its import from NetBSD in 1998.

Previously, mount_msdos would ignore long filenames and default to short
filenames unless a flag was used or long ones were found on the filesystem
prior to mounting it.

Just always mount with support for long filenames (unless `-s' is used).


As various install media use FAT filesystems, adjust the remaining ones to
also pass explicit mount option reflecting the previous default.

OK deraadt

date 2021-11-13T23:24:24Z
author kettenis
files src/sys/arch/arm64/dev/apldog.c log diff annotate
message Catch up with (proposed) Linux device tree bindings.

date 2021-11-14T21:51:48Z
author guenther
files src/sys/arch/amd64/stand/efiboot/Makefile.common log diff annotate
src/sys/arch/arm64/stand/efiboot/Makefile log diff annotate
src/sys/arch/armv7/stand/efiboot/Makefile log diff annotate
src/sys/arch/riscv64/stand/efiboot/Makefile log diff annotate
message Make sure efiboot is built with RELA/REL relocations and not RELR,
as self_reloc.c only handles the former.

ok deraadt@ kettenis@

date 2021-11-15T15:36:24Z
author anton
files src/sys/dev/usb/fido.c log diff annotate
src/sys/dev/usb/ucycom.c log diff annotate
src/sys/dev/usb/ugold.c log diff annotate
src/sys/dev/usb/uhid.c log diff annotate
src/sys/dev/usb/uhidev.c log diff annotate
src/sys/dev/usb/uhidev.h log diff annotate
src/sys/dev/usb/ujoy.c log diff annotate
src/sys/dev/usb/umt.c log diff annotate
src/sys/dev/usb/uoaklux.c log diff annotate
src/sys/dev/usb/uoakrh.c log diff annotate
src/sys/dev/usb/uoakv.c log diff annotate
src/sys/dev/usb/upd.c log diff annotate
src/sys/dev/usb/uslhcom.c log diff annotate
src/sys/dev/usb/uthum.c log diff annotate
src/sys/dev/usb/utrh.c log diff annotate
src/sys/dev/usb/utwitch.c log diff annotate
message In preparation for once again trying the resolve the claim multiple
report ids conflict, extract the claim multiple report ids conditional
in order to minimize the required upcoming changes to resolve the
conflict.

Tested by gnezdo@

date 2021-11-15T15:38:08Z
author anton
files src/sys/dev/usb/uhidev.h log diff annotate
message Third attempt to solve the claim multiple report ids conflict. Using the
report id to signal that multiple ones should be claimed by the match
routines does not work. All valid report ids 1-255 cannot of course be
used and 0 which is reserved by the USB HID specification is internally
used to represents devices lacking an explicit report id.

Therefore, use presence of the claimed array to signal that multiple
report ids can be claimed.

Tested by gnezdo@

date 2021-11-15T15:48:54Z
author visa
files src/sys/kern/kern_event.c log diff annotate
message Revert to eager removal of poll/select knotes

This should prevent a panic that bluhm@ has reported.

date 2021-11-15T17:14:51Z
author deraadt
files src/sys/kern/kern_pledge.c log diff annotate
message Copy p_p->ps_pledge into a local variable (called pledge) in every function
which checks PLEDGE_* bits more than once. Some functions are called without
locking, and this avoids misinterpreting bits which have some coupled behaviour.
ok cheloha kettenis

date 2021-11-16T08:56:19Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
message Move UNIX domain sockets garbage collector out of `unp_lock.

Except `unp_ino' this leaves only per-socket data protected by
`unp_lock'. The `unp_ino' protection is not the big deal and will be
done with mutex(9) in the future diff.

The garbage collector flags moved from from `unp_flags' to unp_gcflags'.

The two new locks introduced to protect garbage collector data. The
`unp_gc_lock' rwlock(9) protects `unp_defer', `unp_gcing', `unp_gcflags'
and `unp_link' list. The `unp_df_lock' protects `ud_link' list.

We need to simultaneously lock `unp_gc_lock' and `unp_lock'. When we
perform unp_attach() or unp_detach() we link PCB to `unp_link' list with
`unp_lock' held. But when unp_gc() does `unp_link' list walkthrough with
the `unp_gc_lock' lock held it should lock socket while performs
`so_rcv' buffer scan and the lock order should be the opposite.

In the future diff `unp_lock' will be replaced by per-socket `so_lock'
so it's better to enforce `unp_gc_lock' -> `unp_lock' (solock()) lock
order and release `unp_lock' in the unp_attach() and unp_detach() paths.
The previously committed diffs made this safe.

The `unp_df_lock' introduced because the `unp_lock' and `unp_gc_lock'
state are unknown when unp_discard() called. Since it touches only
`ud_link' list the re-lock dances are unwanted in this path. Also this
keeps M_WAITOK allocation outside rwlock(9) when unp_discard() called
from unp_externalize() error path.

ok bluhm@

date 2021-11-16T08:56:20Z
author mvs
files src/sys/sys/unpcb.h log diff annotate
message Move UNIX domain sockets garbage collector out of `unp_lock.

Except `unp_ino' this leaves only per-socket data protected by
`unp_lock'. The `unp_ino' protection is not the big deal and will be
done with mutex(9) in the future diff.

The garbage collector flags moved from from `unp_flags' to unp_gcflags'.

The two new locks introduced to protect garbage collector data. The
`unp_gc_lock' rwlock(9) protects `unp_defer', `unp_gcing', `unp_gcflags'
and `unp_link' list. The `unp_df_lock' protects `ud_link' list.

We need to simultaneously lock `unp_gc_lock' and `unp_lock'. When we
perform unp_attach() or unp_detach() we link PCB to `unp_link' list with
`unp_lock' held. But when unp_gc() does `unp_link' list walkthrough with
the `unp_gc_lock' lock held it should lock socket while performs
`so_rcv' buffer scan and the lock order should be the opposite.

In the future diff `unp_lock' will be replaced by per-socket `so_lock'
so it's better to enforce `unp_gc_lock' -> `unp_lock' (solock()) lock
order and release `unp_lock' in the unp_attach() and unp_detach() paths.
The previously committed diffs made this safe.

The `unp_df_lock' introduced because the `unp_lock' and `unp_gc_lock'
state are unknown when unp_discard() called. Since it touches only
`ud_link' list the re-lock dances are unwanted in this path. Also this
keeps M_WAITOK allocation outside rwlock(9) when unp_discard() called
from unp_externalize() error path.

ok bluhm@

date 2021-11-16T10:20:52Z
author landry
files src/sys/dev/hil/hilkbdmap.c log diff annotate
message hilkbd(4): Fix swedish keyboard layout botch on non-PS/2 style keyboards
introduced in 1.7 and preventing `o' and `p' keys from working as
intended. Reported by Anders Gustafsson.

From miod@

date 2021-11-16T12:55:50Z
author stsp
files src/sys/dev/pci/if_iwm.c log diff annotate
message fix typo in an error message printed by iwm_phy_ctxt_update()

date 2021-11-16T12:56:11Z
author stsp
files src/sys/dev/pci/if_iwx.c log diff annotate
message fix typo in an error message printed by iwx_phy_ctxt_update()

date 2021-11-16T13:48:23Z
author visa
files src/sys/kern/sys_generic.c log diff annotate
message Use nowake when poll/select has empty fd set

When the fd set is empty, the code waits for a signal or timeout.
Wakeups from the kqueue are neither expected nor wanted.

OK cheloha@, millert@, anton@, mpi@

date 2021-11-16T13:53:14Z
author bluhm
files src/sys/ddb/db_command.c log diff annotate
src/sys/netinet/ip_ipsp.c log diff annotate
src/sys/netinet/ip_ipsp.h log diff annotate
message To debug IPsec and tdb refcounting it is useful to have "show tdb"
and "show all tdbs" in ddb.
tested by Hrvoje Popovski; OK mvs@

date 2021-11-16T20:51:30Z
author sashan
files src/sys/net/pf_ioctl.c log diff annotate
message move memory allocations in pfr_add_addrs() outside of NET_LOCK()/PF_LOCK()
scope.

feedback by bluhm@

OK bluhm@

date 2021-11-16T20:51:31Z
author sashan
files src/sys/net/pf_table.c log diff annotate
src/sys/net/pfvar.h log diff annotate
message move memory allocations in pfr_add_addrs() outside of NET_LOCK()/PF_LOCK()
scope.

feedback by bluhm@

OK bluhm@