OpenBSD cvs log

created 2019-04-30T03:30:09Z
begin 2019-03-21T00:00:00Z
end 2019-03-28T00:00:00Z
path src/sys
commits 50

date 2019-03-21T11:50:20Z
author dlg
files src/sys/dev/pci/if_ixl.c log diff annotate
message run event callbacks directly in the atq processing

previously events were queued on an SLIST, but multiple link state
events could fire with the same callback. this corrupted the SLIST
and effectively caused an infinite loop.

ok jmatthew@

date 2019-03-21T12:30:58Z
author dlg
files src/sys/dev/pci/if_ixl.c log diff annotate
message don't set VLAN things when configuring promisc

the doco says vlan things should only be set if you're manipulating
something on a specific vlan, otherwise the config applies to
everything, which is how the stack wants things to work at the
moment.

there's still something wrong in here, but let's get this out of
the way first.

date 2019-03-21T16:47:17Z
author visa
files src/sys/arch/octeon/dev/Attic/octeon_pcibus_irq.h log diff annotate
message Remove an unused header.

date 2019-03-21T16:51:21Z
author visa
files src/sys/arch/octeon/include/intr.h log diff annotate
message Remove struct intrhand. It is no longer used on octeon.

date 2019-03-22T02:18:31Z
author dlg
files src/sys/dev/pci/if_ixl.c log diff annotate
message don't blindly complete admin queue entries

there's a bit in the flags field that the firmware sets when the
command is done, so check to decide if the command is ready to be
completed. this in turn makes ixl_iff work.

"oh" jmatthew@

date 2019-03-22T02:20:30Z
author dlg
files src/sys/dev/pci/if_ixl.c log diff annotate
message use a cond in ixl_atq_exec to wait for a command to be completed.

the main change is to not run ixl_atq_done, cos the interrupt handler
is supposed to do that for us.

date 2019-03-22T02:23:06Z
author dlg
files src/sys/dev/pci/if_ixl.c log diff annotate
message back out 1.28

i misread the doco, having promisc vlan reception is what we want.

date 2019-03-22T09:04:46Z
author kevlo
files src/sys/dev/pci/if_alc.c log diff annotate
src/sys/dev/pci/if_alcreg.h log diff annotate
message Add support for QCA AR816x/AR817x for alc(4).
Based on FreeBSD via Genadijus Paleckis on tech@, some modifications by me.

Tested with Atheros Killer E2200.

date 2019-03-22T12:02:38Z
author sthen
files src/sys/dev/usb/usbdevs log diff annotate
message add Meinberg DCF600USB, from weerd@, ok phessler@

date 2019-03-22T12:02:59Z
author sthen
files src/sys/dev/usb/usbdevs.h log diff annotate
src/sys/dev/usb/usbdevs_data.h log diff annotate
message sync

date 2019-03-22T12:04:25Z
author sthen
files src/sys/dev/usb/umbg.c log diff annotate
message support Meinberg DCF600USB, from weerd@, ok phessler

date 2019-03-22T12:05:45Z
author sthen
files src/sys/arch/amd64/conf/GENERIC log diff annotate
message build umbg(4) on amd64, previously only done on i386/macppc/octeon/sparc64
from weerd@, ok phessler

date 2019-03-22T12:07:00Z
author sthen
files src/sys/arch/i386/conf/GENERIC log diff annotate
src/sys/arch/macppc/conf/GENERIC log diff annotate
src/sys/arch/octeon/conf/GENERIC log diff annotate
src/sys/arch/sparc64/conf/GENERIC log diff annotate
message umbg now supports DCF600USB as well; adjust comment. from weerd@

date 2019-03-22T15:33:30Z
author kevlo
files src/sys/dev/pci/if_alc.c log diff annotate
message Mixmerge fixup.

Some of the flag and oactive handling bits and alc_stop_queue() were
mismerged.

Pointed out by Brad, thanks!

date 2019-03-22T16:21:21Z
author cheloha
files src/sys/kern/kern_tc.c log diff annotate
message Rename "timecounter_mtx" to "windup_mtx".

This will make upcoming MP-related diffs smaller and should make the code
int kern_tc.c easier to read in general. "windup_mtx" is also a better
mnemonic: always call tc_windup() before leaving windup_mtx.

date 2019-03-22T17:43:18Z
author kevlo
files src/sys/dev/pci/if_alc.c log diff annotate
message - Fix the AR816X_REV_B0 / default DMA channel selection to be the
same as the original code

- Merge FreeBSD's r304574
Correct DMA channel number selection on AR816x family of
controllers. For Gigabit Ethernet version of AR816x, AR813x/AR815x
except L1D controller, use vendor recommended ASPM parameters.
While here, increase alc_dma_burst array size. Broken H/W can
return bogus value in theory

From Brad.

date 2019-03-22T18:27:12Z
author cheloha
files src/sys/kern/kern_tc.c log diff annotate
message Move adjtimedelta into the timehands.

adjtimedelta is 64-bit and thus can't be read/written atomically on all
architectures. Because it can be modified from tc_windup() and
ntp_update_second() we need a way to ensure safe reads/writes for
adjtime(2) callers. One solution is to move it into the timehands and
adopt the lockless read protocol we now use for the system boot time and
uptime.

So make new_adjtimedelta an argument to tc_windup() and add a lockless
read loop to tc_adjtime(). With adjtimedelta stored in the timehands
we can now simply pass a timehands pointer to ntp_update_second(). This
makes ntp_update_second() safer as we're using the timehands' timecounter
pointer instead of the mutable global timecounter pointer.

Lots of input from mpi@ and visa@.

ok visa@

date 2019-03-23T05:27:53Z
author visa
files src/sys/arch/powerpc/include/cpu.h log diff annotate
message Add intr_{disable,restore}() for powerpc.

OK mpi@ patrick@

date 2019-03-23T05:30:16Z
author visa
files src/sys/kern/kern_lock.c log diff annotate
src/sys/sys/mutex.h log diff annotate
message Add a simple spinning mutex for ddb. Unlike mutex(9), this lock keeps
on spinning even if `db_active' or `panicstr' has been set. The new
mutex also disables IPIs in the critical section.

OK mpi@ patrick@

date 2019-03-23T05:47:22Z
author visa
files src/sys/arch/amd64/amd64/db_interface.c log diff annotate
src/sys/arch/amd64/include/db_machdep.h log diff annotate
src/sys/arch/arm64/arm64/db_interface.c log diff annotate
src/sys/arch/i386/i386/db_interface.c log diff annotate
src/sys/arch/i386/i386/db_mp.c log diff annotate
src/sys/arch/i386/include/db_machdep.h log diff annotate
message Use the debugger mutex for `ddb_mp_mutex'. This should prevent a race
that could leave `ddb_mp_mutex' locked if one CPU incremented
`db_active' while another CPU was in the critical section. When the race
hit, the debugger was unable to resume execution or switch between CPUs.

Race analyzed by patrick@

OK mpi@ patrick@

date 2019-03-23T05:47:23Z
author visa
files src/sys/arch/mips64/include/db_machdep.h log diff annotate
src/sys/arch/mips64/mips64/db_machdep.c log diff annotate
src/sys/arch/powerpc/ddb/db_interface.c log diff annotate
src/sys/arch/powerpc/include/db_machdep.h log diff annotate
src/sys/arch/sparc64/include/db_machdep.h log diff annotate
src/sys/arch/sparc64/sparc64/db_interface.c log diff annotate
message Use the debugger mutex for `ddb_mp_mutex'. This should prevent a race
that could leave `ddb_mp_mutex' locked if one CPU incremented
`db_active' while another CPU was in the critical section. When the race
hit, the debugger was unable to resume execution or switch between CPUs.

Race analyzed by patrick@

OK mpi@ patrick@

date 2019-03-24T06:09:09Z
author visa
files src/sys/arch/sh/include/cpu.h log diff annotate
message Add intr_{disable,restore}() for sh.

Reminded by deraadt@

date 2019-03-24T06:19:26Z
author visa
files src/sys/arch/alpha/include/cpu.h log diff annotate
src/sys/arch/alpha/include/intr.h log diff annotate
src/sys/arch/alpha/include/param.h log diff annotate
message Add intr_{disable,restore}() for alpha.

Reminded by deraadt@

date 2019-03-24T14:15:00Z
author fcambus
files src/sys/dev/rasops/rasops32.c log diff annotate
message Revert rasops32_putchar() changes introduced in revision 1.8.

This significantly speeds up character plotting on inteldrm and
radeondrm, and also on efifb(4) since the driver now remaps the
framebuffer in write combining mode.

OK kettenis@, jcs@

date 2019-03-24T14:37:43Z
author jcs
files src/sys/dev/pci/azalia.c log diff annotate
message Add a quirk for the Huawei Matebook X to activate the right-side
speaker on its Dolby Atmos system.

Through some extensive tracing of the Realtek Windows driver, I
found the many hundreds of CORB commands that the Windows driver
sends to initialize Dolby Atmos and activate both speakers.

The list of CORB commands was optimized by Tomas Espeleta to reduce
file size and then implemented in azalia by Stefan Sperling.

ok stsp, deraadt

date 2019-03-24T14:37:44Z
author jcs
files src/sys/dev/pci/azalia.h log diff annotate
src/sys/dev/pci/azalia_codec.c log diff annotate
message Add a quirk for the Huawei Matebook X to activate the right-side
speaker on its Dolby Atmos system.

Through some extensive tracing of the Realtek Windows driver, I
found the many hundreds of CORB commands that the Windows driver
sends to initialize Dolby Atmos and activate both speakers.

The list of CORB commands was optimized by Tomas Espeleta to reduce
file size and then implemented in azalia by Stefan Sperling.

ok stsp, deraadt

date 2019-03-24T16:48:37Z
author visa
files src/sys/arch/sparc64/conf/files.sparc64 log diff annotate
message Remove a stale kgdb dependency.

OK deraadt@

date 2019-03-24T17:55:39Z
author bru
files src/sys/dev/wscons/wsconsio.h log diff annotate
message Add new event types for precision scrolling.

date 2019-03-24T18:04:02Z
author bru
files src/sys/dev/wscons/wsmouse.c log diff annotate
src/sys/dev/wscons/wsmouseinput.h log diff annotate
src/sys/dev/wscons/wstpad.c log diff annotate
message Switch to precision scrolling in wstpad.

date 2019-03-24T18:14:20Z
author beck
files src/sys/kern/kern_unveil.c log diff annotate
src/sys/kern/vfs_syscalls.c log diff annotate
message Make stat(2) and access(2) need UNVEIL_READ instead of UNVEIL_INSPECT

UNVEIL_INSPECT is a hack we added to get chrome/glib working. It silently
adds permission for stat(2), access(2), and readlink(2) to be used on
all path components of any unveil'ed path. robert@ has sucessfully now
fixed chrome/glib to not require exessive TOC vs TOU stat(2) and access(2)
calls on the paths it uses, so that this no longer needed there.

readlink(2) is the sole call that is now permitted by UNVEIL_INSPECT,
and this is only needed so that realpath(3) can work. Going forward we will
likely make a realpath(2), after which we can completely deprecate
UNVEIL_INSPECT.

ok deraadt@

date 2019-03-24T18:17:24Z
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/virtio.c log diff annotate
src/sys/dev/pv/virtiovar.h log diff annotate
message virtio: adjust virtio_setup_queue prototype for 1.0

Make it take an address instead of a PFN.
Pass the virtqueue pointer. In virtio 1.0, more information has to be
configured in the device. Also call virtio_setup_queue() after the
information has been filled in.

ok mlarkin@

date 2019-03-24T18:21:12Z
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/vioblk.c log diff annotate
src/sys/dev/pv/vioblkreg.h log diff annotate
src/sys/dev/pv/viocon.c log diff annotate
src/sys/dev/pv/viomb.c log diff annotate
src/sys/dev/pv/vioscsireg.h log diff annotate
src/sys/dev/pv/virtio.c log diff annotate
src/sys/dev/pv/virtioreg.h log diff annotate
src/sys/dev/pv/virtiovar.h log diff annotate
src/sys/dev/pv/vmmci.c log diff annotate
message virtio: Prepare for 64 feature bits

virtio 1.0 supports an arbitrary number of feature bits. However, so far
no more than 64 are used (compared to 32 in virtio 0.9). Adjust data
types to support 64 feature bits.

Later, we may want to use bitmaps and setbit(), ... to support even more
feature bits.

ok mlarkin@

date 2019-03-24T18:22:36Z
author sf
files src/sys/dev/pv/if_vio.c log diff annotate
src/sys/dev/pv/vioblk.c log diff annotate
src/sys/dev/pv/vioblkreg.h log diff annotate
src/sys/dev/pv/virtio.c log diff annotate
message virtio: Add a few feature bit defines and names

ok mlarkin@

date 2019-03-24T20:45:34Z
author bru
files src/sys/dev/wscons/wstpad.c log diff annotate
message Fix a precedence problem.

date 2019-03-25T02:28:20Z
author kevlo
files src/sys/dev/pci/if_alc.c log diff annotate
message - Formatting fixes and in some cases bringing things a bit closer to the
original code
- Remove unusedd function decarations

From Brad

date 2019-03-25T14:17:58Z
author fcambus
files src/sys/arch/amd64/amd64/efifb.c log diff annotate
message Revert back to using previous values for EFIFB_WIDTH and EFIFB_HEIGHT,
as raising them expose an issue which breaks inteldrm on large screen
resolutions.

Reported by chris@, and by Lucas Raab on bugs@. Thanks!

date 2019-03-25T18:45:27Z
author guenther
files src/sys/arch/amd64/amd64/intr.c log diff annotate
src/sys/arch/amd64/include/intrdefs.h log diff annotate
message X86_IPI_NAMES's only use was #if 0'ed out; delete both

ok kettenis@ deraadt@

date 2019-03-25T18:48:12Z
author guenther
files src/sys/arch/amd64/amd64/cpu.c log diff annotate
src/sys/arch/amd64/amd64/ipifuncs.c log diff annotate
src/sys/arch/amd64/amd64/pctr.c log diff annotate
src/sys/arch/amd64/include/intrdefs.h log diff annotate
src/sys/arch/amd64/include/pctr.h log diff annotate
message Fix pctr(4) issues with MP and suspend:
- use an IPI to notify other CPUs toi update CR4 and the MSRs
- use the cpu(4) resume callback to restore the pctr(4) settings after
suspend/hibernate

ok kettenis@ deraadt@

date 2019-03-25T20:29:25Z
author guenther
files src/sys/arch/amd64/amd64/cpu.c log diff annotate
src/sys/arch/amd64/amd64/pmap.c log diff annotate
message panic() adds a newline, so don't include one in the format string

ok krw@ millert@

date 2019-03-25T23:32:00Z
author cheloha
files src/sys/kern/kern_tc.c log diff annotate
src/sys/kern/kern_time.c log diff annotate
src/sys/sys/timetc.h log diff annotate
message MP-safe timecounting: new rwlock: tc_lock

tc_lock allows adjfreq(2) and the kern.timecounter.hardware sysctl(2)
to read/write the active timecounter pointer and the .tc_adj_freq
member of the active timecounter safely. This eliminates any possibility
of a torn read/write for the .tc_adj_freq member when we drop the
KERNEL_LOCK from the timecounting layer. It also ensures the active
timecounter does not change in the midst of an adjfreq(2) call.

Because these are not high-traffic paths, we can get away with using
tc_lock in write-mode to ensure combination read/write adjtime(2) calls
are relatively atomic (a) to other writer adjtime(2) calls, and (b) to
settimeofday(2)/clock_settime(2) calls, which cancel ongoing adjtime(2)
adjustment.

When the KERNEL_LOCK is dropped, an unprivileged user will be able to
create some tc_lock contention via adjfreq(2); it is very unlikely to
ever be a problem. If it ever is actually a problem a lockless read
could be added to address it.

While here, reorganize sys_adjfreq()/sys_adjtime() to minimize code
under the lock. Also while here, make tc_adjfreq() void, as it cannot
fail under any circumstance. Also also while here, annotate various
globals/struct members with lock ordering details.

With lots of input from mpi@ and visa@.

ok visa@

date 2019-03-26T04:24:22Z
author visa
files src/sys/kern/kern_sched.c log diff annotate
message Make sure that each ci has its spc_deferred queue initialized.
Otherwise, the system can crash in smr_call_impl() if SMT is
enabled later.

Crash reported by jcs@

date 2019-03-26T13:41:40Z
author beck
files src/sys/kern/kern_unveil.c log diff annotate
message Remove this assert, I can't do this here with UNVEIL_INSPECT
added aggressively today. Hopefully post release a glorious
flensing will remove UNVEIL_INSPECT anyway

Reported-by: syzbot+3375ce307ac7909b907b@syzkaller.appspotmail.com

date 2019-03-26T16:02:54Z
author cheloha
files src/sys/kern/kern_time.c log diff annotate
message adjtime(2): set EINVAL if delta overflows 64 bits of microseconds.

No other (known) BSD-derived adjtime(2) implementation checks for overflow
when converting delta into its final denomination of fractional seconds.
This is peculiar, as the call originates in 4.3BSD.

However, glibc, uclibc, and (to an extent) musl /do/ check the input and set
EINVAL if it exceeds a certain bound, so we'll just use the errno that they
use to be consistent with extant practice.

Prompted by the comment kettenis@ left when we switched to storing the
adjustment in an int64_t like ~5 years ago (kern_time.c,v 1.87).

Positive feedback from deraadt@, manpage bits ok jmc@,
no code complaints from otto@ or tedu@.

date 2019-03-26T16:43:56Z
author cheloha
files src/sys/kern/kern_time.c log diff annotate
message Tweak previous: include for INT64_MAX/INT64_MIN.

date 2019-03-26T19:32:46Z
author mlarkin
files src/sys/arch/amd64/include/cpufunc.h log diff annotate
message vmm(4): On VMX, use sgdt/sidt to reset the GDT/IDT limits after exiting
the guest VM. By default, VMX sets the limits to 0xFFFF on exit, which is
larger than what we want and can lead to security issues.

While here, reset the LDT as well. We don't use this in OpenBSD, and
VMX loads a null LDT selector on exit anyway, but resetting it here
prevents any future surprises.

Pointed out by Maxime Villard from NetBSD - thanks!

ok deraadt@

date 2019-03-26T19:32:47Z
author mlarkin
files src/sys/arch/amd64/amd64/vmm.c log diff annotate
message vmm(4): On VMX, use sgdt/sidt to reset the GDT/IDT limits after exiting
the guest VM. By default, VMX sets the limits to 0xFFFF on exit, which is
larger than what we want and can lead to security issues.

While here, reset the LDT as well. We don't use this in OpenBSD, and
VMX loads a null LDT selector on exit anyway, but resetting it here
prevents any future surprises.

Pointed out by Maxime Villard from NetBSD - thanks!

ok deraadt@

date 2019-03-27T07:55:24Z
author kevlo
files src/sys/dev/pci/if_alc.c log diff annotate
message Add AR8152 PCI ids to alc_phy_down(), based on FreeBSD r272730.

From Brad

date 2019-03-27T22:04:20Z
author kettenis
files src/sys/dev/usb/usbdevs log diff annotate
message Add Exar XR21V1410.

ok deraadt@

date 2019-03-27T22:05:06Z
author kettenis
files src/sys/dev/usb/usbdevs.h log diff annotate
src/sys/dev/usb/usbdevs_data.h log diff annotate
message regen

date 2019-03-27T22:08:51Z
author kettenis
files src/sys/dev/usb/files.usb log diff annotate
src/sys/dev/usb/uxrcom.c log diff annotate
message Add uxrcom(4), a driver for the Exar XR21V1410 USB serial adapter.
Even though these chips implement the standard USB CDC class protocol
we need a separate driver to be able to disable hardware flow control.
Hardware flow control is automatically enabled in CDC mode but if the
relevant lines aren't connected this prevents the chip from getting
input.

ok deraadt@