1. 17 Jan, 2022 7 commits
  2. 16 Jan, 2022 11 commits
    • Marko Zec's avatar
      fib_algo: shift / mask by constants in dxr_lookup() · e7abe200
      Marko Zec authored
      Since trie configuration remains invariant during each DXR instance
      lifetime, instead of shifting and masking lookup keys by values
      computed at runtime, compile upfront several dxr_lookup()
      configurations with hardcoded shift / mask constants, and choose the
      apropriate lookup function version after each DXR instance rebuild.
      In synthetic tests this yields small but measurable (5-10%) lookup
      throughput improvement, depending on FIB size and  prefix patterns.
      MFC after:	3 days
    • Bjoern A. Zeeb's avatar
      LinuxKPI: 802.11 correct enum ieee80211_channel_flags · d7ce88aa
      Bjoern A. Zeeb authored
      enum ieee80211_channel_flags are used as bit fields and not as 1..n.
      Correct the values using BIT(n).
      This is also hoped to fix problems with 7260 cards which come up and
      panic due to an empty channel list as all channels are set disabled [1].
      It will hopefully also fix the one or other oddity.
      Reported by:	ambrisko, Mike Tancsa (mike sentex.net) [1]
      Sponsored by:	The FreeBSD Foundation
      MFC after:	3 days
    • Daniel Gerzo's avatar
      - fix typo · c8f8299a
      Daniel Gerzo authored
      Reported by: Glenn Tam
    • Ed Maste's avatar
      libc: correct SPDX tag on strstr.c · 2e9bc9d1
      Ed Maste authored
      It was obtained from musl, and is MIT licensed.
      MFC after:	3 days
      Sponsored by:	The FreeBSD Foundation
    • Ed Maste's avatar
      libc: fix misleading comment in strstr · c6750f07
      Ed Maste authored
      Obtained from:	musl c53e9b239418
    • Kristof Provost's avatar
      pf tests: Provoke failure in pf_ioctl_addrule · 4ca41937
      Kristof Provost authored
      MFC after:	3 weeks
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
    • Kristof Provost's avatar
      pf: ensure we don't destroy an uninitialised lock · e5ca5e80
      Kristof Provost authored
      The new lock introduced in 5f5e32f1 needs to be initialised early so
      that it can be safely destroyed if we error out.
      Reported-by: syzbot+d76113e9a4ae0c0fcac2@syzkaller.appspotmail.com
      MFC after:	3 weeks
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
    • Jessica Clarke's avatar
      etdump: Fix the file name included in the could not open error message · 340cebe9
      Jessica Clarke authored
      If only one file is passed, this reads the terminating NULL and so
      prints (null). If multiple files are passed then this always prints the
      second file, which may or may not exist (and will be particularly
      confusing if it does exist since the output will include the dump of the
      second file).
      MFC after:	1 week
    • Peter Holm's avatar
      stress2: Added a regression test · 90c5fd48
      Peter Holm authored
    • Peter Holm's avatar
      stress2: Added one more unionfs test · 5691cbec
      Peter Holm authored
    • Alexander Motin's avatar
      Fix inverse sleep logic in buf_daemon(). · e76c0108
      Alexander Motin authored
      Before commit 3cec5c77 buf_daemon() went to longer 1s sleep if
      numdirtybuffers <= lodirtybuffers.  After that commit new condition
      !BIT_EMPTY(BUF_DOMAINS, &bdlodirty) got opposite -- true when one
      or more more domains is above lodirtybuffers.  As result, on freshly
      booted system with no dirty buffers buf_daemon() wakes up 10 times
      per second and probably only 1 time per second when there is actual
      work to do.
      MFC after:	1 week
      Reviewed by:	kib, markj
      Tested by:	pho
      Differential revision:	https://reviews.freebsd.org/D33890
  3. 15 Jan, 2022 12 commits
    • Stefan Eßer's avatar
      fread.c: fix undefined behavior · 10af8e45
      Stefan Eßer authored
      A case of undefined behavior in __fread() has been detected by UBSAN
      and reported by Mark Millard:
      /usr/main-src/lib/libc/stdio/fread.c:133:10: runtime error: applying
      zero offset to null pointer
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
      While being benign (the NULL pointer is later passed to memcpy() with
      a length argument of 0), this issue causes in the order of 600 Kyua
      test cases to fail on systems running a world built with WITH_UBSAN
      and WITH_ASAN.
      The undefined behavior can be prevented by skipping operations that
      have no effect for r == 0. Mark Millard has suggested to only skip
      this code segment if fp->_p == NULL, but I have verified that for the
      case of r == 0 no further argument checking is performed on the
      addresses passed to memcpy() and thus no bugs are hidden from the
      sanitizers due to the simpler condition chosen.
      Reported by:	Mark Millard (marklmi@yahoo.com)
      Tested by:	Mark Millard (marklmi@yahoo.com)
      Differential Revision:	https://reviews.freebsd.org/D33903
      MFC after:	2 weeks
    • Bjoern A. Zeeb's avatar
      LinuxKPI: 802.11 Refine/add DTIM/TSF handling · c8dafefa
      Bjoern A. Zeeb authored
      Correct data types related to delivery traffic indication map (DTIM)/
      timing synchronization function (TSF) and implement/refine their
      handling.  This information is used/needed by iwlwifi to set a station
      as associated.  This will hopefully avoid more "no beacon heard"
      time event failures.
      The recording of the Linux specific sync_device_ts is done in the
      receive path for now in case we do have the right information
      available.  I need to investigate as to how-much it may make sense
      to also migrate it into net80211 in the future depending on the
      usage in other drivers (or how we did handle this in the past in
      natively ported versions, e.g. iwm).
      Sponsored by:	The FreeBSD Foundation
      MFC after:	3 days
    • Bjoern A. Zeeb's avatar
      LinuxKPI: 802.11 handle connection loss differently · f3229b62
      Bjoern A. Zeeb authored
      Rather than just bouncing back to SCAN bounce to INIT on connection
      loss.  This is should be refined in the future as the comment already
      indicates but we need to tie two different worlds together.
      Sponsored by:	The FreeBSD Foundation
      MFC after:	3 days
    • Jessica Clarke's avatar
      ofw_pci: Fix incorrectly sized softc causing pci(4) out-of-bounds reads · 4e3a4390
      Jessica Clarke authored
      We do not include sys/rman.h and so machine/resource.h ends up not being
      included by the time pci_private.h is included. This means PCI_RES_BUS
      is never defined, and so the sc_bus member of pci_softc is not present
      when compiling ofw_pci, resulting in the wrong softc size being passed
      to DEFINE_CLASS_1 and thus any attempts by pci(4) to access that member
      are out-of-bounds reads or writes.
      This is pretty fragile; arguably pci_private.h should be including
      sys/rman.h, but this is the minimal needed change to fix the bug whilst
      maintaining the status quo.
      Found by:	CHERI
      Reported by:	andrew
    • Peter Holm's avatar
      stress2: Added a new unionfs test scenario · 3266a0c5
      Peter Holm authored
    • Colin Percival's avatar
      Use CPUID leaf 0x40000010 for local APIC freq · de1292c6
      Colin Percival authored
      Some VM systems announce the frequency of the local APIC via the
      CPUID leaf 0x40000010.  Using this allows us to boot slightly
      faster by avoiding the need for timer calibration.
      Reviewed by:	markj
      Sponsored by:	https://www.patreon.com/cperciva
    • Colin Percival's avatar
      TSC: Use 0x40000010 CPUID leaf for all VM types · 4a432614
      Colin Percival authored
      While this CPUID leaf was originally only used by VMWare, other
      hypervisors now also use it to announce the TSC frequency to guests.
      This speeds up the boot process by 100 ms in EC2 and other systems,
      by allowing the early calibration DELAY to be skipped.
      Reviewed by:	markj
      Sponsored by:	https://www.patreon.com/cperciva
    • Colin Percival's avatar
      Detect CPU type before asking VMWare for TSC freq · fd980feb
      Colin Percival authored
      This allows us to set tsc_is_invariant and select appropriately
      fenced versions of RDTSC based on the CPU type.
      Reviewed by:	markj
      Sponsored by:	https://www.patreon.com/cperciva
    • Navdeep Parhar's avatar
      cxgbe(4): Fix bad races between sysctl and driver detach. · a727d953
      Navdeep Parhar authored
      The default sysctl context setup by newbus for a device is eventually
      freed by device_sysctl_fini, which runs after the device driver's detach
      routine.  sysctl nodes associated with this context must not use any
      resources (like driver locks, hardware access, counters, etc.) that are
      released by driver detach.
      There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to
      hang them off a context that is explicitly freed by the driver before it
      releases any resource that might be used by a sysctl.
      This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop
      and loading/unloading the driver in parallel.
      Reported by:	Suhas Lokesha
      MFC after:	1 week
      Sponsored by:	Chelsio Communications
    • Ed Maste's avatar
      snd_hda: restore pin patch for headphones on Lenovo X1 7th Gen · 301b2b02
      Ed Maste authored
      Fixes:		ef790cc7 ("hdaa: update pin patch configurations")
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D33900
    • Warner Losh's avatar
      ata_xpt: Rename probe_softc to aprobe_softc · 4762aa57
      Warner Losh authored
      Since both scsi_xpt and ata_xpt use the same name for the softc, this
      can lead to problems in gdb. Avoid the issue by renaming the ata
      probe_softc to aprobe_softc as has been done for the aprobe in
      0f280cbd. This was overlooked at the time.
      Sponsored by:		Netflix
      MFC After:		2 weeks
    • Simon J. Gerraty's avatar
      Ignore calcru: runtime went backwards for vm_guest · bacb140f
      Simon J. Gerraty authored
      VM's have little control over CPU speed, don't make matters worse
      by constantly spaming console.
      Reviewed by:	jhb
      Differential Revision:	https://reviews.freebsd.org/D33902
  4. 14 Jan, 2022 10 commits
    • Alexander Motin's avatar
      cam: Optimize write protection MODE SENSE in da(4). · a9a2cdaf
      Alexander Motin authored
      Before this change on every open da(4) driver read all mode pages to
      use only one bit.  It was done so to not depend on the list of pages
      supported by the disk.  But I've found that at least for SATL of LSI/
      Broadcom HBAs with WD HDDs Power Condition mode page reading may take
      significant amount of time, much more than any other mode page, that
      visibly increased disk retaste time by GEOM.
      Address that by using data returned by the first MODE SENSE request
      to limit the following ones to only one (the first for now) mode page.
      With the change simultaneous retaste of 39 SATA disks takes about 2.5s
      instead of more than 4s before, and I no longer see "dareprobe" status
      on GEOM event thread.
      MFC after:	2 weeks
      Sponsored by:	iXsystems, Inc.
    • Eric van Gyzen's avatar
      Allow downstream projects to easily add private and internal libs · d7f944a0
      Eric van Gyzen authored
      Allow projects based on the FreeBSD tree to append to _PRIVATELIBS
      and _INTERNALLIBS by simply maintaining their own lists of
      Reviewed by:	bdrewery
      MFC after:	1 week
      Sponsored by:	Dell EMC Isilon
      Differential Revision: https://reviews.freebsd.org/D33901
    • Vincenzo Maffione's avatar
      netmap: fix LOR in iflib_netmap_register · e0e12405
      Vincenzo Maffione authored
      In iflib_device_register(), the CTX_LOCK is acquired first and then
      IFNET_WLOCK is acquired by ether_ifattach(). However, in netmap_hw_reg()
      we do the opposite: IFNET_RLOCK is acquired first, and then CTX_LOCK
      is acquired by iflib_netmap_register(). Fix this LOR issue by wrapping
      the CTX_LOCK/UNLOCK calls in iflib_device_register with an additional
      IFNET_WLOCK. This is safe since the IFNET_WLOCK is recursive.
      MFC after:	1 month
    • Daniel Ebdrup Jensen's avatar
      carp(4): Make regex additionally match on VLAN interfaces · 9f0b5687
      Daniel Ebdrup Jensen authored
      This tiny change to the example makes devd capable of reacting to carp
      status change events on VLAN interfaces.
      Reported by:	Thomas Steen Rasmussen (tykling) <thomas at gibfest.dk>
    • Mark Johnston's avatar
      uma: Avoid polling for an invalid SMR sequence number · a04ce833
      Mark Johnston authored
      Buckets in an SMR-enabled zone can legitimately be tagged with
      SMR_SEQ_INVALID.  This effectively means that the zone destructor (if
      any) was invoked on all items in the bucket, and the contained memory is
      safe to reuse.  If the first bucket in the full bucket list was tagged
      this way, UMA would unnecessarily poll per-CPU state before attempting
      to fetch a full bucket from the list.
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
    • Mark Johnston's avatar
      vm_pageout: Print a more accurate message to the console before an OOM kill · 4a864f62
      Mark Johnston authored
      Previously we'd always print "out of swap space."  This can be
      misleading, as there are other reasons an OOM kill can be triggered.  In
      particular, it's entirely possible to trigger an OOM kill on a system
      with plenty of free swap space.
      Reviewed by:	kib
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D33810
    • Mark Johnston's avatar
      zone.9: Remove documentation of non-existent NUMA configuration flags · 39d4ccf8
      Mark Johnston authored
      These configuration options were removed in commit dfe13344.
      Some forthcoming work will update the UMA man page to describe its
      current behaviour on NUMA systems.
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
    • Mark Johnston's avatar
      netbsd-tests: Fix the libc stat_socket test · 95c75073
      Mark Johnston authored
      The test tries to connect a socket to a closed port at  It
      sets O_NONBLOCK on the socket first and expects to get EINPROGRESS from
      connect(2), but this is not guaranteed, ECONNREFUSED is possible.
      Handle both cases, and re-enable the test.
      PR:		240621
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
    • Mark Johnston's avatar
      Revert "Disable flaky test lib.libc.sys.setrlimit_test.setrlimit_stack" · 7bd2df8c
      Mark Johnston authored
      The stack gap implementation is disabled by default now, so the test
      This reverts commit dad71022.
      PR:		259969
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
    • Corvin Köhne's avatar
      bhyve: add nvlist functions for setting unset nodes · fe453891
      Corvin Köhne authored
      If an emulation uses those functions instead of set_config_value_node
      or set_config_value, it allows the config values to get
      overwritten. Introducing new functions is much more readable than
      if else statements in the emulation code.
      Reviewed by:	khng
      MFC after:	2 weeks
      Sponsored by:	Beckhoff Automation GmbH & Co. KG
      Differential Revision:	https://reviews.freebsd.org/D33770