1. 17 Jan, 2022 11 commits
  2. 16 Jan, 2022 17 commits
  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
      /usr/main-src/lib/libc/stdio/fread.c:133:10
      
      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
      10af8e45
    • HardenedBSD Sync Service's avatar
    • 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
      c8dafefa
    • 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
      f3229b62
    • 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
      4e3a4390
    • HardenedBSD Sync Service's avatar
    • Peter Holm's avatar
      stress2: Added a new unionfs test scenario · 3266a0c5
      Peter Holm authored
      3266a0c5
    • HardenedBSD Sync Service's avatar
    • 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
      de1292c6
    • 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
      4a432614
    • 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
      fd980feb
    • 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
      a727d953