Commit Graph

272783 Commits

Author SHA1 Message Date
Warner Losh
9891cb1e76 Eliminate curlen, it's set but never used
Sponsored by:		Netflix
2022-02-27 09:02:45 -07:00
Dimitry Andric
298c3e8d6b 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
2022-02-27 13:53:19 +01:00
Jamie Gritton
be7cf3f4b8 posixshm: Add a -j option to posixshmcontrol ls, to specify a jail
PR:		257556
Reported by:	grembo@
2022-02-26 17:45:28 -08:00
Scott Long
6f3c0d2764 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
2022-02-26 18:29:08 -07:00
Scott Long
66b86c8a76 Fix "set but not used" in the mrsas driver. Remove dead code. 2022-02-26 12:21:11 -07:00
Scott Long
c61dc85428 Fix "set but not used" in the mvs driver. Remove dead code. 2022-02-26 12:18:42 -07:00
Scott Long
0fd7b4c74d Fix "set but not used" in the bfe driver. Remove dead code. 2022-02-26 12:14:22 -07:00
Scott Long
887ae1953f Fix "set but not used" in the siis driver. 2022-02-26 11:46:53 -07:00
Scott Long
4b22ce0730 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.
2022-02-26 11:40:17 -07:00
Scott Long
b6ac753a88 Fix "set but not used" in twe. 2022-02-26 11:16:31 -07:00
Scott Long
fa911920b1 Fix "set but not used" for real in the ciss driver. 2022-02-26 11:07:05 -07:00
Scott Long
55339af296 Expand __diagused to include the KTR kernel diagnostic option. 2022-02-26 11:01:54 -07:00
Scott Long
dec703c7e0 Fix "set but not used" in the ips driver. Dead code. 2022-02-26 10:35:51 -07:00
Scott Long
f94066c8aa Fix "set but not used" in aic7xxx/aic79xx. The variables were dead
code.
2022-02-26 10:33:31 -07:00
Scott Long
e28289ca83 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.
2022-02-26 10:25:43 -07:00
Richard Scheffenegger
407c34e735 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
2022-02-25 20:57:05 +01:00
Richard Scheffenegger
2ff07d9220 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
2022-02-25 20:05:32 +01:00
Mark Johnston
c84bb8cd77 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
2022-02-25 13:55:24 -05:00
Marvin Ma
1517b8d5a7 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
2022-02-25 12:19:14 -06:00
Alexander Motin
f00ced06da CTL: Rework 05c3e8e871 using %zu format.
MFC after:	2 days
2022-02-25 11:53:53 -05:00
Christian Brueffer
16ee5cd15a Fix mdoc issues found by mandoc -Tlint. 2022-02-25 17:41:19 +01:00
Christian Brueffer
69d793a2b7 mdoc style: new sentence, new line. 2022-02-25 17:41:08 +01:00
John F. Carr
6c799530d8 rtld.1: Fix misplaced text
PR:		262194
Fixes:		f90218886f ("rtld: introduce PRELOAD_FDS")
MFC after:	3 days
2022-02-25 11:16:35 -05:00
Eric van Gyzen
58135fbd8b 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
2022-02-25 09:30:29 -06:00
Eric van Gyzen
d0f4e583bf 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
2022-02-25 09:30:29 -06:00
Eric van Gyzen
331b84b5db rtsold: fix memory leak in script execution
Since commit 04e9edb544, rtsold has leaked the memory for the
argument vector of every script it runs.

Reported by:	Coverity
Reviewed by:	markj
Fixes:		04e9edb544
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34355
2022-02-25 09:30:29 -06:00
Eric van Gyzen
a2a8efb4f6 rtsold: Use correct error in llflags_get()
Set errno to EINVAL if the name overflows the buffer, as was done
before commit ecce515d54.

Reviewed by:	dab, markj
Fixes:		ecce515d54
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34354
2022-02-25 09:30:29 -06:00
Rick Macklem
1cedb4ea1a 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
2022-02-25 07:27:03 -08:00
Christian Brueffer
3211796d7f mdoc style: whitespace fixes. 2022-02-25 15:02:13 +01:00
Richard Scheffenegger
bd6bb49397 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
2022-02-25 10:35:47 +01:00
Alexander Motin
05c3e8e871 Fix 32-bit build after 530d274c15.
MFC after:	3 days
2022-02-24 18:11:36 -05:00
Eric van Gyzen
a8fea07c30 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
2022-02-24 17:05:12 -06:00
Bjoern A. Zeeb
062103fc93 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
2022-02-24 21:42:02 +00:00
Bjoern A. Zeeb
51152e5e61 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
2022-02-24 21:42:01 +00:00
Bjoern A. Zeeb
d9836fb4b9 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
2022-02-24 21:42:01 +00:00
Alexander Motin
530d274c15 CTL: Add length validation for incoming HA messages.
This should fix uninitialized memory reads when working with broken
HA peer, like one fixed in 1a8d8a3a90.  Instead print error message
and kill the HA link.

MFC after:	3 days
Sponsored by:	iXsystems, Inc.
2022-02-24 16:24:43 -05:00
Alan Somers
e8553be9bc 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
2022-02-24 14:07:25 -07:00
Warner Losh
6979e8cb6e dtc: more mandoc -T lint fixes
Obtained from:		dtc repo 04c805a8b08e4a1d4ff1f1e62ef475fbfe1a5fbe
Sponsored by:		Netflix
2022-02-24 13:54:13 -07:00
Bjoern A. Zeeb
f6fb9b524f 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
2022-02-24 19:59:25 +00:00
Bjoern A. Zeeb
fab601c5b7 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
2022-02-24 19:57:20 +00:00
Bjoern A. Zeeb
810ca5629a 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
2022-02-24 19:55:19 +00:00
Warner Losh
2bfdc1ee9b cons: Use bool for boolean variables
MFC After:		3 days
Sponsored by:		Netflix
2022-02-24 10:58:07 -07:00
Andy Fiddaman
ad3da82996 bhyve: plug memory leak in topology_parse()
Reviewed by:    jhb, rew
Differential Revision:  https://reviews.freebsd.org/D34301
2022-02-24 08:38:53 -09:00
Jamie Gritton
d7c4ea7d72 posixshm: Allow jails to use kern.ipc.posix_shm_list
PR:		257554
Reported by:	grembo@
2022-02-24 09:30:49 -08:00
Rick Macklem
06148d2251 Revert "nfscl: Fix a use after free in nfscl_cleanupkext()"
This reverts commit dd08b84e35.

cy@ reported a problem caused by this patch.  He will be
testing an alternate patch, but I'm reverting this one.
2022-02-24 07:01:03 -08:00
Hans Petter Selasky
7520b88860 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
2022-02-24 10:28:55 +01:00
Christian Brueffer
68445e349b Fix mdoc macro usage and style in section 4 manpages. 2022-02-24 10:04:53 +01:00
Simon J. Gerraty
e692517517 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.
2022-02-23 21:26:41 -08:00
Jason A. Harmening
fcb164742b 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
2022-02-23 22:10:02 -06:00
Warner Losh
5e2de1c116 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
2022-02-23 17:56:02 -07:00