]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoMerge bmake-20220208
Simon J. Gerraty [Wed, 9 Feb 2022 17:25:03 +0000 (09:25 -0800)]
Merge bmake-20220208

        * unit-tests/Makefile: disable opt-debug-x-trace on Linux if there
        is any chance we have dash as .SHELL

        * meta.c: use a variable to hold command line to be filtered
        to avoid any side effects from content of command line.

Merge commit '535c59a6a9214436f5d6643775d29808e4b3408d'

2 years agoImport bmake-20220208
Simon J. Gerraty [Wed, 9 Feb 2022 17:22:21 +0000 (09:22 -0800)]
Import bmake-20220208

* unit-tests/Makefile: disable opt-debug-x-trace on Linux if there
is any chance we have dash as .SHELL

* meta.c: use a variable to hold command line to be filtered
to avoid any side effects from content of command line.

2 years agobhyve/snapshot: switch to nvlist for snapshot requests
Robert Wing [Wed, 9 Feb 2022 17:11:57 +0000 (08:11 -0900)]
bhyve/snapshot: switch to nvlist for snapshot requests

Switch to using an nvlist with nvlist_send()/nvlist_recv() to
communicate from bhyvectl(8) to bhyve(8).

The idea is that a bhyve process receives a command with with a set of
arguments. The nvlist here is structured to reflect that premise.

For example, to snapshot the vm, the expected nvlist looks like:

    { cmd=START_CHECKPOINT, filename="filename" }

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33977

2 years agotcp: add sysctl interface for setting socket options
Michael Tuexen [Wed, 9 Feb 2022 11:24:41 +0000 (12:24 +0100)]
tcp: add sysctl interface for setting socket options

This interface allows to set a socket option on a TCP endpoint,
which is specified by its inp_gencnt. This interface will be
used in an upcoming command line tool tcpsso.

Reviewed by: glebius, rrs
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34138

2 years agotcp: fix compliation when KERN_TLS is not defined
Michael Tuexen [Wed, 9 Feb 2022 11:16:43 +0000 (12:16 +0100)]
tcp: fix compliation when KERN_TLS is not defined

Reported by: Gary Jennejohn
Fixes: fd7daa727126 - main - tcp: make tcp_ctloutput_set() non-static
Sponsored by: Netflix, Inc.

2 years agoocs_fc: Fix a possible Null pointer dereference
Ram Kishore Vegesna [Wed, 9 Feb 2022 10:14:12 +0000 (15:44 +0530)]
ocs_fc: Fix a possible Null pointer dereference

Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()

PR: 261453
Reported by: lwhsu

MFC after: 3 days

2 years agocron.8: Add periodic(8) to See Also
Mateusz Piotrowski [Wed, 9 Feb 2022 10:49:23 +0000 (11:49 +0100)]
cron.8: Add periodic(8) to See Also

2 years agovt: fix splash_cpu logos use of vd_drawrect
Stefan Grundmann [Wed, 9 Feb 2022 03:15:53 +0000 (22:15 -0500)]
vt: fix splash_cpu logos use of vd_drawrect

In the (extremely unlikely) case of vd->vd_height ==
vt_logo_sprite_height the vd_drawrect code would write outside of
frame-buffer memory.

MFC after: 1 week
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D34220

2 years agobmake: make opt-debug-x-trace broken on Linux
Ed Maste [Wed, 9 Feb 2022 01:18:04 +0000 (20:18 -0500)]
bmake: make opt-debug-x-trace broken on Linux

It fails during GitHub cross-build actions from Ubuntu 20.04.

sjg investigated and found it is a dash bug; a more extensive change
to handle this case will come in the next bmake update.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D34219

2 years agosrc.conf: regenerate
Piotr Kubaj [Wed, 9 Feb 2022 01:35:35 +0000 (02:35 +0100)]
src.conf: regenerate

2 years agopowerpc64le: enable CXGBETOOL and MLX5TOOL
Piotr Kubaj [Wed, 9 Feb 2022 01:13:54 +0000 (02:13 +0100)]
powerpc64le: enable CXGBETOOL and MLX5TOOL

While mlx5 is not yet enabled on powerpc64le, cxgbe is.
The binary seems to work properly.

Differential revision: https://reviews.freebsd.org/D34026
Reviewed by: emaste

2 years agotest-includes: Simplify $OBJDIR requirements
Warner Losh [Wed, 9 Feb 2022 00:23:31 +0000 (17:23 -0700)]
test-includes: Simplify $OBJDIR requirements

s=/=_=g in tested names so that all the objects live in $OBJDIR. This is
more robust than depending on side effects of auto OBJDIR features and
should fix buildworld issues some people have seen.

Suggested by: sjg@
Sponsored by: Netflix

2 years agotcp: make tcp_ctloutput_set() non-static
Michael Tuexen [Tue, 8 Feb 2022 17:49:44 +0000 (18:49 +0100)]
tcp: make tcp_ctloutput_set() non-static

tcp_ctloutput_set() will be used via the sysctl interface in a
upcoming command line tool tcpsso.

Reviewed by: glebius, rscheff
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D34164

2 years agoDisable clang 14 warning about bitwise operators in zstd
Dimitry Andric [Tue, 8 Feb 2022 20:46:03 +0000 (21:46 +0100)]
Disable clang 14 warning about bitwise operators in zstd

Parts of zstd, used in openzfs and other places, trigger a new clang 14
-Werror warning:

```
sys/contrib/zstd/lib/decompress/huf_decompress.c:889:25: error: use of bitwise '&' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
                        (BIT_reloadDStreamFast(&bitD1) == BIT_DStream_unfinished)
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

While the warning is benign, it should ideally be fixed upstream and
then vendor-imported, but for now silence it selectively.

MFC after: 3 days

2 years agotty_info: Avoid warning by using logical instead of bitwise operators
Dimitry Andric [Sun, 6 Feb 2022 17:41:20 +0000 (18:41 +0100)]
tty_info: Avoid warning by using logical instead of bitwise operators

Since TD_IS_RUNNING() and TS_ON_RUNQ() are defined as logical
expressions involving '==', clang 14 warns about them being checked with
a bitwise operator instead of a logical one:

```
sys/kern/tty_info.c:124:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
        runa = TD_IS_RUNNING(td) | TD_ON_RUNQ(td);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 ||
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:124:9: note: cast one or both operands to int to silence this warning
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:129:9: error: use of bitwise '|' with boolean operands [-Werror,-Wbitwise-instead-of-logical]
        runb = TD_IS_RUNNING(td2) | TD_ON_RUNQ(td2);
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                  ||
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
sys/kern/tty_info.c:129:9: note: cast one or both operands to int to silence this warning
sys/sys/proc.h:562:27: note: expanded from macro 'TD_IS_RUNNING'
                                ^
```

Fix this by using logical operators instead. No functional change
intended.

Reviewed by: cem, emaste, kevans, markj
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34186

2 years agolibc binuptime(): use the right function to get the most significant bit index
Konstantin Belousov [Tue, 8 Feb 2022 19:13:40 +0000 (21:13 +0200)]
libc binuptime(): use the right function to get the most significant bit index

Reported and tested by: Jaroslaw Pelczar <jarek@jpelczar.com>
PR: 261781
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoRemove device lio from i386's LINT-NOIP
Dimitry Andric [Tue, 8 Feb 2022 18:53:52 +0000 (19:53 +0100)]
Remove device lio from i386's LINT-NOIP

This fixes link errors for the LINT-NOIP kernel on i386:

```
ld: error: undefined symbol: tcp_lro_flush_all
>>> referenced by lio_droq.c
>>>               lio_droq.o:(lio_droq_process_packets)

ld: error: undefined symbol: tcp_lro_rx
>>> referenced by lio_core.c
>>>               lio_core.o:(lio_push_packet)

ld: error: undefined symbol: tcp_lro_init
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_attach)

ld: error: undefined symbol: tcp_lro_free
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_attach)
>>> referenced by lio_main.c
>>>               lio_main.o:(lio_destroy_nic_device)
*** [kernel] Error code 1
```

MFC after: 3 days

2 years agoriscv: Fix a race in pmap_pinit()
Mark Johnston [Tue, 8 Feb 2022 18:15:54 +0000 (13:15 -0500)]
riscv: Fix a race in pmap_pinit()

All pmaps share the top half of the address space.  With 3-level page
tables, the top-level kernel map entries are not static: they might
change if the kernel map is extended (via pmap_growkernel()) or a 1GB
mapping in the direct map is demoted (not implemented yet).  Thus the
riscv pmap maintains the allpmaps list to synchronize updates to
top-level entries.

When a pmap is created, it is inserted into this list after copying
top-level entries from the kernel pmap.  The copying is done without
holding the allpmaps lock, and it is possible for pmap_pinit() to race
with kernel map updates.  In particular, if a thread is modifying L1
entries, and a concurrent pmap_pinit() copies the old version of the
entries, it might not receive the update.

Fix the problem by copying the kernel map entries after inserting the
pmap into the list.  This ensures that the nascent pmap always receives
updates, though pmap_distribute_l1() may race with the page copy.

Reviewed by: mhorne, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34158

2 years agoktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode
Mark Johnston [Tue, 8 Feb 2022 17:36:41 +0000 (12:36 -0500)]
ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode

There was nothing preventing one from sending an empty fragment on an
arbitrary KTLS TX-enabled socket, but ktls_frame() asserts that this
could not happen.  Though the transmit path handles this case for TLS
1.0 with AES-CBC, we should be strict and allow empty fragments only in
modes where it is explicitly allowed.

Modify sosend_generic() to reject writes to a KTLS-enabled socket if the
number of data bytes is zero, so that userspace cannot trigger the
aforementioned assertion.

Add regression tests to exercise this case.

Reported by: syzkaller
Reviewed by: gallatin, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34195

2 years agofile: Make fget*() and getvnode*() consistent about initializing *fpp
Mark Johnston [Tue, 8 Feb 2022 17:34:20 +0000 (12:34 -0500)]
file: Make fget*() and getvnode*() consistent about initializing *fpp

Most fget*() functions initialize the output parameter to NULL.  Make
the externally visible interface behave consistently, and make
fget_unlocked_seq() private to kern_descrip.c.

This fixes at least one bug in a consumer, _filemon_wrapper_openat(),
which assumes that getvnode() sets the output file pointer to NULL upon
an error.

Reported by: syzbot+01c0459408f896a5933a@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34190

2 years agobhyve: Fix getaddrinfo() error handling
Mark Johnston [Tue, 8 Feb 2022 17:34:03 +0000 (12:34 -0500)]
bhyve: Fix getaddrinfo() error handling

- Use errx() since errno will not be set.
- Print the message returned by gai_strerror().

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agorelease.7: Drop obsolete notes about old versions of mkimg
Mark Johnston [Tue, 8 Feb 2022 17:33:48 +0000 (12:33 -0500)]
release.7: Drop obsolete notes about old versions of mkimg

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agosrc.conf: regenerate
Piotr Kubaj [Tue, 8 Feb 2022 13:14:02 +0000 (14:14 +0100)]
src.conf: regenerate

2 years agostress2: Updated test with problem found and mark it as a "no run"
Peter Holm [Tue, 8 Feb 2022 06:51:35 +0000 (07:51 +0100)]
stress2: Updated test with problem found and mark it as a "no run"

2 years agonetinet: simplify RSS ifdef statements
Franco Fichtner [Tue, 8 Feb 2022 02:22:03 +0000 (19:22 -0700)]
netinet: simplify RSS ifdef statements

Approved by: transport (rrs)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31583

2 years agocxgbei: Replace worker thread pools with per-connection kthreads.
John Baldwin [Tue, 8 Feb 2022 00:20:40 +0000 (16:20 -0800)]
cxgbei: Replace worker thread pools with per-connection kthreads.

Having a single pool of worker threads adds extra complexity and
overhead.  The software backend also uses per-connection kthreads.

Sponsored by: Chelsio Communications

2 years agocxgbei: Dispatch sent PDUs to the NIC asynchronously.
John Baldwin [Tue, 8 Feb 2022 00:20:06 +0000 (16:20 -0800)]
cxgbei: Dispatch sent PDUs to the NIC asynchronously.

Previously the driver was called to send PDUs to the NIC synchronously
from the icl_conn_pdu_queue_cb callback.  However, this performed a
fair bit of work while holding the icl connection lock.  Instead,
change the callback to add sent PDUs to a STAILQ and defer dispatching
of PDUs to the NIC to a helper thread similar to the scheme used in
the TCP iSCSI backend.

- Replace rx_flags int and the sole RXF_ACTIVE flag with a simple
  rx_active bool.

- Add a pool of transmit worker threads for cxgbei.

- Fix worker thread exit to depend on the wakeup in kthread_exit()
  to fix a race with module unload.

Reported by: mav
Sponsored by: Chelsio Communications

2 years agoAdd more USB host controller PCI ID's.
Hans Petter Selasky [Mon, 7 Feb 2022 23:28:57 +0000 (00:28 +0100)]
Add more USB host controller PCI ID's.

Submitted by: Gary Jennejohn <gljennjohn@gmail.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoExtend the VMM stats interface to support a dynamic count of statistics.
John Baldwin [Mon, 7 Feb 2022 22:11:10 +0000 (14:11 -0800)]
Extend the VMM stats interface to support a dynamic count of statistics.

- Add a starting index to 'struct vmstats' and change the
  VM_STATS ioctl to fetch the 64 stats starting at that index.
  A compat shim for <= 13 continues to fetch only the first 64
  stats.

- Extend vm_get_stats() in libvmmapi to use a loop and a static
  thread local buffer which grows to hold the stats needed.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D27463

2 years agodummynet: don't use per-vnet locks to protect global data.
Kristof Provost [Thu, 27 Jan 2022 10:41:21 +0000 (11:41 +0100)]
dummynet: don't use per-vnet locks to protect global data.

The ref_count counter is global (i.e. not per-vnet) so we can't use a
per-vnet lock to protect it. Moreover, in callouts curvnet is not set,
so we'd end up panicing when trying to use DN_BH_WLOCK().

Instead we use the global sched_lock, which is already used when
evaluating ref_count (in unload_dn_aqm()).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34059

2 years agosystat: Eliminate write-only unit variable
Warner Losh [Mon, 7 Feb 2022 21:51:18 +0000 (14:51 -0700)]
systat: Eliminate write-only unit variable

Sponsored by: Netflix

2 years agosystat/iostat: Use bools for numbers and kbpt
Warner Losh [Mon, 7 Feb 2022 21:50:35 +0000 (14:50 -0700)]
systat/iostat: Use bools for numbers and kbpt

These are really bools, declare them as such.

Sponsored by: Netflix

2 years agolinuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.
John Baldwin [Mon, 7 Feb 2022 21:43:22 +0000 (13:43 -0800)]
linuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.

Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D34145

2 years agokern_ntptime.c: Remove ntp_init()
Sebastian Huber [Mon, 7 Feb 2022 21:16:16 +0000 (14:16 -0700)]
kern_ntptime.c: Remove ntp_init()

The ntp_init() function did set a couple of global objects to zero.  These
objects are in the .bss section and already initialized to zero during kernel
or module loading.

2 years agocfiscsi_done: Free the dummy PDU earlier.
John Baldwin [Mon, 7 Feb 2022 20:55:08 +0000 (12:55 -0800)]
cfiscsi_done: Free the dummy PDU earlier.

The dummy PDU needs to be freed before marking task abortion complete
as otherwise cfiscsi_session_terminate_tasks can return and destroy
the session in another thread before the PDU is freed.

Fixes: 2e8d1a55258d iscsi: Allocate a dummy PDU for the internal nexus reset task.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34176

2 years agoStop adding -Wredundant-decls to CWARNFLAGS.
John Baldwin [Mon, 7 Feb 2022 20:47:51 +0000 (12:47 -0800)]
Stop adding -Wredundant-decls to CWARNFLAGS.

clang doesn't implement it, and Linux doesn't enforce it.  As a
result, new instances keep cropping up both in FreeBSD's code and in
upstream sources from vendors.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34144

2 years agorelease: Don't install ubldr.bin
Warner Losh [Mon, 7 Feb 2022 20:16:15 +0000 (13:16 -0700)]
release: Don't install ubldr.bin

ubldr.bin was obsoleted by our uboot ports last year, so this is
completely unused in the default config (some customers still use
it, but that's not relevant to this script). Don't copy it at all
since it won't be used for re@ produced images.

Sponsored by: Netflix
Reviewed by: kevans, gjb (re@)
Differential Revision: https://reviews.freebsd.org/D34192

2 years agonanobsd: Stop copying ubldr
Warner Losh [Mon, 7 Feb 2022 20:15:03 +0000 (13:15 -0700)]
nanobsd: Stop copying ubldr

manu@ removed support for loading ubldr* from uboot last year. No need
to copy them to the image. This may be needed for some 32-bit platforms
in theory, but those platforms weren't ever the target for nanobsd that
I'm aware of. Should there be platforms where this is used, we can add
it to building those platforms.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34191

2 years agostand/uboot: Fix building of ubldr.bin
Warner Losh [Mon, 7 Feb 2022 20:14:48 +0000 (13:14 -0700)]
stand/uboot: Fix building of ubldr.bin

Sponsored by: Netflix
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D34189

2 years agoTrim duplicate code for copying in iovecs for PT_[GS]ETREGSET.
John Baldwin [Mon, 7 Feb 2022 19:49:29 +0000 (11:49 -0800)]
Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.

Reviewed by: andrew, emaste
Differential Revision: https://reviews.freebsd.org/D34177

2 years agopbuf_ctor(): lock the buffer with LK_NOWAIT
Robert Wing [Mon, 7 Feb 2022 19:05:20 +0000 (10:05 -0900)]
pbuf_ctor(): lock the buffer with LK_NOWAIT

This LOR happens when reading from a file backed MD device:

lock order reversal:
 1st 0xfffffe00431eaac0 pbufwait (pbufwait, lockmgr) @ /cobra/src/sys/vm/vm_pager.c:471
 2nd 0xfffff80003f17930 ufs (ufs, lockmgr) @ /cobra/src/sys/dev/md/md.c:977
lock order pbufwait -> ufs attempted at:
    #0 0xffffffff80c78ead at witness_checkorder+0xbdd
    #1 0xffffffff80bd6a52 at lockmgr_lock_flags+0x182
    #2 0xffffffff80f52d5c at ffs_lock+0x6c
    #3 0xffffffff80d0f3f4 at _vn_lock+0x54
    #4 0xffffffff80708629 at mdstart_vnode+0x499
    #5 0xffffffff807060ec at md_kthread+0x20c
    #6 0xffffffff80bbfcd0 at fork_exit+0x80
    #7 0xffffffff810b809e at fork_trampoline+0xe

This LOR was previously blessed by witness before commit 531f8cfea06b
("Use dedicated lock name for pbufs").

Instead of blessing ufs and pbufwait, use LK_NOWAIT to prevent recording
the lock order. LK_NOWAIT will be a nop here as the lock is dropped in
pbuf_dtor(). The takes the same approach as 5875b94c7493 ("buf_alloc():
lock the buffer with LK_NOWAIT").

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34183

2 years agousb(4): Belatedly add a PCI device ID for AMD Bolton chipset
Jung-uk Kim [Mon, 7 Feb 2022 18:43:37 +0000 (13:43 -0500)]
usb(4): Belatedly add a PCI device ID for AMD Bolton chipset

2 years agoApply fix for ThreadSanitizer false positive data race reports
Dimitry Andric [Mon, 7 Feb 2022 18:39:02 +0000 (19:39 +0100)]
Apply fix for ThreadSanitizer false positive data race reports

Merge commit 28fb22c90fe7 from llvm git (by Dimitry Andric):

  [TSan] Handle FreeBSD specific indirection of libpthread functions

  Similar to 60cc1d3218fc for NetBSD, add aliases and interceptors for the
  following pthread related functions:

  - pthread_cond_init(3)
  - pthread_cond_destroy(3)
  - pthread_cond_signal(3)
  - pthread_cond_broadcast(3)
  - pthread_cond_wait(3)
  - pthread_mutex_init(3)
  - pthread_mutex_destroy(3)
  - pthread_mutex_lock(3)
  - pthread_mutex_trylock(3)
  - pthread_mutex_unlock(3)
  - pthread_rwlock_init(3)
  - pthread_rwlock_destroy(3)
  - pthread_rwlock_rdlock(3)
  - pthread_rwlock_tryrdlock(3)
  - pthread_rwlock_wrlock(3)
  - pthread_rwlock_trywrlock(3)
  - pthread_rwlock_unlock(3)
  - pthread_once(3)
  - pthread_sigmask(3)

  In FreeBSD's libc, a number of internal aliases of the pthread functions
  are invoked, typically with an additional prefixed underscore, e.g.
  _pthread_cond_init() and so on.

  ThreadSanitizer needs to intercept these aliases too, otherwise some
  false positive reports about data races might be produced.

  Reviewed By: dvyukov

  Differential Revision: https://reviews.llvm.org/D119034

MFC after: 3 days

2 years agoStop single stepping in signal handers on arm64
Andrew Turner [Wed, 26 Jan 2022 14:25:48 +0000 (14:25 +0000)]
Stop single stepping in signal handers on arm64

We should clear the single step flag when entering a signal hander and
set it when returning. This fixes the ptrace__PT_STEP_with_signal test.

While here add support for userspace to set the single step bit as on
x86. This can be used by userspace for self tracing.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34170

2 years agostrftime.3: Fix a typo and use St for standards
Mateusz Piotrowski [Mon, 7 Feb 2022 14:14:47 +0000 (15:14 +0100)]
strftime.3: Fix a typo and use St for standards

MFC after: 1 week

2 years agotcp: Apply tcp flags after ECN processing in rack_fast_output()
Richard Scheffenegger [Mon, 7 Feb 2022 02:27:38 +0000 (03:27 +0100)]
tcp: Apply tcp flags after ECN processing in rack_fast_output()

Missed to move the tcp_set_flags() past ECN processing
in rack_fast_output() earlier.

Reviewed By: rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34180

2 years agoFix the signal code on 32-bit breakpoints on arm64
Andrew Turner [Mon, 7 Feb 2022 11:47:04 +0000 (11:47 +0000)]
Fix the signal code on 32-bit breakpoints on arm64

When debugging 32-bit programs a debugger may insert a instruction that
will raise the undefined instruction trap. The kernel handles these
by raising a SIGTRAP, however the code was incorrect.

Fix this by using the expected TRAP_BRKPT signal code.

Sponsored by: The FreeBSD Foundation

2 years agotcp: Add hystart++ to our cubic implementation.
Randall Stewart [Mon, 7 Feb 2022 11:37:46 +0000 (06:37 -0500)]
tcp: Add hystart++ to our cubic implementation.

As promised to the transport call on 11/4/22 here is an implementation
of hystart++ for cubic. It also cleans up the tcp_congestion function
to have a better name. Common variables are moved into the general
cc.h structure so that both cubic and newreno can use them for
hystart++

Reviewed by: Michael Tuexen, Richard Scheffenegger
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D33035

2 years agoxen: remove public headers in sys/xen/interface
Roger Pau Monné [Fri, 4 Feb 2022 15:28:39 +0000 (16:28 +0100)]
xen: remove public headers in sys/xen/interface

Those are superseded by the ones in sys/contrib/xen and no longer
used.

Sponsored by: Citrix Systems R&D

2 years agoxen: switch to use headers in contrib
Elliott Mitchell [Wed, 13 Oct 2021 02:00:26 +0000 (19:00 -0700)]
xen: switch to use headers in contrib

These headers originate with the Xen project and shouldn't be mixed with
the main portion of the FreeBSD kernel. Notably they shouldn't be the
target of clean-up commits.

Switch to use the headers in sys/contrib/xen.

Reviewed by: royger

2 years agoxen: import Xen 4.16 public headers in sys/contrib/
Roger Pau Monné [Fri, 4 Feb 2022 15:16:49 +0000 (16:16 +0100)]
xen: import Xen 4.16 public headers in sys/contrib/

The current path of the Xen headers at /sys/xen/interface/ is not
correct, as those headers are imported verbatim from the Xen sources
and shouldn't be modified, as any modifications would be lost when a
new version is imported.

Changes to the public headers must be first done in Xen upstream so
that they can be backported and new imports will already carry them.

Import Xen 4.16 headers in sys/contrib/xen/. It's unlikely that we
will import different Xen code, so don't place them inside of any
subdirectory. If in the future other pieces of Xen code need to be
imported the headers will need to move into an include/ subdirectory.

Note that this commit does not yet modify the include path to use the
newly imported headers.

Sponsored by: Citrix Systems R&D

2 years agoxen: remove leftover bits missed in commit ac3ede5371
Elliott Mitchell [Thu, 18 Mar 2021 02:09:01 +0000 (19:09 -0700)]
xen: remove leftover bits missed in commit ac3ede5371

These fields are now unused, remove them.

Fixes: ac3ede5371af ('x86/xen: remove PVHv1 code')
Reviewed by: royger
Differential Revision: https://reviews.freebsd.org/D31206

2 years agoxen/grant-table: remove explicit linear mapping additions
Roger Pau Monné [Tue, 6 Apr 2021 11:01:01 +0000 (13:01 +0200)]
xen/grant-table: remove explicit linear mapping additions

There's no need to explicitly add linear mappings for the grant table
area, as the memory is allocated using xenmem_alloc and it should
already have a linear mapping that can be obtained using
rman_get_virtual.

While there also remove the return value of gnttab_map, since there's
no return value anymore.

Sponsored by: Citrix Systems R&D
Reviewed by: Elliott Mitchell <ehem+freebsd@m5p.com>
Differential revision: https://reviews.freebsd.org/D29602

2 years agotegra: Fix a common typo in source code comments
Gordon Bergling [Sun, 6 Feb 2022 16:31:05 +0000 (17:31 +0100)]
tegra: Fix a common typo in source code comments

- s/ajusted/adjusted/

MFC after: 3 days

2 years agokern_fflock: Fix a typo in a source code comment
Gordon Bergling [Sun, 6 Feb 2022 16:29:43 +0000 (17:29 +0100)]
kern_fflock: Fix a typo in a source code comment

- s/foward/forward/

MFC after: 3 days

2 years agokern_racct: Fix a typo in a source code comment
Gordon Bergling [Sun, 6 Feb 2022 16:28:27 +0000 (17:28 +0100)]
kern_racct: Fix a typo in a source code comment

- s/maxumum/maximum/

MFC after: 3 days

2 years agoExplicitly include semaphore.h for struct _sem in fusefs setattr test
Dimitry Andric [Sun, 6 Feb 2022 16:07:16 +0000 (17:07 +0100)]
Explicitly include semaphore.h for struct _sem in fusefs setattr test

In libc++'s __threading_support header the semaphore.h header was
implicitly included, but from version 14 onwards, this is no longer the
case, resulting in compile errors:

tests/sys/fs/fusefs/setattr.cc:740:8: error: variable has incomplete type 'sem_t' (aka '_sem')
        sem_t sem;
              ^
tests/sys/fs/fusefs/utils.hh:33:8: note: forward declaration of '_sem'
struct _sem;
       ^

MFC after: 3 days

2 years agoFix too small sscanf output buffers in kbdmap
Dimitry Andric [Sun, 6 Feb 2022 15:25:11 +0000 (16:25 +0100)]
Fix too small sscanf output buffers in kbdmap

This fixes the following warnings from clang 14:

usr.sbin/kbdmap/kbdmap.c:241:16: error: 'sscanf' may overflow; destination buffer in argument 5 has size 20, but the corresponding specifier may require size 21 [-Werror,-Wfortify-source]
                            &a, &b, buf);
                                    ^
usr.sbin/kbdmap/kbdmap.c:615:8: error: 'sscanf' may overflow; destination buffer in argument 3 has size 64, but the corresponding specifier may require size 65 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                            ^
usr.sbin/kbdmap/kbdmap.c:615:14: error: 'sscanf' may overflow; destination buffer in argument 4 has size 64, but the corresponding specifier may require size 65 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                                  ^
usr.sbin/kbdmap/kbdmap.c:615:19: error: 'sscanf' may overflow; destination buffer in argument 5 has size 256, but the corresponding specifier may require size 257 [-Werror,-Wfortify-source]
                            keym, lng, desc);
                                       ^

In each case, the buffer being sscanf'd into is one byte too small.

MFC after:  3 days

2 years agoFix too small hostname buffer in bootparamd
Dimitry Andric [Sun, 6 Feb 2022 14:25:22 +0000 (15:25 +0100)]
Fix too small hostname buffer in bootparamd

This fixes the following warning from clang 14:

usr.sbin/bootparamd/bootparamd/bootparamd.c:204:32: error: 'fscanf' may
overflow; destination buffer in argument 3 has size 255, but the
corresponding specifier may require size 256 [-Werror,-Wfortify-source]

The MAX_MACHINE_NAME macro indicates the maximum number of bytes in a
machine name, but it does not include the NUL terminator required for
scanf.

MFC after:  3 days

2 years agofs: fix a few common typos in source code comments
Gordon Bergling [Sun, 6 Feb 2022 12:48:31 +0000 (13:48 +0100)]
fs: fix a few common typos in source code comments

- s/quadradically/quadratically/
- s/persistant/persistent/

Obtained from: NetBSD
MFC after: 3 days

2 years agomoused(8): Fix a common typo in source code comments
Gordon Bergling [Sun, 6 Feb 2022 12:47:25 +0000 (13:47 +0100)]
moused(8): Fix a common typo in source code comments

- s/comatible/compatible/

Obtained from: NetBSD
MFC after: 3 days

2 years agomakefs(8): Fix a few typos in source code comments
Gordon Bergling [Sun, 6 Feb 2022 12:46:38 +0000 (13:46 +0100)]
makefs(8): Fix a few typos in source code comments

- s/concearned/concerned/
- s/quadradically/quadratically/

Obtained from: NetBSD
MFC after: 3 days

2 years agocam(4): Fix a few typos in source code comments
Gordon Bergling [Sun, 6 Feb 2022 12:45:47 +0000 (13:45 +0100)]
cam(4): Fix a few typos in source code comments

- s/trafer/transfer/
- s/failes/fails/

Obtained from: NetBSD
MFC after: 3 days

2 years agoxen(4): Fix a common typo in a source code comments
Gordon Bergling [Sun, 6 Feb 2022 12:44:49 +0000 (13:44 +0100)]
xen(4): Fix a common typo in a source code comments

- s/existance/existence/

MFC after: 3 days

2 years agoipsec(4): Fix a few typos in error messages
Gordon Bergling [Sun, 6 Feb 2022 12:43:42 +0000 (13:43 +0100)]
ipsec(4): Fix a few typos in error messages

- s/receieve/receive/

MFC after: 1 week

2 years agoif_vxlan(4): Allow netmap_generic to intercept RX packets.
Aleksandr Fedorov [Sun, 6 Feb 2022 12:27:46 +0000 (15:27 +0300)]
if_vxlan(4): Allow netmap_generic to intercept RX packets.

Netmap (generic) intercepts the if_input method to handle RX packets.

Call ifp->if_input() instead of netisr_dispatch().
Add stricter check for incoming packet length.

This change is very useful with bhyve + vale + if_vxlan.

Reviewed by: vmaffione (mentor), kib, np, donner
Approved by: vmaffione (mentor), kib, np, donner
MFC after: 2 weeks
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D30638

2 years agoAdd new USB host controller PCI ID's.
Hans Petter Selasky [Sun, 6 Feb 2022 12:14:27 +0000 (13:14 +0100)]
Add new USB host controller PCI ID's.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agodma: use canonical getline() loop
Ed Maste [Thu, 3 Feb 2022 18:51:06 +0000 (13:51 -0500)]
dma: use canonical getline() loop

getline() returns -1 on erorr or EOF, so use that condition instead of
feof() and check that there was no error after the loop exits.

Reviewed by: bapt, kevans (both earlier)
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34159

2 years agoffs_read(): lock buffers after snaplk with LK_NOWITNESS
Konstantin Belousov [Sat, 5 Feb 2022 02:03:47 +0000 (04:03 +0200)]
ffs_read(): lock buffers after snaplk with LK_NOWITNESS

Reviewed and tested by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34179

2 years agovendor/bc: import release 5.2.2
Stefan Eßer [Sat, 5 Feb 2022 21:26:36 +0000 (22:26 +0100)]
vendor/bc: import release 5.2.2

This release assigns a default value to the internal program name
variable in case the program is invoked with argv[0] == NULL.

There was no security issue: the prevuous program version would have
been immediately terminated due to a NULL dereference.

2 years agodmesg: detect wrapped msgbuf on the kernel side and if so, skip first line
Gleb Smirnoff [Sat, 5 Feb 2022 21:25:38 +0000 (13:25 -0800)]
dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line

Since 59f256ec35d3 dmesg(8) will always skip first line of the message
buffer, cause it might be incomplete.  The problem is that in most cases
it is complete, valid and contains the "---<<BOOT>>---" marker.  This
skip can be disabled with '-a', but that would also unhide all non-kernel
messages.  Move this functionality from dmesg(8) to kernel, since kernel
actually knows if wrap has happened or not.

The main motivation for the change is not actually the value of the
"---<<BOOT>>---" marker.  The problem breaks unit tests, that clear
message buffer, perform a test and then check the message buffer for
a result.  Example of such test is sys/kern/sonewconn_overflow.

2 years agoUpdate to bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:29:10 +0000 (12:29 -0800)]
Update to bmake-20220204

2 years agoMerge bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:26:16 +0000 (12:26 -0800)]
Merge bmake-20220204

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 20:04:00 +0000 (20:04 +0000)]
update external URL

2 years agoImport bmake-20220204
Simon J. Gerraty [Sat, 5 Feb 2022 20:03:50 +0000 (12:03 -0800)]
Import bmake-20220204

Features of interest:

Allow setting target local variables (similar to gmake)

In META_MODE .MAKE.META.CMP_FILTER can be used for filtering commands
before comparion.

contrib/bmake/mk/cc-wrap.mk is an example of using these

See ChangeLog for the gory details.

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:54:59 +0000 (19:54 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:49:46 +0000 (19:49 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:43:03 +0000 (19:43 +0000)]
update external URL

2 years agoremove defunct Sundance URL
Wolfram Schneider [Sat, 5 Feb 2022 19:41:28 +0000 (19:41 +0000)]
remove defunct Sundance URL

2 years agoremove defunct Ralink Technology URL
Wolfram Schneider [Sat, 5 Feb 2022 19:39:18 +0000 (19:39 +0000)]
remove defunct Ralink Technology URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:23:51 +0000 (19:23 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:19:43 +0000 (19:19 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 19:17:33 +0000 (19:17 +0000)]
update external URL

2 years agoremove defunct National Semiconductor URL
Wolfram Schneider [Sat, 5 Feb 2022 18:44:52 +0000 (18:44 +0000)]
remove defunct National Semiconductor URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 18:32:38 +0000 (18:32 +0000)]
update external URL

2 years agoupdate URL
Wolfram Schneider [Sat, 5 Feb 2022 18:30:06 +0000 (18:30 +0000)]
update URL

2 years agoupdate URL
Wolfram Schneider [Sat, 5 Feb 2022 17:35:24 +0000 (17:35 +0000)]
update URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:14:27 +0000 (17:14 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:11:18 +0000 (17:11 +0000)]
update external URL

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 17:09:48 +0000 (17:09 +0000)]
update external URL

2 years agotcp: use TCPSTAT_INC in kernel ecn functions
Richard Scheffenegger [Sat, 5 Feb 2022 15:50:21 +0000 (16:50 +0100)]
tcp: use TCPSTAT_INC in kernel ecn functions

Incorrectly used KMOD_ marco in static kernel ECN functions.

Both eventually resolve to counter_s64_add(), but better
use the correct macros.

Reviewed By: tuexen, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34181

2 years agoif_vtnet(4): Restore the ability to set promisc mode.
Aleksandr Fedorov [Sat, 5 Feb 2022 15:47:46 +0000 (18:47 +0300)]
if_vtnet(4): Restore the ability to set promisc mode.

PR: 254343, 255054
Reviewed by: vmaffione (mentor), donner
Approved by: vmaffione (mentor), donner
MFC after: 2 weeks
Sponsored by: vstack.com
Differential Revision: https://reviews.freebsd.org/D30639

2 years agotcp: move ECN handling code to a common file
Richard Scheffenegger [Sat, 5 Feb 2022 13:59:00 +0000 (14:59 +0100)]
tcp: move ECN handling code to a common file

Reduce the burden to maintain correct and
extensible ECN related code across multiple
stacks and codepaths.

Formally no functional change.

Incidentially this establishes correct
ECN operation in one instance.

Reviewed By: rrs, #transport
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34162

2 years agolibc: add helper furnction to set sysctl() user.* variables
Stefan Eßer [Sat, 5 Feb 2022 12:33:53 +0000 (13:33 +0100)]
libc: add helper furnction to set sysctl() user.* variables

Testing had revealed that trying to retrieve the user.localbase
variable into to small a buffer would return the correct error code,
but would not fill the available buffer space with a partial result.

A partial result is of no use, but this is still a violation of the
documented behavior, which has been fixed in the previous commit to
this function.

I just checked the code for "user.cs_path" and found that it had the
same issue.

Instead of fixing the logic for each user.* sysctl string variable
individually, this commit adds a helper function set_user_str() that
implements the semantics specified in the sysctl() man page.

It is currently only used for "user.cs_path" and "user.localbase",
but it will offer a significant simplification when further such
variables will be added (as I intend to do).

MFC after: 3 days

2 years agopf tests: Only do post-test logging when specifically enabled
Kristof Provost [Tue, 1 Feb 2022 17:33:42 +0000 (18:33 +0100)]
pf tests: Only do post-test logging when specifically enabled

The pf tests have the ability to log state information (pf rules, pf
states, interfaces, ...) on exit (i.e. on success or on error).
This is useful, but only in specific cases. When it's not needed it may
get in the way of clear output.

Test scripts can add 'debug' to the pft_init call to enable this for the
specified test.

Reviewed by: brd
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34133

2 years agopf tests: Test adding counters to an existing table
Kristof Provost [Tue, 1 Feb 2022 17:27:40 +0000 (18:27 +0100)]
pf tests: Test adding counters to an existing table

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34132

2 years agopf: deal with tables gaining or losing counters
Kristof Provost [Tue, 1 Feb 2022 17:25:57 +0000 (18:25 +0100)]
pf: deal with tables gaining or losing counters

When we create a table without counters, add an entry  and later
re-define the table to have counters we wound up trying to read
non-existent counters.

We now cope with this by attempting to add them if needed, removing them
when they're no longer needed and not trying to read from counters that
are not present.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34131

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 09:13:07 +0000 (09:13 +0000)]
update external URL

2 years agofix URL typo
Wolfram Schneider [Sat, 5 Feb 2022 09:08:45 +0000 (09:08 +0000)]
fix URL typo

2 years agoupdate external URL
Wolfram Schneider [Sat, 5 Feb 2022 09:00:35 +0000 (09:00 +0000)]
update external URL