freebsd.git
2 years agoGitHub: Add libefivar's path to CODEOWNERS
Jose Luis Duran [Thu, 24 Feb 2022 17:31:44 +0000 (14:31 -0300)]
GitHub: Add libefivar's path to CODEOWNERS

Code owners are automatically requested for review when someone opens a
pull request that modifies code that they own.

https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

Pull Request: https://github.com/freebsd/freebsd-src/pull/581

2 years agoofwdump.8: Remove references to eeprom(8)
Jose Luis Duran [Sat, 26 Feb 2022 17:58:46 +0000 (14:58 -0300)]
ofwdump.8: Remove references to eeprom(8)

Somehow missed in bc4fc770af61

Pull Request: https://github.com/freebsd/freebsd-src/pull/582

2 years agoEliminate curlen, it's set but never used
Warner Losh [Thu, 24 Feb 2022 23:32:42 +0000 (16:32 -0700)]
Eliminate curlen, it's set but never used

Sponsored by: Netflix

2 years agoApply lld fixes for internal errors building perl on 32-bit PowerPC
Dimitry Andric [Sun, 27 Feb 2022 12:53:19 +0000 (13:53 +0100)]
Apply lld fixes for internal errors building perl on 32-bit PowerPC

Merge commit f457863ae345 from llvm git (by Fangrui Song):

  [ELF] Support REL-format R_AARCH64_NONE relocation

  -fprofile-use=/-fprofile-sample-use= compiles may produce REL-format
  .rel.llvm.call-graph-profile even if the prevailing format is RELA on AArch64.
  Add R_AARCH64_NONE to getImplicitAddend to fix this linker error:

  ```
  ld.lld: error: internal linker error: cannot read addend for relocation R_AARCH64_NONE
  PLEASE submit a bug report to https://crbug.com and run tools/clang/scripts/process_crashreports.py (only works inside Google) which will upload a report and include the crash backtrace.
  ```

Merge commit 53fc5d9b9a01 from llvm git (by Fangrui Song):

  [ELF] Support R_PPC_NONE/R_PPC64_NONE in getImplicitAddend

  Similar to f457863ae345d2635026501f5383e0e625869639

Merge commit 767e64fc11d7 from llvm git (by Fangrui Song):

  [ELF] Support some absolute/PC-relative relocation types for REL format

  ctfconvert seems to use REL-format `.rel.SUNW_dof` for 32-bit architectures.
  ```
  Binary file usr/ports/lang/perl5.32/work/perl-5.32.1/dtrace_mini.o matches
  [alfredo.junior@dell-a ~/tmp/llvm-bug]$ readelf -r dtrace_mini.o

  Relocation section (.rel.SUNW_dof):
  r_offset r_info   r_type              st_value st_name
  00000184 0000281a R_PPC_REL32         00000000 $dtrace1772974259.Perl_dtrace_probe_load
  ```

  Support R_PPC_REL32 to fix `ld.lld: error: drti.c:(.SUNW_dof+0x4E4): internal linker error: cannot read addend for relocation R_PPC_REL32`.
  While here, add some common relocation types for AArch64, PPC, and PPC64.
  We perform minimum tests.

  Reviewed By: adalava, arichardson

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

Requested by: alfredo
MFC after: 3 days

2 years agoposixshm: Add a -j option to posixshmcontrol ls, to specify a jail
Jamie Gritton [Sun, 27 Feb 2022 01:45:28 +0000 (17:45 -0800)]
posixshm: Add a -j option to posixshmcontrol ls, to specify a jail
PR: 257556
Reported by: grembo@

2 years agoDefault to always accepting the PHY that's present. Linux did
Scott Long [Sun, 27 Feb 2022 01:29:08 +0000 (18:29 -0700)]
Default to always accepting the PHY that's present.  Linux did
something similar a while back, and there are devices in the wild
that otherwise won't attach.  This patch is temporary until the
PHY code is further cleared up.

Obtained from: grehan

2 years agoFix "set but not used" in the mrsas driver. Remove dead code.
Scott Long [Sat, 26 Feb 2022 19:21:11 +0000 (12:21 -0700)]
Fix "set but not used" in the mrsas driver.  Remove dead code.

2 years agoFix "set but not used" in the mvs driver. Remove dead code.
Scott Long [Sat, 26 Feb 2022 19:18:42 +0000 (12:18 -0700)]
Fix "set but not used" in the mvs driver.  Remove dead code.

2 years agoFix "set but not used" in the bfe driver. Remove dead code.
Scott Long [Sat, 26 Feb 2022 19:14:22 +0000 (12:14 -0700)]
Fix "set but not used" in the bfe driver.  Remove dead code.

2 years agoFix "set but not used" in the siis driver.
Scott Long [Sat, 26 Feb 2022 18:46:53 +0000 (11:46 -0700)]
Fix "set but not used" in the siis driver.

2 years agoThe TWE driver should have been marked with gone_in for FreeBSD 13.x,
Scott Long [Sat, 26 Feb 2022 18:40:17 +0000 (11:40 -0700)]
The TWE driver should have been marked with gone_in for FreeBSD 13.x,
but was missed.  Mark it for gone_in 14.0.  The hardware hasn't been
produced or supported in over 20 years, and even back then it was
known to be electrically unreliable and prone to catastrophic failure.

2 years agoFix "set but not used" in twe.
Scott Long [Sat, 26 Feb 2022 18:16:31 +0000 (11:16 -0700)]
Fix "set but not used" in twe.

2 years agoFix "set but not used" for real in the ciss driver.
Scott Long [Sat, 26 Feb 2022 18:07:05 +0000 (11:07 -0700)]
Fix "set but not used" for real in the ciss driver.

2 years agoExpand __diagused to include the KTR kernel diagnostic option.
Scott Long [Sat, 26 Feb 2022 18:01:54 +0000 (11:01 -0700)]
Expand __diagused to include the KTR kernel diagnostic option.

2 years agoFix "set but not used" in the ips driver. Dead code.
Scott Long [Sat, 26 Feb 2022 17:35:51 +0000 (10:35 -0700)]
Fix "set but not used" in the ips driver.  Dead code.

2 years agoFix "set but not used" in aic7xxx/aic79xx. The variables were dead
Scott Long [Sat, 26 Feb 2022 17:33:31 +0000 (10:33 -0700)]
Fix "set but not used" in aic7xxx/aic79xx.  The variables were dead
code.

2 years agoFix "set but not used" in smartpqi. The PCI_MEM macros don't require a
Scott Long [Sat, 26 Feb 2022 17:25:43 +0000 (10:25 -0700)]
Fix "set but not used" in smartpqi.  The PCI_MEM macros don't require a
physical/absolute address in FreeBSD, but it looks like the calling
code might be somewhat portable to other OS's that do require this.
Therefore, set the variables to __unused instead of removing the code
entirely.

2 years agoiscsi: retrieve global login timeout from sysctlbyname() as integer
Richard Scheffenegger [Fri, 25 Feb 2022 19:56:31 +0000 (20:56 +0100)]
iscsi: retrieve global login timeout from sysctlbyname() as integer

The OID "kern.iscsi.login_timeout" references an integer and
not a string.

Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34380

2 years agotcp: Restore correct ECT marking behavior on SACK retransmissions
Richard Scheffenegger [Fri, 25 Feb 2022 19:05:15 +0000 (20:05 +0100)]
tcp: Restore correct ECT marking behavior on SACK retransmissions

While coalescing all ECN-related code into new common source files,
the flag to deal with SACK retransmissions was skipped. This leads
to non-compliant ECT-marking of SACK retransmissions, as well as
the premature sending of other TCP ECN flags (CWR).

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

2 years agormlock: Micro-optimize read locking
Mark Johnston [Fri, 25 Feb 2022 18:42:51 +0000 (13:42 -0500)]
rmlock: Micro-optimize read locking

Use get_pcpu() instead of an open-coded pcpu_find(td->td_oncpu).  This
eliminates some memory accesses and results in a shorter instruction
sequence.  Note that get_pcpu() didn't exist when rmlocks were added.

Reviewed by: jah, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34377

2 years agovfs_unregister: fix error handling
Marvin Ma [Fri, 25 Feb 2022 15:34:33 +0000 (09:34 -0600)]
vfs_unregister: fix error handling

Due to misplaced braces, an error from vfs_uninit() in the VFCF_SBDRY
case was ignored.

Reported by: Anton Rang <rang@acm.org>
Reviewed by: Anton Rang <rang@acm.org>, markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34375

2 years agoCTL: Rework 05c3e8e87142 using %zu format.
Alexander Motin [Fri, 25 Feb 2022 16:52:17 +0000 (11:52 -0500)]
CTL: Rework 05c3e8e87142 using %zu format.

MFC after: 2 days

2 years agoFix mdoc issues found by mandoc -Tlint.
Christian Brueffer [Fri, 25 Feb 2022 16:39:09 +0000 (17:39 +0100)]
Fix mdoc issues found by mandoc -Tlint.

2 years agomdoc style: new sentence, new line.
Christian Brueffer [Fri, 25 Feb 2022 13:19:12 +0000 (14:19 +0100)]
mdoc style: new sentence, new line.

2 years agortld.1: Fix misplaced text
John F. Carr [Fri, 25 Feb 2022 16:09:03 +0000 (11:09 -0500)]
rtld.1: Fix misplaced text

PR: 262194
Fixes: f90218886fc8 ("rtld: introduce PRELOAD_FDS")
MFC after: 3 days

2 years agogzip: fix error handling in unxz
Eric van Gyzen [Thu, 24 Feb 2022 23:00:52 +0000 (17:00 -0600)]
gzip: fix error handling in unxz

The result of fstat() was not checked.  Furthermore, there was a
redundant check of st.st_size.  Fix both.

Reported by:    Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agoefivar: handle error when reading --fromfile
Eric van Gyzen [Wed, 23 Feb 2022 18:15:34 +0000 (12:15 -0600)]
efivar: handle error when reading --fromfile

The result of read() was stored in an unsigned variable, so the
test for a negative value would never work.

While I'm here, print a better error message for an empty file,
omitting the misleading errno message.

Reported by: Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agortsold: fix memory leak in script execution
Eric van Gyzen [Wed, 23 Feb 2022 16:49:12 +0000 (10:49 -0600)]
rtsold: fix memory leak in script execution

Since commit 04e9edb54428, rtsold has leaked the memory for the
argument vector of every script it runs.

Reported by: Coverity
Reviewed by: markj
Fixes: 04e9edb5442826a14616157962361ff81e4a38fe
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34355

2 years agortsold: Use correct error in llflags_get()
Eric van Gyzen [Wed, 23 Feb 2022 16:29:53 +0000 (10:29 -0600)]
rtsold: Use correct error in llflags_get()

Set errno to EINVAL if the name overflows the buffer, as was done
before commit ecce515d54bc.

Reviewed by: dab, markj
Fixes: ecce515d54bcea54fea03f731aad646c87761d22
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34354

2 years agonfscl: Fix a use after free in nfscl_cleanupkext()
Rick Macklem [Fri, 25 Feb 2022 15:27:03 +0000 (07:27 -0800)]
nfscl: Fix a use after free in nfscl_cleanupkext()

ler@, markj@ reported a use after free in nfscl_cleanupkext().
They also provided two possible causes:
- In nfscl_cleanup_common(), "own" is the owner string
  owp->nfsow_owner.  If we free that particular
  owner structure, than in subsequent comparisons
  "own" will point to freed memory.
- nfscl_cleanup_common() can free more than one owner, so the use
  of LIST_FOREACH_SAFE() in nfscl_cleanupkext() is not sufficient.

I also believe there is a 3rd:
- If nfscl_freeopenowner() or nfscl_freelockowner() is called
  without the NFSCLSTATE mutex held, this could race with
  nfscl_cleanupkext().
  This could happen when the exclusive lock is held
  on the client, such as when delegations are being returned
  or when recovering from NFSERR_EXPIRED.

This patch fixes them as follows:
1 - Copy the owner string to a local variable before the
    nfscl_cleanup_common() call.
2 - Modify nfscl_cleanup_common() so that it will never free more
    than the first matching element.  Normally there should only
    be one element in each list with a matching open/lock owner
    anyhow (but there might be a bug that results in a duplicate).
    This should guarantee that the FOREACH_SAFE loops in
    nfscl_cleanupkext() are adequate.
3 - Acquire the NFSCLSTATE mutex in nfscl_freeopenowner()
    and nfscl_freelockowner(), if it is not already held.
    This serializes all of these calls with the ones done in
    nfscl_cleanup_common().

Reported by: ler
Reviewed by: markj
Tested by: cy
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34334

2 years agomdoc style: whitespace fixes.
Christian Brueffer [Fri, 25 Feb 2022 13:22:23 +0000 (14:22 +0100)]
mdoc style: whitespace fixes.

2 years agoiscsi: per-session timeouts and rapid teardown of session on reconnect
Richard Scheffenegger [Fri, 25 Feb 2022 09:33:59 +0000 (10:33 +0100)]
iscsi: per-session timeouts and rapid teardown of session on reconnect

Add per-Session configurable ping (SCSI NOP) and login timeouts.

Remove the torn down, old iSCSI session quickly, when performing a reconnect.

Reviewed By: trasz
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34198

2 years agoFix 32-bit build after 530d274c15e5.
Alexander Motin [Thu, 24 Feb 2022 23:10:47 +0000 (18:10 -0500)]
Fix 32-bit build after 530d274c15e5.

MFC after: 3 days

2 years agosendfile_test: fix copy-paste bug
Eric van Gyzen [Thu, 24 Feb 2022 22:53:03 +0000 (16:53 -0600)]
sendfile_test: fix copy-paste bug

Require the newly opened file descriptor to be good, instead of
re-requiring the one that was required three lines earlier.
Thankfully, opening /dev/null is really unlikely to fail.

Reported by: Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

2 years agoiwlwifi: update firmware
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:40:20 +0000 (21:40 +0000)]
iwlwifi: update firmware

Update to the latest firmware based on
linux-firmware at c53073d4e1485ac9f7cb065db466793c495aead7
and update firmware module Makefiles accordingly.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: enhance debug information
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:38:27 +0000 (21:38 +0000)]
iwlwifi: enhance debug information

Add a string of the debug type to the output of the debug message so it
is easier to search for specific events in a trace with lots of debugging
on.  While here remove superflous ().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: update from iwlwifi-next
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:34:13 +0000 (21:34 +0000)]
iwlwifi: update from iwlwifi-next

Import new code from iwlwifi-next at cb0a1fb7fd86b0062692b5056ca8552906509512
(matching tag: iwlwifi-next-for-kalle-2022-02-18).

Also add files not previously imported because we are not yet compiling
them to ease updating and having them when needed.

This adds MEI (Management Engine) support upstream which we cannot import
(currently GPL-only) so we have stub functions for the missing bits.

This also reduces the diff to upstream.  Changes submitted to avoid
problems with const and  with void * arithmetics were merged.

In the module build Makefile disable CONFIG_IWLWIFI_OPMODE_MODULAR
as we are building iwlwifi as a single module.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days

2 years agoCTL: Add length validation for incoming HA messages.
Alexander Motin [Thu, 24 Feb 2022 21:17:34 +0000 (16:17 -0500)]
CTL: Add length validation for incoming HA messages.

This should fix uninitialized memory reads when working with broken
HA peer, like one fixed in 1a8d8a3a909.  Instead print error message
and kill the HA link.

MFC after: 3 days
Sponsored by: iXsystems, Inc.

2 years agofusefs: fix a cached attributes bug during directory rename
Alan Somers [Tue, 22 Feb 2022 05:00:42 +0000 (22:00 -0700)]
fusefs: fix a cached attributes bug during directory rename

When renaming a directory into a different parent directory, invalidate
the cached attributes of the new parent.  Otherwise, stat will show the
wrong st_nlink value.

MFC after: 1 week
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D34336

2 years agodtc: more mandoc -T lint fixes
Warner Losh [Thu, 24 Feb 2022 20:53:17 +0000 (13:53 -0700)]
dtc: more mandoc -T lint fixes

Obtained from: dtc repo 04c805a8b08e4a1d4ff1f1e62ef475fbfe1a5fbe
Sponsored by: Netflix

2 years agoLinuxKPI: add MODULE_IMPORT_NS()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:45:50 +0000 (22:45 +0000)]
LinuxKPI: add MODULE_IMPORT_NS()

Add dummy MODULE_IMPORT_NS() used by an updated iwlwifi.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34349

2 years agoLinuxKPI: change DECLARE_FLEX_ARRAY()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:48:08 +0000 (22:48 +0000)]
LinuxKPI: change DECLARE_FLEX_ARRAY()

DECLARE_FLEX_ARRAY can be used inside a structure.  On FreeBSD due to
-Wgnu-variable-sized-type-not-at-end this yields an error.  Use [0]
instead of [] to overcome this.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34350

2 years agoLinuxKPI: USB change successful probe result to BUS_PROBE_DEFAULT
Bjoern A. Zeeb [Fri, 18 Feb 2022 22:16:57 +0000 (22:16 +0000)]
LinuxKPI: USB change successful probe result to BUS_PROBE_DEFAULT

Rather than returning 0 (which is BUS_PROBE_SPECIFIC) return
BUS_PROBE_DEFAULT to give other drivers a possible chance too
to attach.

Reported by: jhb
Reviewed by: hselasky, jhb, imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34317

2 years agocons: Use bool for boolean variables
Warner Losh [Thu, 24 Feb 2022 17:57:03 +0000 (10:57 -0700)]
cons: Use bool for boolean variables

MFC After: 3 days
Sponsored by: Netflix

2 years agobhyve: plug memory leak in topology_parse()
Andy Fiddaman [Thu, 24 Feb 2022 17:36:41 +0000 (08:36 -0900)]
bhyve: plug memory leak in topology_parse()

Reviewed by:    jhb, rew
Differential Revision:  https://reviews.freebsd.org/D34301

2 years agoposixshm: Allow jails to use kern.ipc.posix_shm_list
Jamie Gritton [Thu, 24 Feb 2022 17:30:49 +0000 (09:30 -0800)]
posixshm: Allow jails to use kern.ipc.posix_shm_list
PR: 257554
Reported by: grembo@

2 years agoRevert "nfscl: Fix a use after free in nfscl_cleanupkext()"
Rick Macklem [Thu, 24 Feb 2022 15:01:03 +0000 (07:01 -0800)]
Revert "nfscl: Fix a use after free in nfscl_cleanupkext()"

This reverts commit dd08b84e35b6fdee0df5fd0e0533cd361dec71cb.

cy@ reported a problem caused by this patch.  He will be
testing an alternate patch, but I'm reverting this one.

2 years agousb(4): Automagically apply all quirks for USB mass storage devices.
Hans Petter Selasky [Mon, 21 Feb 2022 08:24:28 +0000 (09:24 +0100)]
usb(4): Automagically apply all quirks for USB mass storage devices.

Currently there are five quirks the USB stack tries to automagically detect:
- UQ_MSC_NO_PREVENT_ALLOW
- UQ_MSC_NO_SYNC_CACHE
- UQ_MSC_NO_TEST_UNIT_READY
- UQ_MSC_NO_GETMAXLUN
- UQ_MSC_NO_START_STOP

If any of the quirks above are set, no further quirks will be probed.

If any of the USB mass storage tests fail, the USB device is
re-enumerated as a last resort to clear any error states from the
device. Then the USB stack will try to probe and attach the umass<N>
device passing the detected quirks.

While at it give more details in dmesg about what is going on.

Tested by: several
Submitted by: Idwer Vollering <vidwer_fbsdbugs@gmail.com>
Differential Revision: https://reviews.freebsd.org/D30919
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoFix mdoc macro usage and style in section 4 manpages.
Christian Brueffer [Thu, 24 Feb 2022 08:39:30 +0000 (09:39 +0100)]
Fix mdoc macro usage and style in section 4 manpages.

2 years agoHandle MODULE_VERBOSE_TWIDDLE in module_verbose_set
Simon J. Gerraty [Thu, 24 Feb 2022 05:26:41 +0000 (21:26 -0800)]
Handle MODULE_VERBOSE_TWIDDLE in module_verbose_set

If module_verbose is set to a value below MODULE_VERBOSE_TWIDDLE
call twiddle_divisor(UINT_MAX).

This makes more sense here than when we are loading the kernel.

Sponsored by: Juniper Networks, Inc.

2 years agounionfs: rework unionfs_getwritemount()
Jason A. Harmening [Tue, 15 Feb 2022 03:52:21 +0000 (21:52 -0600)]
unionfs: rework unionfs_getwritemount()

VOP_GETWRITEMOUNT() is called on the vn_start_write() path without any
vnode locks guaranteed to be held.  It's therefore unsafe to blindly
access per-mount and per-vnode data.  Instead, follow the approach taken
by nullfs and use the vnode interlock coupled with the hold count to
ensure the mount and the vnode won't be recycled while they are being
accessed.

Reviewed by: kib (earlier version), markj, pho
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D34282

2 years agotest-includes: temporarily add back net/pfvar.h
Warner Losh [Thu, 24 Feb 2022 00:54:28 +0000 (17:54 -0700)]
test-includes: temporarily add back net/pfvar.h

net/pfvar.h is installed unconditionally, but depends on files that are
installed conditionally. Until that can be sorted out, temporarily add
this back to badfiles.inc to cope with MK_PF=no failing.

Sponsored by: Netflix

2 years agolibctf: Use const ctf_file_t references in string lookup routines
Mark Johnston [Wed, 23 Feb 2022 23:37:40 +0000 (18:37 -0500)]
libctf: Use const ctf_file_t references in string lookup routines

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoUpdate fsdb(8) to reflect new structure of fsck_ffs(8).
Kirk McKusick [Wed, 23 Feb 2022 23:39:52 +0000 (15:39 -0800)]
Update fsdb(8) to reflect new structure of fsck_ffs(8).

The cleanup of fsck_ffs(8) in commit c0bfa109b942659f6 broke fsdb(8).
This commit adds the one-line update needed in fsdb(8) to make it
work with the new fsck_ffs(8) structure.

Reported by: Chuck Silvers
Tested by:   Chuck Silvers
MFC after:   3 days

2 years agocam iosched: Update comment for when we schedule writes.
Warner Losh [Wed, 23 Feb 2022 23:21:27 +0000 (16:21 -0700)]
cam iosched: Update comment for when we schedule writes.

Sponsored by: Netflix

2 years agoTemporarily skip sys.geom.class.multipath.failloop.failloop in CI
Li-Wen Hsu [Wed, 23 Feb 2022 22:28:24 +0000 (06:28 +0800)]
Temporarily skip sys.geom.class.multipath.failloop.failloop in CI

This test case uses `dtrace -c` but it has some issues at the moment so
disable it until dtrace fixed.

From markj:

This is the CTF type ID limit which has come up quite a few times
lately.  It'll be fixed with the introduction of CTFv3.

PR: 258763
Sponsored by: The FreeBSD Foundation

2 years agobio: make _bio_cflags match bio_cflags
Warner Losh [Wed, 23 Feb 2022 21:28:16 +0000 (14:28 -0700)]
bio: make _bio_cflags match bio_cflags

While none of the in-tree geoms that modify the bio_cflags use the top
half of the word, were they to do this in the future, we'd hit false
positives for DIAGNOSTIC kernels. Make both uint16_t.

MFC After: 1 week
Sponsored by: Netflix

2 years agotcp: Push bit failure to set in fastpath
Randall Stewart [Wed, 23 Feb 2022 21:25:56 +0000 (16:25 -0500)]
tcp: Push bit failure to set in fastpath

Recently changes were made to the tcp stack to use a macro/function
to set tcp flags. In the process the PUSH bit setting in the fastpath of
rack was broken. This fixes that as well as cleans up a warning that
is occurring when you don't have INVARIANT on (inp used in KASSERT).

We can use the tcp test suite to find this bug the test plan shows the script
that fails due to the missing push bit

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

2 years agocp: Make -P work without -R as per POSIX
Cameron Katri [Wed, 23 Feb 2022 18:55:13 +0000 (12:55 -0600)]
cp: Make -P work without -R as per POSIX

According to POSIX, cp should allow the `-P` flag to work whether `-R`
is specified or not.  Currently, the `-P` option only works along with
`-R`.

PR: 199466
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D30012

2 years agossh: add command to push tag to FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:47:28 +0000 (13:47 -0500)]
ssh: add command to push tag to FREEBSD-upgrade instructions

Because it appears `git push --follow-tags` may push extra, undesired
tags document both techniques (pushing the specific vendor/openssh/X.YpZ
tag and pushing all with --follow-tags, using --dry-run first).

Discussed with: imp, lwhsu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33605

2 years agossh: remove 11.x from FREEBSD-upgrade instructions
Ed Maste [Wed, 23 Feb 2022 18:34:39 +0000 (13:34 -0500)]
ssh: remove 11.x from FREEBSD-upgrade instructions

11.x is no longer supported.

2 years agosendto: don't clear transient errors for atomic protocols
Gleb Smirnoff [Thu, 17 Feb 2022 17:07:31 +0000 (09:07 -0800)]
sendto: don't clear transient errors for atomic protocols

The changeset 65572cade35 uncovered the fact that top layer of sendto(2)
would clear a transient error code if some data was copied out of uio.
The clearing of the error makes sense for non-atomic protocols, since
they have sent some data.  The atomic protocols send all or nothing.

The current implementation of unix/dgram uses sosend_generic(), which
would always copyout and only then it may fail to deliver a message.
The sosend_dgram(), currently used by UDP only, also has same behavior.

Reported by: pho
Reviewed by: pho, markj
Differential revision: https://reviews.freebsd.org/D34309

2 years agobhyve nvme: Advertise Namespace changed AEN
Chuck Tuffli [Wed, 23 Feb 2022 15:18:54 +0000 (07:18 -0800)]
bhyve nvme: Advertise Namespace changed AEN

Advertise Namespace Attribute Notices events in the Optional
Asynchronous Events Supported (OAES) field of the Identify Controller
data structure. Additionally, rename the enums and macros to clarify
these are AEN's related to Notices and not generic information.

Reported by: andy@omniosce.org

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D34331

2 years agolibdtrace: Add a missing newline to an error message
Mark Johnston [Wed, 23 Feb 2022 16:31:51 +0000 (11:31 -0500)]
libdtrace: Add a missing newline to an error message

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agofbt: Remove handling for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:58:35 +0000 (09:58 -0500)]
fbt: Remove handling for CTFv1

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agolibctf: Remove checks for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:57:41 +0000 (09:57 -0500)]
libctf: Remove checks for CTFv1

Per commit 7db423d69273 ("libctf: Rip out CTFv1 support") this support
is obsolete.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agodtc.1: Mention the existence of -i flag
Jose Luis Duran [Sat, 19 Feb 2022 13:43:18 +0000 (10:43 -0300)]
dtc.1: Mention the existence of -i flag

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/570

2 years agodtc.1: Appease mandoc -T lint
Jose Luis Duran [Sat, 19 Feb 2022 13:47:31 +0000 (10:47 -0300)]
dtc.1: Appease mandoc -T lint

Prefer .Fx to bare FreeBSD

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/579

2 years agolibefivar: Correct the string expression of UTF8 vendor device path
Jose Luis Duran [Tue, 22 Feb 2022 11:39:03 +0000 (08:39 -0300)]
libefivar: Correct the string expression of UTF8 vendor device path

According to UEFI spec, the string expression of UTF8 vendor
device node should be displayed as: VenUtf8(). Current code
display it as: VenUft8() by mistake when convert device
path node to text.

This commit is to fix this bug.

Upstream Bug: https://bugzilla.tianocore.org/show_bug.cgi?id=1225
Obtained from: https://github.com/tianocore/edk2/commit/959be180e185869b71db9dad34c3f4bba660d724
Pull Request: https://github.com/freebsd/freebsd-src/pull/580

2 years agovt: fix double-click word selection for last word on line
Ed Maste [Mon, 21 Feb 2022 04:09:36 +0000 (23:09 -0500)]
vt: fix double-click word selection for last word on line

Previously when double-clicking on the last word on a line we would
select from the beginning of the word to the cursor position, because
we searched forward for a space character to find the end of a word.
Now, use the end of the line if we do not find a space.

PR: 261553
Reviewed by: markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34339

2 years agoiicbus: Add missing dependency for iicbus module.
Michal Meloun [Wed, 23 Feb 2022 15:24:01 +0000 (16:24 +0100)]
iicbus: Add missing dependency for iicbus module.

Reported by: rpokala, mjg
MFC with:       1bd3e8ba696633ccd7525030d951b58ade167814

2 years agotcp_wrappers: remove duplicate errno declarations
Piotr Pawel Stefaniak [Sun, 13 Feb 2022 18:19:25 +0000 (19:19 +0100)]
tcp_wrappers: remove duplicate errno declarations

2 years agotcp_wrappers: include <unistd.h>
Piotr Pawel Stefaniak [Sun, 13 Feb 2022 18:14:55 +0000 (19:14 +0100)]
tcp_wrappers: include <unistd.h>

This is for getdomainname(3).

2 years agoFix the sanitizer header checks on arm64
Andrew Turner [Wed, 12 Jan 2022 16:03:41 +0000 (16:03 +0000)]
Fix the sanitizer header checks on arm64

We need to not include the MI _san.h files when builing some parts of
the kernel. Fix these checks in the arm64 header files.

Sponsored by: The FreeBSD Foundation

2 years agoBuilt all KCSAN atomic interceptors on arm64
Andrew Turner [Wed, 12 Jan 2022 16:09:38 +0000 (16:09 +0000)]
Built all KCSAN atomic interceptors on arm64

These atomic functions are now supported. Add them to KCSAN.

Sponsored by: The FreeBSD Foundation

2 years agoAdd the char and short atomic operations on arm64
Andrew Turner [Wed, 12 Jan 2022 15:44:36 +0000 (15:44 +0000)]
Add the char and short atomic operations on arm64

Sponsored by: The FreeBSD Foundation

2 years agoarm: Add extres pseudo devices to some kernel
Emmanuel Vadot [Wed, 23 Feb 2022 07:44:16 +0000 (08:44 +0100)]
arm: Add extres pseudo devices to some kernel

All the pseudo devices and framework are required by drivers.

Reported by: mjg

2 years agofiles: Make mmc_fdt_helper and sdhci depends on clk and regulator
Emmanuel Vadot [Wed, 23 Feb 2022 07:43:45 +0000 (08:43 +0100)]
files: Make mmc_fdt_helper and sdhci depends on clk and regulator

Those two frameworks are needed.

2 years agoiwlwifi: fix the build
Bjoern A. Zeeb [Wed, 23 Feb 2022 01:09:26 +0000 (01:09 +0000)]
iwlwifi: fix the build

Pull in a case statement from the upcoming iwlwifi update to
unbreak the build after d875aa1587ce7d1651cabe395ed991f2384795cd .

Reported by: cy
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC with: d875aa1587ce7d1651cabe395ed991f2384795cd

2 years agobsdinstall/distfetch: fix main bar percentage with errors
Alfonso S. Siciliano [Wed, 23 Feb 2022 00:54:51 +0000 (01:54 +0100)]
bsdinstall/distfetch: fix main bar percentage with errors

UI fix not related to the real fetching process, use 'nfiles'
(instead of 'total files size') to compute main bar percentage
if an error occurs:

 - fix: main bar greater than 100%, if an error occurs before fetching
 - fix: main bar less than 100%, if an error occurs during fetching
 - add: last mixedgauge, at least one dialog if a total failure occurs

PR: 164094, 169748
Approved by: bapt (mentor)
Review: https://reviews.freebsd.org/D33978

2 years agoLinuxKPI: update 802.11 headers
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:57:31 +0000 (22:57 +0000)]
LinuxKPI: update 802.11 headers

Add new defines, struct members, and (stub) functions needed for an
updated iwlwifi.  Most of the defines are for rfkill or HE.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: skbuff.h add skb_postpush_rcsum()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:54:48 +0000 (22:54 +0000)]
LinuxKPI: skbuff.h add skb_postpush_rcsum()

Add a stub for skb_postpush_rcsum() needed by an updated iwlwifi.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agonfscl: Fix a use after free in nfscl_cleanupkext()
Rick Macklem [Tue, 22 Feb 2022 22:21:43 +0000 (14:21 -0800)]
nfscl: Fix a use after free in nfscl_cleanupkext()

ler@, markj@ reported a use after free in nfscl_cleanupkext().
They also provided two possible causes:
- In nfscl_cleanup_common(), "own" is the owner string
  owp->nfsow_owner.  If we free that particular
  owner structure, than in subsequent comparisons
  "own" will point to freed memory.
- nfscl_cleanup_common() can free more than one owner, so the use
  of LIST_FOREACH_SAFE() in nfscl_cleanupkext() is not sufficient.

I also believe there is a 3rd:
- If nfscl_freeopenowner() or nfscl_freelockowner() is called
  without the NFSCLSTATE mutex held, this could race with
  nfscl_cleanupkext().
  This could happen when the exclusive lock is held
  on the client, such as when delegations are being returned.

This patch fixes them as follows:
1 - Copy the owner string to a local variable before the
    nfscl_cleanup_common() call.
2 - Modify nfscl_cleanup_common() to return whether or not a
    free was done.
    When a free was done, do a goto to restart the loop, instead
    of using FOREACH_SAFE, which was not safe in this case.
3 - Acquire the NFSCLSTATE mutex in nfscl_freeopenowner()
    and nfscl_freelockowner(), if it not already held.
    This serializes all of these calls with the ones done in
    nfscl_cleanup_common().

Reported by: ler
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34334

2 years agocp: fix -R with links
Kyle Evans [Thu, 27 Jan 2022 18:02:17 +0000 (12:02 -0600)]
cp: fix -R with links

The traversal was previously not properly honoring -H/-L/-P.  Notably,
we should not have been resolving symlinks encountered during traversal
when either -H or -P are specified.

Sponsored by: Klara, Inc.
Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D34063

2 years agokeymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards
Alfredo Dal'Ava Junior [Wed, 23 Feb 2022 00:35:09 +0000 (21:35 -0300)]
keymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards

This adds missing Alt Gr mappings for the keys "q", "w", "e" an "c" to
conform with ABNT2 standard.

PR: 256416
Submitted by: Neebz <vpguyrhpjltta@logicstreak.com>
Reviewed by: emaste
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D33801

2 years agocamcontrol fwdownload minor improvements
Warner Losh [Tue, 22 Feb 2022 21:25:32 +0000 (14:25 -0700)]
camcontrol fwdownload minor improvements

Minor improvements to the fwdownload code suggested by chs@:
o Print the path_id/target we're rescanning so it's not invisible
o No need for XPT_GDEVLIST, all the info is filled in. Remove sending it
  as well as a comment related to it from a mistaken observation. libcam
  always fills these in properly, so use those for the ccb path/target.
o Don't leak /dev/xpt fd in success cases.
o Rename fw_rescan_lun to fw_rescan_target and pass sim_mode to
  only print path_id and target_id info.

Reviewed by: chs@
Fixes: 9835900cb95bcd068774934961fb1419719d595b
Sponsored by: Netflix
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D34348

2 years agovt: whitespace and style(9) updates
Ed Maste [Tue, 22 Feb 2022 21:30:27 +0000 (16:30 -0500)]
vt: whitespace and style(9) updates

2 years agosrc.libnames.mk: add a comment explaining libssp_nonshared
Ed Maste [Tue, 22 Feb 2022 21:22:03 +0000 (16:22 -0500)]
src.libnames.mk: add a comment explaining libssp_nonshared

libssp_nonshared is a special case for (only) i386 and power*.  Add a
comment explaining why, based on the original commit message that added
it.

MFC after: 1 week
Fixes: 0f61170882cb ("libssp_nonshared: use only on i386 and ppc")
Sponsored by: The FreeBSD Foundation

2 years agomps/mpr: Add missing newlines in error messages.
Alexander Motin [Tue, 22 Feb 2022 20:06:48 +0000 (15:06 -0500)]
mps/mpr: Add missing newlines in error messages.

MFC after: 1 week

2 years agoreadelf: add Arm address mask note type NT_ARM_ADDR_MASK
Ed Maste [Tue, 22 Feb 2022 17:40:39 +0000 (12:40 -0500)]
readelf: add Arm address mask note type NT_ARM_ADDR_MASK

Reviewed by: andrew
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34346

2 years agofd: rename fget*_locked to fget*_noref
Mateusz Guzik [Tue, 22 Feb 2022 15:54:17 +0000 (16:54 +0100)]
fd: rename fget*_locked to fget*_noref

This gets rid of the error prone naming where fget_unlocked returns with
a ref held, while fget_locked requires a lock but provides nothing in
terms of making sure the file lives past unlock.

No functional changes.

2 years agotty: fix a panic with INVARIANTS
Robert Wing [Tue, 22 Feb 2022 18:22:18 +0000 (09:22 -0900)]
tty: fix a panic with INVARIANTS

watch'ing a tty triggers a refcount wraparound panic, take a reference
on fp after fget_cap_locked() to fix.

Reported by:    Michael Jung <mikej_at_paymentallianceintl.com>
Reviewed by: hselasky, mjg
Fixes:          f40dd6c8034b ("tty: switch ttyhook_register to use fget_cap_locked")
Differential Revision: https://reviews.freebsd.org/D34335

2 years agopowerpc: enable initial-exec TLS
Piotr Kubaj [Fri, 18 Feb 2022 13:22:14 +0000 (14:22 +0100)]
powerpc: enable initial-exec TLS

Summary:
Use initial-exec, like other architectures.

While here, switch MACHINE_ARCH in lib/libc/Makefile to LIBC_ARCH and consistently use powerpc.

Subscribers: imp, #contributor_reviews_base

Differential Revision: https://reviews.freebsd.org/D34315
Reviewed by: luporl
MFC after: 2 weeks

2 years agocamcontrol: Force a rescan of the lun after firmware download.
Warner Losh [Tue, 22 Feb 2022 17:34:36 +0000 (10:34 -0700)]
camcontrol: Force a rescan of the lun after firmware download.

After downloading the firmware to a device, it's inquiry data likely
will change. Force a rescan of the target with the CAM_EXPECT_INQ_CHANGE
flag to get it to record the new inqury data as being expected. This
avoids the need for a 'camcontrol rescan' on the device which detaches
and re-attaches the disk (da, ada) device. This brings fwdownload up to
nvmecontrol's ability to do the same thing w/o changing the exposed
nvme/nvd/nda device. We scan the target and not the LUN because dual
actuator drives have multiple LUNs, but the firmware is global across
many vendors' drives (and the so far theoretical ones that aren't won't
be harmed by the rescan).

Since the underlying struct disk is now preserved accross this
operation, it's now possible to upgrade firmware of a root device w/o
crashing the system.  On systems that are quite busy, the worst that
happens is that certain operaions are reported cancelled when the new
firmware is activated. These operations are retried with the normal CAM
recovery mechanisms and will work on the retry. The only visible hiccup
is the time that new firmware is flashing / initializing. One should not
consider this operation completely risk free, however, since not all
drives are well behaved after a firmware download.

MFC After: 1 week
Relnotes: yes
Sponsored by: Netflix
Feedback by: mav
Differential Revision: https://reviews.freebsd.org/D34325

2 years agoAdd NT_ARM_ADDR_MASK
Andrew Turner [Mon, 30 Aug 2021 16:43:22 +0000 (17:43 +0100)]
Add NT_ARM_ADDR_MASK

This can be used by debuggers to find which bits in a virtual address
should be masked off to get a canonical address. This is currently used
by the Pointer Authentication Code support to get its mask. It could also
be used if we support Top Byte Ignore for the same purpose.

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

2 years agoriscv: Fix another race in pmap_pinit()
Mark Johnston [Tue, 22 Feb 2022 14:26:33 +0000 (09:26 -0500)]
riscv: Fix another race in pmap_pinit()

Commit c862d5f2a789 ("riscv: Fix a race in pmap_pinit()") did not really
fix the race.  Alan writes,

 Suppose that N entries in the L1 tables are in use, and we are in the
 middle of the memcpy().  Specifically, we have read the zero-filled
 (N+1)st entry from the kernel L1 table.  Then, we are preempted.  Now,
 another core/thread does pmap_growkernel(), which fills the (N+1)st
 entry.  Finally, we return to the original core/thread, and overwrite
 the valid entry with the zero that we earlier read.

Try to fix the race properly, by copying kernel L1 entries while holding
the allpmaps lock.  To avoid doing unnecessary work while holding this
global lock, copy only the entries that we expect to be valid.

Fixes: c862d5f2a789 ("riscv: Fix a race in pmap_pinit()")
Reported by: alc, jrtc27
Reviewed by: alc
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34267

2 years agovt: fix double-click word selection for first word on line
Ed Maste [Mon, 21 Feb 2022 04:09:36 +0000 (23:09 -0500)]
vt: fix double-click word selection for first word on line

Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line.  This is because we searched backward for a
space to mark the beginning of a word.

Now, use the beginning of the line if we do not find a space.

PR: 261553
Reported by: Stefan B.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agostress2: Added cleanup on error
Peter Holm [Tue, 22 Feb 2022 11:07:45 +0000 (12:07 +0100)]
stress2: Added cleanup on error

2 years agofiles: Make mmc_pwrseq depends on regulator and clk
Emmanuel Vadot [Tue, 22 Feb 2022 10:22:23 +0000 (11:22 +0100)]
files: Make mmc_pwrseq depends on regulator and clk

It uses those two frameworks too.

2 years agodwc: Support phy mode MII
Emmanuel Vadot [Tue, 22 Feb 2022 08:58:36 +0000 (09:58 +0100)]
dwc: Support phy mode MII

Some board use dwc phy in MII mode, so do not fail to attach if this is
the case.
Only rockchip code uses the phy mode to program some custom syscon register.

PR: 260848
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG