1. 15 Jun, 2022 13 commits
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · da47c186
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      da47c186
    • Zhenlei Huang's avatar
      ifconfig.8: reflect removal of FDDI and Token Ring · 030f3ee9
      Zhenlei Huang authored
      Reviewed By:	pauamma
      Differential Revision: https://reviews.freebsd.org/D35409
      030f3ee9
    • Doug Moore's avatar
      iommu_gas: make iommu_gas_lowermatch non-recursive · f979ad00
      Doug Moore authored
      Change the recursive implementation to one that uses parent pointers
      to walk back up the rb-tree, to slightly improve performance.
      
      Reviewed by:	alc, kib
      MFC after:	3 weeks
      Differential Revision:	https://reviews.freebsd.org/D35486
      f979ad00
    • Alexander Motin's avatar
      hwpmc: Reenable PME before reenabling counters. · f9e62419
      Alexander Motin authored
      Doing otherwise may lead to lost interrupts, that in combination
      with hardware PMCs freezing may leave them frozen forever.  It may
      also slightly improve profiling accuracy.
      
      MFC after:	2 weeks
      f9e62419
    • Alexander Motin's avatar
      hwpmc: Correct sysctl description. · 918505d0
      Alexander Motin authored
      MFC after:	2 weeks
      918505d0
    • Mark Johnston's avatar
      loader: Relax the check in is_kernphys_relocatable() · 9a964ad5
      Mark Johnston authored
      The check fails in kernels compiled with KASAN because AddressSanitizer
      inserts redzones around global variables, so the size of the "kernphys"
      symbol is 32 rather than 8.  Thus we fall back to copying even though
      it's not necessary.
      
      Simply remove the size check.  I didn't want to extend the symbol size
      check since there's no guarantee that AddressSanitizer will always emit
      32 bytes for "kernphys".
      
      Reviewed by:	kib
      MFC after:	1 month
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35448
      9a964ad5
    • Mark Johnston's avatar
      kasan: Create a shadow for the bootstack prior to hammer_time() · 756bc3ad
      Mark Johnston authored
      When the kernel is compiled with -asan-stack=true, the address sanitizer
      will emit inline accesses to the shadow map.  In other words, some
      shadow map accesses are not intercepted by the KASAN runtime, so they
      cannot be disabled even if the runtime is not yet initialized by
      kasan_init() at the end of hammer_time().
      
      This went unnoticed because the loader will initialize all PML4 entries
      of the bootstrap page table to point to the same PDP page, so early
      shadow map accesses do not raise a page fault, though they are silently
      corrupting memory.  In fact, when the loader does not copy the staging
      area, we do get a page fault since in that case only the first and last
      PML4Es are populated by the loader.  But due to another bug, the loader
      always treated KASAN kernels as non-relocatable and thus always copied
      the staging area.
      
      It is not really practical to annotate hammer_time() and all callees
      with __nosanitizeaddress, so instead add some early initialization which
      creates a shadow for the boot stack used by hammer_time().  This is only
      needed by KASAN, not by KMSAN, but the shared pmap code handles both.
      
      Reported by:	mhorne
      Reviewed by:	kib
      MFC after:	1 month
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35449
      756bc3ad
    • Mark Johnston's avatar
      Fix the test used to wait for AP startup on x86, arm64, riscv · f6b799a8
      Mark Johnston authored
      On arm64, testing pc_curpcb != NULL is not correct since pc_curpcb is
      set in pmap_switch() while the bootstrap stack is still in use.  As a
      result, smp_after_idle_runnable() can free the boot stack prematurely.
      
      Take a different approach: use smp_rendezvous() to wait for all APs to
      acknowledge an interrupt.  Since APs must not enable interrupts until
      they've entered the scheduler, i.e., switched off the boot stack, this
      provides the right guarantee without depending as much on the
      implementation of cpu_throw().  And, this approach applies to all
      platforms, so convert x86 and riscv as well.
      
      Reported by:	mmel
      Tested by:	mmel
      Reviewed by:	kib
      Fixes:		8db2e8fd ("Remove the secondary_stacks array in arm64 and riscv kernels.")
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35435
      f6b799a8
    • Mark Johnston's avatar
      pmap: Keep PTI page table pages busy · c6d092b5
      Mark Johnston authored
      PTI page table pages are allocated from a VM object, so must be
      exclusively busied when they are freed, e.g., when a thread loses a race
      in pmap_pti_pde().  Simply keep PTPs busy at all times, as was done for
      some other kernel allocators in commit
      e9ceb9dd.
      
      Also remove some redundant assertions on "ref_count":
      vm_page_unwire_noq() already asserts that the page's reference count is
      greater than zero.
      
      Reported by:	syzkaller
      Reviewed by:	kib
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35466
      c6d092b5
    • Doug Ambrisko's avatar
      mount: revert the active vnode reporting feature · ce00b119
      Doug Ambrisko authored
      Revert the computing of active vnode reporting since statfs is used
      by a lot of tools.  Only report the vnodes used.
      
      Reported by:	mjg
      ce00b119
    • Emmanuel Vadot's avatar
      linuxkpi: Acquire giant when adding/removing i2c adapters · d87fad36
      Emmanuel Vadot authored
      We need Giant as we run in a taskqueue_thread via linux_work.
      This fix detaching amdgpu and i915kms.
      
      Reviewed by:	bz, hselasky, imp
      Sponsored by:	Beckhoff Automation GmbH & Co. KG
      Differential Revision:	https://reviews.freebsd.org/D35478
      d87fad36
    • Stefan Eßer's avatar
      contrib/bc: merge from vendor release 5.3.3 · f53b5fe7
      Stefan Eßer authored
      This update fixes a build issue of release 5.3.2 on the FreeBSD base
      system.
      
      Merge commit '3f739b05'
      
      MFC after:	2 weeks
      f53b5fe7
    • Stefan Eßer's avatar
      vendor/bc: import version 5.3.3 · 3f739b05
      Stefan Eßer authored
      This version fixes a build issue caused by the strict compiler
      warnings used when building FreeBSD base system components.
      3f739b05
  2. 14 Jun, 2022 26 commits
    • Mark Johnston's avatar
      vm_fault: Avoid unnecessary object relocking in vm_fault_copy_entry() · 1f88394b
      Mark Johnston authored
      Suggested by:	alc
      Reviewed by:	alc, kib
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35485
      1f88394b
    • Mark Johnston's avatar
      vm_fault: Fix a racy copy of page valid bits · d0443e2b
      Mark Johnston authored
      We do not hold the object lock or a page busy lock when copying src_m's
      validity state.  Prior to commit 45d72c7d we marked dst_m as fully
      valid.
      
      Use the source object's read lock to ensure that valid bits are not
      concurrently cleared.
      
      Reviewed by:	alc, kib
      Fixes:		45d72c7d ("vm_fault_copy_entry: accept invalid source pages.")
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35471
      d0443e2b
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · 1c665e95
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      1c665e95
    • Stefan Eßer's avatar
      vendor/bc: import version 5.3.2 · 6982f799
      Stefan Eßer authored
      This update restores support for suppression of the prompt with -P
      when using the libedit or libreadline libraries for command line
      editing and history.
      6982f799
    • John Baldwin's avatar
      pmcannotate: Don't increment end address passed to objdump -d. · 73702c39
      John Baldwin authored
      libpmc already returns an end address that is after the end of the
      last instruction of a function (on both amd64 and arm64) as the end
      address written to the annotate map file is computed as the start
      address of the symbol plus the size.
      
      Adding one could result in a curious failure where an entire
      function's contents in assembly was reduced instead to only the first
      instruction.  The reason is that when the end instruction is bumped by
      one, objdump -d can append the first instruction of the next function
      in its output.  However, since pmcannotate concatenates all of the
      objdump -d output from various functions into a single file which it
      then searches to find the assembly for a given file, if this
      additional trailer was earlier in the file than the full function, the
      trailer was chosen to represent the entire function resulting in the
      truncated listing of the function.
      
      Sponsored by:	University of Cambridge, Google, Inc.
      Differential Revision:	https://reviews.freebsd.org/D35399
      73702c39
    • John Baldwin's avatar
      newvers.sh: Don't use return to exit. · 6ab35c78
      John Baldwin authored
      Commit acfb506b replaced an exit 0 when using -V with a return
      instead.  FreeBSD's sh treats a return outside of a function like
      exit, but this is a non-portable extension.  Other Bourne shells only
      permit return to be used within a function and continue execution
      (possibly with a warning).
      
      To fix, don't reuse VARS_ONLY (which is intended to be set by other
      scripts before sourcing newvers.sh directly) and instead use a new
      variable (VARS_ONLY_EXIT) to restore the use of exit for the
      non-sourced case.
      
      Reviewed by:	emaste
      Obtained from:	CheriBSD
      Sponsored by:	DARPA
      Differential Revision:	https://reviews.freebsd.org/D35481
      6ab35c78
    • John Baldwin's avatar
      firmware: Map '@' in filenames to '_' in symbols. · 628a4156
      John Baldwin authored
      '@' is not a valid character in symbol names and can sometimes appear
      in path names.
      
      Reviewed by:	imp, markj
      Obtained from:	CheriBSD
      Sponsored by:	DARPA
      Differential Revision:	https://reviews.freebsd.org/D35480
      628a4156
    • John Baldwin's avatar
      rc.d/ntpd: Restart ntpd when resuming from sleep. · 1442fed7
      John Baldwin authored
      ntpd does not always gracefully handle clock steps during resume.
      This is probably most useful in conjunction with
      ntpd_sync_on_start=YES which will work around any clock skew while
      suspended.
      
      Reviewed by:	manu
      Differential Revision:	https://reviews.freebsd.org/D35479
      1442fed7
    • John Baldwin's avatar
      ktls_test: Permit an option to skip tests not using ifnet TLS. · ea4ebdcb
      John Baldwin authored
      If ktls.require_ifnet is set to true, then check the TLS offload mode
      for tests sending and receiving records and skip the test if the
      offload mode is not ifnet mode.
      
      This can be used along with ktls.host to run KTLS tests against a NIC
      supporting ifnet TLS and verify that expected cipher suites and
      directions used ifnet TLS rather than software TLS.  Receive tests may
      result in a false positive as receive ifnet TLS can use software as a
      fallback.
      
      Reviewed by:	markj
      Sponsored by:	Chelsio Communications
      Differential Revision:	https://reviews.freebsd.org/D35427
      ea4ebdcb
    • John Baldwin's avatar
      ktls_test: Permit connecting to a remote echo server for tests. · 2400a7b1
      John Baldwin authored
      Previously ktls tests always executed over a local socket pair.
      ktls.host can be set to a host to connect to with a single socket
      instead.  The remote end is expected to echo back any data received
      (such as the echo service).  The port can be set with ktls.port which
      defaults to "echo".
      
      This is primarily useful to permit testing NIC TLS offload use cases
      where the traffic needs to transit the NIC.
      
      Note that the variables must be set via
      'kyua -v test_suites.FreeBSD.ktls.host=host'.
      
      Reviewed by:	markj
      Sponsored by:	Chelsio Communications
      Differential Revision:	https://reviews.freebsd.org/D35426
      2400a7b1
    • John Baldwin's avatar
      ktls_test: Add a helper function to close sockets. · 2c105205
      John Baldwin authored
      Reviewed by:	markj
      Sponsored by:	Chelsio Communications
      Differential Revision:	https://reviews.freebsd.org/D35425
      2c105205
    • Mitchell Horne's avatar
      ddb: namespacing of struct command · 4ef7db5a
      Mitchell Horne authored
      'command' is too generic for something specific to the kernel debugger;
      change this so it is less likely to collide with local variable names.
      Also rename struct command_table to struct db_command_table.
      
      Reviewed by:	markj
      MFC after:	1 week
      Sponsored by:	Juniper Networks, Inc.
      Sponsored by:	Klara, Inc.
      Differential Revision:	https://reviews.freebsd.org/D35367
      4ef7db5a
    • Mitchell Horne's avatar
      modules: Only build MAC modules if options MAC is set · 648a47b8
      Mitchell Horne authored
      They are not loadable otherwise.
      
      Reviewed by:	emaste
      MFC after:	1 week
      Sponsored by:	Juniper Networks, Inc.
      Sponsored by:	Klara, Inc.
      Differential Revision:	https://reviews.freebsd.org/D35369
      648a47b8
    • Mark Johnston's avatar
      mount: Fix an incorrect assertion in kernel_mount() · 7565431f
      Mark Johnston authored
      The pointer to the mount values may be null if an error occurred while
      copying them in, so fix the assertion condition to reflect that
      possibility.
      
      While here, move some initialization code into the error == 0 block.  No
      functional change intended.
      
      Reported by:	syzkaller
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      7565431f
    • Mark Johnston's avatar
      vm_object: Use the vm_object_(set|clear)_flag() helpers · 630f633f
      Mark Johnston authored
      ... rather than setting and clearing flags inline.  No functional change
      intended.
      
      Reviewed by:	alc, kib
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35469
      630f633f
    • Mark Johnston's avatar
      truss: Make control message header parsing more robust · 4b0c6fa0
      Mark Johnston authored
      print_cmsg() was assuming that the control message chain is well-formed,
      but that isn't necessarily the case for sendmsg(2).  In particular, if
      cmsg_len is zero, print_cmsg() will loop forever.  Check for truncated
      headers and try to recover if possible.
      
      Reviewed by:	tuexen
      MFC after:	2 weeks
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35476
      4b0c6fa0
    • Mark Johnston's avatar
      rip6: Fix a lock order reversal in rip6_bind() · a14465e1
      Mark Johnston authored
      See also commit 71a1539e.
      
      Reported by:	syzbot+9b461b6a07a83cc10daa@syzkaller.appspotmail.com
      Reported by:	syzbot+b6ce0aec16f5fdab3282@syzkaller.appspotmail.com
      Reviewed by:	glebius
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35472
      a14465e1
    • Mark Johnston's avatar
      pipe: Use a distinct wait channel for I/O serialization · e8955bd6
      Mark Johnston authored
      Suppose a thread tries to read from an empty pipe.  pipe_read() does the
      following:
      
      1. pipelock(), possibly sleeping
      2. check for buffered data
      3. pipeunlock()
      4. set PIPE_WANTR and sleep
      5. goto 1
      
      pipelock() is an open-coded mutex; if a thread blocks in pipelock(), it
      sleeps until the lock holder calls pipeunlock().
      
      Both sleeps use the same wait channel.  So if there are multiple threads
      in pipe_read(), a thread T1 in step 3 can wake up a thread T2 sleeping
      in step 4.  Then T1 goes to sleep in step 4, and T2 acquires and
      releases the pipelock, waking up T1 again.  This can go on indefinitely,
      livelocking the process (and potentially starving a would-be writer).
      
      Fix the problem by using a separate wait channel for pipelock().
      
      Reported by:	Paul Floyd <paulf2718@gmail.com>
      Reviewed by:	mjg, kib
      PR:		264441
      MFC after:	1 month
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D35415
      e8955bd6
    • Cy Schubert's avatar
      rc.d/wpa_supplicant: Remove the sleep to improve boot time · 116679b3
      Cy Schubert authored
      bapt@ had discovered a noticeable boot improvement without the sleep.
      Without the sleep does not affect warm or cold boot however a
      service netif restart may cause dhclient to spend a few extra seconds
      to rerequest the DHCP request.
      
      Reported by:	bapt
      Reviewed by:	bapt
      MFC after:	2 months
      Differential Revision:	https://reviews.freebsd.org/D35457
      116679b3
    • Mitchell Horne's avatar
      Remove mips-specific Makefiles for /sbin and /usr/sbin · ec1a13df
      Mitchell Horne authored
      They are no longer needed, but were likely missed simply because they
      don't show up in a grep for 'mips'.
      
      Reviewed by:	emaste
      Differential Revision:	https://reviews.freebsd.org/D35475
      ec1a13df
    • Konstantin Belousov's avatar
      null_vptocnp(): busy nullfs mp instead of refing it · 7fd37611
      Konstantin Belousov authored
      null_nodeget() needs a valid mount point data, otherwise we might
      race and dereference NULL.
      
      Using MBF_NOWAIT makes non-forced unmount non-transparent for
      vn_fullpath() over nullfs, but we make no guarantee that fullpath
      calculation succeeds anyway.
      
      Reported and tested by:	pho
      Reviewed by:	jah
      Sponsored by:	The FreeBSD Foundation
      MFC after:	1 week
      Differential revision:	https://reviews.freebsd.org/D35477
      7fd37611
    • Doug Moore's avatar
      iommu_gas: use to first-fit search for lowermatch · 975715b7
      Doug Moore authored
      Reverse the order of the search for a free space in lowermatch, to
      make it a first-fit search. Iommu_gas_match_one always allocates from
      the beginning of the free gap discovered from searching the tree, so
      the current code isn't really allocating in a reverse first-fit
      anyway, and making the search first-fit reduces the number of iommu
      page table pages that are used.
      
      Reported by:	alc
      Reviewed by:	alc, kib
      MFC after:	3 weeks
      Differential Revision:	https://reviews.freebsd.org/D35458
      975715b7
    • Peter Holm's avatar
    • Alexander Motin's avatar
      CTL: Fix double command completions on HA failover. · 3b0e3e8d
      Alexander Motin authored
      I've found couple cases when CTL_FLAG_SENT_2OTHER_SC flags were not
      cleared on commands return from active node or the send failure.  It
      created races when ctl_failover_lun() call before ctl_process_done()
      could cause second ctl_done() and ctl_process_done() calls, causing
      all sorts of problems.
      
      MFC after:	2 weeks
      Sponsored by:	iXsystems, Inc.
      3b0e3e8d
    • Cy Schubert's avatar
      kern_thread.c: Fix i386 build · d7814015
      Cy Schubert authored
      Chase 4493a13e by updating static
      assertions of struct proc.
      d7814015
    • Jung-uk Kim's avatar
      ACPICA: Revert an upstream patch to appease useless warnings · c7f14adf
      Jung-uk Kim authored
      This patch removes warnings messages like the following added in ACPICA
      20220331:
      
          ACPI Warning: Firmware issue: Excessive sleep time (0xxx ms > 10 ms)
          in ACPI Control Method (20220331/exsystem-347)
      
      Note the original author of this patch wants to back it out:
      
      https://github.com/acpica/acpica/pull/780
      c7f14adf
  3. 13 Jun, 2022 1 commit
    • Rick Macklem's avatar
      nfscl: Clean up the code by removing unused arguments · 41c029d5
      Rick Macklem authored
      The "void *stuff" (also called fstuff and dstuff) argument
      was used by the Mac OSX port.  For FreeBSD, this argument
      is always NULL, so remove it to clean up the code.
      
      This commit gets rid of "stuff" for assorted functions
      defined in nfs_clrpcops.c and called in nfs_clvnops.c.
      Future commits will do the same for other functions.
      
      This commit should not result in a semantics change.
      41c029d5