1. 11 Sep, 2021 7 commits
    • Rick Macklem's avatar
      nfscl: Make vfs.nfs.maxcopyrange larger by default · 55089ef4
      Rick Macklem authored
      As of commit 103b2075, the NFSv4.2 server will limit the size
      of a Copy operation based upon a 1 second timeout.  The Linux 5.2
      kernel server also limits Copy operation size to 4Mbytes.
      As such, the NFSv4.2 client can attempt a large Copy without
      resulting in a long RPC RTT for these servers.
      
      This patch changes vfs.nfs.maxcopyrange to 64bits and sets
      the default to the maximum possible size of SSIZE_MAX, since
      a larger size makes the Copy operation more efficient and
      allows for copying to complete with fewer RPCs.
      The sysctl may be need to be made smaller for other non-FreeBSD
      NFSv4.2 servers.
      
      MFC after:	2 weeks
      55089ef4
    • John Baldwin's avatar
      Add EPOCH_TRACE to NOTES to get LINT coverage. · b9485d76
      John Baldwin authored
      Sponsored by:	The FreeBSD Foundation
      b9485d76
    • Mark Johnston's avatar
      lio_test: Specify a mode with O_CREAT · 3a0976de
      Mark Johnston authored
      Sponsored by:	The FreeBSD Foundation
      3a0976de
    • Mark Johnston's avatar
      aio: Fix up the opcode in aiocb32_copyin() · 2884918c
      Mark Johnston authored
      With lio_listio(2), the opcode is specified by userspace rather than
      being hard-coded by the system call (e.g., aio_readv() -> LIO_READV).
      kern_lio_listio() calls aio_aqueue() with an opcode of LIO_NOP, which
      gets fixed up when the aiocb is copied in.
      
      When copying in a job request for vectored I/O, we need to dynamically
      allocate a uio to wrap an iovec.  So aiocb_copyin() needs to get the
      opcode from the aiocb and then decide whether an allocation is required.
      We failed to do this in the COMPAT_FREEBSD32 case.  Fix it.
      
      Reported by:	syzbot+27eab6f2c2162f2885ee@syzkaller.appspotmail.com
      Reviewed by:	kib, asomers
      Fixes:	f30a1ae8 ("lio_listio(2):  Allow LIO_READV and LIO_WRITEV.")
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31914
      2884918c
    • Mark Johnston's avatar
      sctp: Tighten up locking around sctp_aloc_assoc() · 2d5c48ec
      Mark Johnston authored
      All callers of sctp_aloc_assoc() mark the PCB as connected after a
      successful call (for one-to-one-style sockets).  In all cases this is
      done without the PCB lock, so the PCB's flags can be corrupted.  We also
      do not atomically check whether a one-to-one-style socket is a listening
      socket, which violates various assumptions in solisten_proto().
      
      We need to hold the PCB lock across all of sctp_aloc_assoc() to fix
      this.  In order to do that without introducing lock order reversals, we
      have to hold the global info lock as well.
      
      So:
      - Convert sctp_aloc_assoc() so that the inp and info locks are
        consistently held.  It returns with the association lock held, as
        before.
      - Fix an apparent bug where we failed to remove an association from a
        global hash if sctp_add_remote_addr() fails.
      - sctp_select_a_tag() is called when initializing an association, and it
        acquires the global info lock.  To avoid lock recursion, push locking
        into its callers.
      - Introduce sctp_aloc_assoc_connected(), which atomically checks for a
        listening socket and sets SCTP_PCB_FLAGS_CONNECTED.
      
      There is still one edge case in sctp_process_cookie_new() where we do
      not update PCB/socket state correctly.
      
      Reviewed by:	tuexen
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31908
      2d5c48ec
    • Doug Rabson's avatar
      Fix spelling of BUILDENV_SHELL · 895545d0
      Doug Rabson authored
      895545d0
    • Ka Ho Ng's avatar
      md: Add MD_MUSTDEALLOC support · 3703c188
      Ka Ho Ng authored
      This adds an option to detect if hole-punching is implemented by the
      underlying file system.  If this flag is set, and if the underlying file
      system does not support hole-punching, md(4) fails BIO_DELETE requests
      with EOPNOTSUPP.
      
      Sponsored by:	The FreeBSD Foundation
      Reviewed by:	markj
      Differential Revision:	https://reviews.freebsd.org/D31883
      3703c188
  2. 10 Sep, 2021 24 commits
    • Alan Somers's avatar
      Import atf 0.22 snapshot 55c21b2c5fb189bbdfccb2b297bfa89236502542 · 71a1ae7c
      Alan Somers authored
      The main improvement is the ability to skip a test that is expected to
      fail.
      71a1ae7c
    • Alan Somers's avatar
    • John Baldwin's avatar
      cxgbei: Handle errors in PDUs. · 4d4cf62e
      John Baldwin authored
      When a PDU with an error (bad padding, header digest, or data digest)
      is received, log the error via ICL_WARN() and then reset the
      connection via the ic_error callback.
      
      While here, add per-rxq counters for errors.
      
      Sponsored by:	Chelsio Communications
      4d4cf62e
    • Gleb Smirnoff's avatar
      pkg: fix regression that breaks bootstrap from not a current directory. · c96b4d87
      Gleb Smirnoff authored
      Fixes:		40b9f924
      Reviewed by:	kevans
      c96b4d87
    • Mark Johnston's avatar
      aio: Interlock with listen(2) · 141fe2dc
      Mark Johnston authored
      soo_aio_queue() did not handle the possibility that the provided socket
      is a listening socket.  Up until recently, to fix this one would have to
      acquire the socket lock first and check, since the socket buffer locks
      were destroyed by listen(2).
      
      Now that the socket buffer locks belong to the socket, simply check
      SOLISTENING(so) after acquiring them, and make listen(2) return an error
      if any AIO jobs are enqueued on the socket.
      
      Add a couple of simple regression test cases.
      
      Note that this fixes things only for the default AIO implementation;
      cxgbe(4)'s TCP offload has a separate pru_aio_queue implementation which
      requires its own solution.
      
      Reported by:	syzbot+c8aa122fa2c6a4e2a28b@syzkaller.appspotmail.com
      Reported by:	syzbot+39af117d43d4f0faf512@syzkaller.appspotmail.com
      Reported by:	syzbot+60cceb9569145a0b993b@syzkaller.appspotmail.com
      Reported by:	syzbot+2d522c5db87710277ca5@syzkaller.appspotmail.com
      Reviewed by:	tuexen, gallatin, jhb
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31901
      141fe2dc
    • Mark Johnston's avatar
      socket: Add macros to lock socket buffers using socket references · 74a68313
      Mark Johnston authored
      Since commit c67f3b8b the sockbuf
      mutexes belong to the containing socket.  Sockbufs contain a pointer to
      a mutex, which by default is initialized to the corresponding mutexes in
      the socket.  The SOCKBUF_LOCK() etc. macros operate on this pointer.
      However, the pointer is clobbered by listen(2) so it's not safe to use
      them unless one is sure that the socket is not a listening socket.
      
      This change introduces a new set of macros which lock socket buffers
      through the socket.  This is a bit cheaper since it removes the pointer
      indirection, and allows one to safely lock socket buffers and then check
      for a listening socket.
      
      For MFC, these macros should be reimplemented in terms of the existing
      socket buffer layout.
      
      Reviewed by:	tuexen, gallatin, jhb
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31900
      74a68313
    • Simon J. Gerraty's avatar
      make: fix MAKE_JOB_ERROR_TOKEN · 3b96abba
      Simon J. Gerraty authored
      The rework of GetBooleanVar to GetBooleanExpr requires
      we add "${" and ":U}" around the expression so it can be directly
      evaluated.
      
      Reported by: mjg
      MFC after: 1 week
      
      #
      #                                                         72 columns --|
      #
      # Uncomment and complete these metadata fields, as appropriate:
      #
      # PR:		<If and which Problem Report is related.>
      # Reported by:	<If someone else reported the issue.>
      # Reviewed by:	<If someone else reviewed your modification.>
      # Approved by:	<If you needed approval for this commit.>
      # Obtained from:	<If the change is from a third party.>
      # MFC after:	<N [day[s]|week[s]|month[s]].  Request a reminder email>
      # MFH:		<Ports tree branch name.  Request approval for merge.>
      # Relnotes:	<Set to 'yes' for mention in release notes.>
      # Security:	<Vulnerability reference (one per line) or description.>
      # Sponsored by:	<If the change was sponsored by an organization.>
      # Pull Request:	<https://github.com/freebsd/<repo>/pull/###>
      # Differential Revision:	<https://reviews.freebsd.org/D###>
      #
      # "Pull Request" and "Differential Revision" require the *full* GitHub or
      # Phabricator URL.  The commit author should be set appropriately, using
      # `git commit --author` if someone besides the committer sent in the change.
      #
      # Uncomment and complete these metadata fields, as appropriate:
      #
      # PR:
      # Reported by:	<If someone else reported the issue.>
      # Reviewed by:	<If someone else reviewed your modification.>
      # Approved by:	<If you needed approval for this commit.>
      # Obtained from:	<If the change is from a third party.>
      # MFC after:	<N [day[s]|week[s]|month[s]].  Request a reminder email>
      # MFH:		<Ports tree branch name.  Request approval for merge.>
      # Relnotes:	<Set to 'yes' for mention in release notes.>
      # Security:	<Vulnerability reference (one per line) or description.>
      # Sponsored by:	<If the change was sponsored by an organization.>
      # Pull Request:	<https://github.com/freebsd/<repo>/pull/###>
      # Differential Revision:	<https://reviews.freebsd.org/D###>
      #
      # "Pull Request" and "Differential Revision" require the *full* GitHub or
      # Phabricator URL.  The commit author should be set appropriately, using
      # `git commit --author` if someone besides the committer sent in the change.
      #
      3b96abba
    • Gleb Smirnoff's avatar
      ng_l2tp: improve callout locking. · 89042ff7
      Gleb Smirnoff authored
      Apparently e62e4b85 wasn't enough to close the race between
      a queue being flushed by a packet and callout executing, because
      the callouts used without a lock aren't 100% bulletproof. To close
      the race use callout_init_mtx() for L2TP timers, and make sure that
      all calls to ng_callout()/ng_uncallout() are done under the seq lock.
      
      If used properly, a locked callout can be used transparently with
      old netgraph KPI of ng_callout/ng_uncallout which predates locked
      callouts.
      
      While here, utilize ng_uncallout_drain() instead of ng_uncallout()
      on the node shutdown.
      
      PR:			241133
      Reviewed by:		mjg, markj
      Differential Revision:	https://reviews.freebsd.org/D31476
      89042ff7
    • Gleb Smirnoff's avatar
      ng_l2tp: improve seq structure locking. · 0a76c63d
      Gleb Smirnoff authored
      Cover few cases of access to seq without lock missed in 702f9895.
      There are no known bugs fixed with this change, however. With INVARIANTS
      embed ng_l2tp_seq_check() into lock/unlock macros. Slightly reduce number
      of locks/unlocks per packet keeping the lock between functions.
      
      Reviewed by:		mjg, markj
      Differential Revision:	https://reviews.freebsd.org/D31476
      0a76c63d
    • Gleb Smirnoff's avatar
      netgraph: add ng_uncallout_drain(). · b2954f0a
      Gleb Smirnoff authored
      Move shared code into ng_uncallout_internal(). While here add a comment
      mentioning a problem with scheduled+executing callout.
      
      Reviewed by:		mjg, markj
      Differential Revision:	https://reviews.freebsd.org/D31476
      b2954f0a
    • Gleb Smirnoff's avatar
      netgraph: pass return value from callout_stop() unmodified to callers of · 26cf4b53
      Gleb Smirnoff authored
      ng_uncallout. Most of them do not check it anyway, so very little node
      changes are required.
      
      Reviewed by:		mjg, markj
      Differential Revision:	https://reviews.freebsd.org/D31476
      26cf4b53
    • Kristof Provost's avatar
      pf: fix NOINET6 builds · 9bdff593
      Kristof Provost authored
      MFC after:	1 week
      Sponsored by:	Modirum MDPay
      9bdff593
    • Kristof Provost's avatar
      pf: qid and pqid can be uint16_t · b64f7ce9
      Kristof Provost authored
      tag2name() returns a uint16_t, so we don't need to use uint32_t for the
      qid (or pqid). This reduces the size of struct pf_kstate slightly. That
      in turn buys us space to add extra fields for dummynet later.
      
      Happily these fields are not exposed to user space (there are user space
      versions of them, but they can just stay uint32_t), so there's no ABI
      breakage in modifying this.
      
      MFC after:	1 week
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
      Differential Revision:	https://reviews.freebsd.org/D31873
      b64f7ce9
    • Mark Johnston's avatar
      wpi: Fix a lock leak in an error path in wpi_run() · 6d042d7c
      Mark Johnston authored
      PR:		258243
      Reported by:	dinghao.liu@zju.edu.cn
      MFC after:	1 week
      6d042d7c
    • orange30's avatar
      net: Fix memory leaks upon arp_fillheader() failures · f5777c12
      orange30 authored
      Free memory before return from arprequest_internal().  In in_arpinput(),
      if arp_fillheader() fails, it should use goto drop.
      
      Reviewed by:	melifaro, imp, markj
      MFC after:	1 week
      Pull Request:	https://github.com/freebsd/freebsd-src/pull/534
      f5777c12
    • Kristof Provost's avatar
      pf tests: synproxy to localhost test · 6598caba
      Kristof Provost authored
      Test syn-proxying a connection to the local host.
      
      Sponsored by:	Modirum MDPay
      MFC after:	1 week
      Differential Revision:	https://reviews.freebsd.org/D31854
      6598caba
    • Kristof Provost's avatar
      pf: fix synproxy to local · 0a51d74c
      Kristof Provost authored
      When we're synproxy-ing a connection that's going to us (as opposed to a
      forwarded one) we wound up trying to send out the pf-generated tcp
      packets through pf_intr(), which called ip(6)_output(). That doesn't
      work all that well for packets that are destined for us, so in that case
      we must call ip(6)_input() instead.
      
      MFC after:	1 week
      Sponsored by:   Modirum MDPay
      Differential Revision:	https://reviews.freebsd.org/D31853
      0a51d74c
    • Mark Johnston's avatar
      ipsec: Validate the protocol identifier in ipsec4_ctlinput() · 10eb2a2b
      Mark Johnston authored
      key_allocsa() expects to handle only IPSec protocols and has an
      assertion to this effect.  However, ipsec4_ctlinput() has to handle
      messages from ICMP unreachable packets and was not validating the
      protocol number.  In practice such a packet would simply fail to match
      any SADB entries and would thus be ignored.
      
      Reported by:	syzbot+6a9ef6fcfadb9f3877fe@syzkaller.appspotmail.com
      Reviewed by:	ae
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31890
      10eb2a2b
    • Mark Johnston's avatar
      net: Enter a net epoch around protocol if_up/down notifications · b1e6a792
      Mark Johnston authored
      When traversing a list of interface addresses, we need to be in a net
      epoch section, and protocol ctlinput routines need a stable reference to
      the address.
      
      Reported by:	syzbot+3219af764ead146a3a4e@syzkaller.appspotmail.com
      Reviewed by:	kp, melifaro
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      Differential Revision:	https://reviews.freebsd.org/D31889
      b1e6a792
    • Antranig Vartanian's avatar
      Add support for jail.conf.d · 7955efd5
      Antranig Vartanian authored
      Using /etc/jail.{jailname}.conf is nice, however it makes /etc/ very
      messy if you have many jails.  This patch allows one to move these
      config files out of the way into /etc/jail.conf.d/{jailname}.conf.
      
      Note that the same caveat as /etc/jail.*.conf applies: the jail service
      will not autodiscover all of these for starting 'all' jails.  This is
      considered future work, since the behavior matches.
      
      Reviewed by:	kevans
      MFC after:	1 month
      Differential Revision:	https://reviews.freebsd.org/D24570
      7955efd5
    • Kyle Evans's avatar
      kern: drop remaining references to removed makesyscalls.sh · 35aa1d6e
      Kyle Evans authored
      This was accidentally omitted from the recent removal of makeyscalls.sh.
      
      Reviewed by:	emaste
      Differential Revision:	https://reviews.freebsd.org/D30250
      35aa1d6e
    • Jessica Clarke's avatar
      libc: Fix build on case-insensitive file systems · 877175a1
      Jessica Clarke authored
      On case-insensitive file systems (most likely to be seen on macOS, where
      it is the default), _Fork.o for the new POSIX _Fork function conflicts
      with _fork.o for the PSEUDO file. This results in non-determinsitic
      behaviour in terms of which ends up being present; if _Fork.o wins then
      the build fails to link libc.so due to missing __sys_fork, and if
      _fork.o wins then libc silently fails to include the implementation of
      _Fork. A similar issue occurred in the past for C99's _Exit conflicting
      with exit(2) and was fixed in cb1cb6a2, so this adds a fix based on
      that.
      
      As a longer-term solution it might be better to instead make the
      generated files use a different prefix that's less likely to conflict
      with other things (such as __sys_foo.o given they always contain that)
      but that's a rather more invasive change.
      
      Fixes:	49ad342c ("Add _Fork()")
      Reviewed by:	kib
      MFC after:	1 week
      Differential Revision:	https://reviews.freebsd.org/D31895
      877175a1
    • Ed Maste's avatar
      openssh: regen config.h · 1f290c70
      Ed Maste authored
      Fixes:		19261079 ("openssh: update to OpenSSH v8.7p1")
      Reported by:	O. Hartmann
      Sponsored by:	The FreeBSD Foundation
      1f290c70
    • Colin Percival's avatar
      x86/tsc.c: Add TSLOG to test_tsc · cd165c8b
      Colin Percival authored
      On my benchmark system this takes ~ 14 ms; enough to be worth
      recording in the boot time profile.
      cd165c8b
  3. 09 Sep, 2021 9 commits
    • Warner Losh's avatar
      tabs: a hacky version of tabs appeared in 1st edition Unix · d780a23a
      Warner Losh authored
      First edition Unix had an /etc/tabs file. It contained the escape
      sequences to set tabs to every 8 stops on an old Teletype Model 37 and
      compatible terminals. One would 'cat /etc/tabs' to reset them.  Unix at
      the time effectively mandated this because the delays in the tty driver
      assumed this and tabs didn't work when they were too different from '8'.
      Document this historical niggle in HISTORY after it was brought to my
      attention on a Hacker News thread.
      
      Sponsored by: Netflix
      d780a23a
    • Guido Falsi's avatar
      openssh: Add new source files to libssl · f448c3ed
      Guido Falsi authored
      Add some new OpenSSH v8.7p1 source files to the ones being used to
      build libssl to avoid missing symbols.
      
      PR:             258384
      Fixes:          19261079 ("openssh: update to OpenSSH v8.7p1")
      Approved by:    kevans (src)
      f448c3ed
    • Vladimir Kondratyev's avatar
      hkbd(4): Fix build on 32bit platforms · 38d2e931
      Vladimir Kondratyev authored
      MFC after:	2 weeks
      38d2e931
    • Vladimir Kondratyev's avatar
      hkbd(4): Fix key repeats on multireport keyboards · 598f0580
      Vladimir Kondratyev authored
      Currently hkbd counts all key states to be "Up" at the start of
      interrupt callback. That results in generation of "Key Up" event for
      each key that has been downed before but is not listed in current
      report while is still downed.
      
      Fix that with clearing of temporary key data storage bits only for
      keys contained in processed report.
      
      Reported by:	Greg V
      Obtained from:	sysutils/iichid
      MFC after:	2 weeks
      598f0580
    • Vladimir Kondratyev's avatar
      hkbd(4): Use bitstring(3) KPI for key bitmaps processing. · 04918395
      Vladimir Kondratyev authored
      No functional changes intended.
      
      MFC after:	2 weeks
      04918395
    • Vladimir Kondratyev's avatar
      hkbd(4): Reduce diff with ukbd(4) · 3ef9023f
      Vladimir Kondratyev authored
      MFC after:	2 weeks
      3ef9023f
    • Vladimir Kondratyev's avatar
      psm(4): Disable KVM switch "jitter" clamping for absolute touchpads. · bedf31ad
      Vladimir Kondratyev authored
      r123442 introduced solution for clamping of PS/2 mice jitter when using
      a KVM. Solution is to buffer mouse packets for 0.050ms if mouse activity
      has not been seen for more than 0.5 seconds. Then flush that data to driver
      if no validation errors found or drop the entire queue otherwise.
      
      While it works well with relative devices it has issues with absolute ones
      Depending on history buffering may results in delaying of the touch front
      edge for 0.050ms that affects gesture processing (tap detection).
      
      As absolute touchpads usually are built-in devices we can safely disable
      bufferization and KVM jitter clamping to avoid such a delays.
      
      MFC after:	2 weeks
      bedf31ad
    • Henri Hennebert's avatar
      rtsx: Call taskqueue sooner, adjust DELAY(9) calls, add an inversion heuristic · 9d3bc163
      Henri Hennebert authored
      - Some configurations, e.g. HP EliteBook 840 G3, come with a dummy card
      in the card slot which is detected as a valid SD card.  This added long
      timeout at boot time.  To alleviate the problem, the default timeout is
      reduced to one second during the setup phase. [1]
      
      - Some configurations crash at boot if rtsx(4) is defined in the kernel
      config.  At boot time, without a card inserted, the driver found that
      a card is present and just after that a "spontaneous" interrupt is
      generated showing that no card is present.  To solve this problem,
      DELAY(9) is set to one quarter of a second before checking card presence
      during driver attach.
      
      - As advised by adrian, taskqueue and DMA are set up sooner during
      the driver attach.  A heuristic to try to detect configuration needing
      inversion was added.
      
      PR:		255130 [1]
      MFC after:	1 week
      Differential Revision:	https://reviews.freebsd.org/D30499
      9d3bc163
    • Michael Tuexen's avatar
      sctp: add explicit cast, no functional change intended · 3ea2cdd4
      Michael Tuexen authored
      MFC after:	3 days
      3ea2cdd4