Commit Graph

255514 Commits

Author SHA1 Message Date
Edward Tomasz Napierala
3e404b8c53 libcam(3): make cam_getccb(3) zero the whole ccb, not just the header
Leaving zeroing to the clients leads to error-prone pointer
tricks (zeroing needs to preserve the CCB header), and this
code is not performance-critical, so there's really no reason
to not do it.

Reviewed By:	imp, rpokala (manpages)
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27333
2020-12-29 14:26:06 +00:00
Edward Tomasz Napierala
4ddb3cc597 devfs(4): defer freeing until we drop devmtx ("cdev")
Before r332974 the old code would sometimes cause a rare lock order
reversal against pagequeue, which looked roughly like this:

witness_checkorder()
__mtx_lock-flags()
vm_page_alloc()
uma_small_alloc()
keg_alloc_slab()
keg_fetch-slab()
zone_fetch-slab()
zone_import()
zone_alloc_bucket()
uma_zalloc_arg()
bucket_alloc()
uma_zfree_arg()
free()
devfs_metoo()
devfs_populate_loop()
devfs_populate()
devfs_rioctl()
VOP_IOCTL_APV()
VOP_IOCTL()
vn_ioctl()
fo_ioctl()
kern_ioctl()
sys_ioctl()

Since r332974 the original problem no longer exists, but it still
makes sense to move things out of the - often congested - lock.

Reviewed By:	kib, markj
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27334
2020-12-29 13:47:36 +00:00
Kevin Lo
e9556246be Revert "uefi.8: mention boot1.efi"
This reverts commit a8ec81e798

Revert D27782.  imp@ pointed out that bsdinstall has been updated, and gpart
bootcode isn't used with EFI.
2020-12-29 12:08:19 +08:00
Ed Maste
ead01bfe86 Move cp(4) module enable to SOURCELESS_HOST
cp contains obfuscated code that runs on the host's processor
2020-12-28 19:36:51 -05:00
Ryan Libby
629c4aeace kern.mk: drop flag only patched in-tree gcc understood
-mno-align-long-strings was a flag maintained by FreeBSD for the
now-deleted in-tree gcc.  Upstream gcc has no such flag, so just drop
it.

The flag was originally submitted by bde and committed in 2002 (svn
r97911 & r104455).  However, upstream gcc did address this same issue in
2004 (gcc svn r76694 / git 4137ba7ab7a), reducing long string alignment
in general, and to 1 with -Os.

Reviewed by:	kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27768
2020-12-28 14:03:36 -08:00
Guangyuan Yang
70a2e109bd dump(8): clarify the recommended use of cache and snapshots
PR:		131626
MFC after:	1 week
Submitted by:	Andrew Hamilton-Wright <andrew@qemg.org>
Reviewed by:	bcr
Differential Revision:	https://reviews.freebsd.org/D27775
2020-12-28 21:56:58 +00:00
Mateusz Guzik
0c09f4b0cc cache: work around corner case of dvp == tvp in cache_fplookup_final_modifying
Fixes a panic where the kernel would unlock an unheld lock coming from
rename looking up "foo/." as the source.

Reported by:	markj (syzkaller)
2020-12-28 21:38:20 +00:00
Alan Somers
4f4111d2c5 fusefs: delete some dead code
The original fusefs GSoC project seems to have envisioned exchanging two
types of messages with FUSE servers.  Perhaps vectored and non-vectored?
But in practice only one type has ever been used.  Delete the other type.

Reviewed by:		cem
Differential Revision:	https://reviews.freebsd.org/D27770
2020-12-28 19:05:35 +00:00
Konstantin Belousov
58b2ed4672 eventfd.2: Add the mail address of the submitter into copyright.
Requested by:	rgrimes
MFC after:	13 days
2020-12-28 21:03:16 +02:00
Alan Somers
f928dbcb16 fusefs: fix the tests for a wider range of maxphys
maxphys is now a tunable, ever since r368124.  The default value is also
larger than it used to be.  That broke several fusefs tests that made
assumptions about maxphys.

* WriteCluster.clustering used the MAXPHYS compile-time constant.

* WriteBackAsync.direct_io_partially_overlaps_cached_block implicitly
  depended on the default value of maxphys.  Fix it by making the
  dependency explicit.

* Write.write_large implicitly assumed that maxphys would be no more
  than twice maxbcachebuf.  Fix it by explicitly setting m_max_write.

* WriteCluster.clustering and several others failed because the MockFS
  module did not work for max_write > 128KB (which most tests would set
  when maxphys > 256KB).  Limit max_write accordingly.  This is the same
  as fusefs-libs's behavior.

* Bmap's tests were originally written for MAXPHYS=128KB.  With larger
  values, the simulated file size was too small.

PR:		252096
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D27769
2020-12-28 18:56:17 +00:00
Ed Maste
c37a669374 Correct font.h comment describing vfnt font maps
Commit 41fb066511 doubled the number of glyph maps in the vfnt format
from 2 to 4 to support double-width characters, but a comment describing
the maps was not updated to match.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2020-12-28 12:47:12 -05:00
Gordon Bergling
e5a84dc8a7 dumpon(8): Add missing section arguments
MFC after:	3 days
2020-12-28 16:48:58 +01:00
Gordon Bergling
e13534d54a newfs(8): Fix unusual Xr order
- unusual Xr order: gjournal after gpart

MFC after:	3 days
2020-12-28 16:46:28 +01:00
Mateusz Piotrowski
63fb0d3bc3 Remove misleading macros from -width arguments
Also, remove $FreeBSD$ tag from manual page examples.

MFC after:	1 week
2020-12-28 16:30:55 +01:00
Hans Petter Selasky
9e7fa1e66c Collect statistics from all rate-limit queues in mlx5en(4).
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-28 14:39:51 +01:00
Hans Petter Selasky
aca12148b1 Improve error message printing in krping.
Don't print completion queue flush as an error.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-28 14:37:09 +01:00
Michal Meloun
e903478919 ARM64: Port FreeBSD to Nvidia Jetson TX1 and Nano.
Add support for the Tergra210 SoC and its companion PMIC MAX77620.
2020-12-28 14:12:41 +01:00
Ryan Libby
63f93c7e11 rtld-elf: link libcompiler_rt on all architectures
Statically link rtld-elf with libcompiler_rt on all architectures so
that we don't need to try to pick and choose the bits we need from it
for each architecture (we now leave that to the linker).  Compilers may
emit calls to support functions in this library, but because of the use
of the linker flag -nostdlib for rtld's special needs, the library is
not linked as normal.

Previously we had two different solutions.  On some architectures, we
were able to extract reimplementations of the necessary builtin
functions from our special build of libc.  On ARM, we just linked
libcompiler_rt.

This is motivated by the same issue as D26199 and D27665, but should be
a simpler solution that will apply to all architectures.

Reviewed by:	arichardson, kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27736
2020-12-28 00:44:25 -08:00
Ryan Libby
85b8932d0a Revert "rtld-elf: link udivmoddi4 from compiler_rt"
This reverts commit bce2cff0bc.

Revert D27665 in favor of a more general fix coming in D27736.
2020-12-28 00:44:25 -08:00
Ryan Libby
a723bb667e libcompiler_rt: stop building with stack smashing protection
libcompiler_rt implements certain functions that clang and gcc emit
calls to as part of their codegen (e.g. for extended width math).  Build
it without stack smashing protection (SSP, -fstack-protector) in order
to support building binaries without SSP, especially the dynamic linker.
Besides, SSP is probably not very valuable in this library.

Reviewed by:	arichardson, dim, kib
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27786
2020-12-28 00:44:25 -08:00
Kyle Evans
f20c0e3319 caroot: drop $FreeBSD$ expansion from root bundle
This debatably could have waited until the next update would have taken
place, but it's easier to see what changes if we get it out of the way
now.

MFC after:	3 days
2020-12-27 21:47:41 -06:00
Kevin Lo
a8ec81e798 Mention boot1.efi since it is an image of 800KB FAT filesystem stored as
/EFI/BOOT/BOOTX64.EFI.
Differential Revision:	https://reviews.freebsd.org/D27782
2020-12-28 10:30:21 +08:00
Mateusz Guzik
4ab7d9f484 cache: reduce engrish in previous commit 2020-12-28 02:05:30 +00:00
Mateusz Guzik
0714f921cd cache: save on some branching in common case mount point traversal 2020-12-28 01:53:28 +00:00
Mateusz Guzik
8c9d74634a vfs: stop open-coding setting WILLBEDIR flag 2020-12-28 01:53:27 +00:00
Mateusz Guzik
002e18eb7f vfs: add FAILIFEXISTS flag
Both FreeBSD and Linux mkdir -p walk the tree up ignoring any EEXIST on
the way and both are used a lot when building respective kernels.

This poses a problem as spurious locking avoidably interferes with
concurrent operations like getdirentries on affected directories.

Work around the problem by adding FAILIFEXISTS flag. In case of lockless
lookup this manages to avoid any work to begin with, there is no speed
up for the locked case but perhaps this can be augmented later on.

For simplicity the only supported semantics are as used by mkdir.

Reviewed by:	kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D27789
2020-12-28 01:53:27 +00:00
Mateusz Guzik
ff97bc034f cache: simplify lockless dot lookups 2020-12-28 01:53:27 +00:00
Ryan Libby
833dbf1e22 route: quiet -Wredundant-decls
Remove declaration duplicated in
f5baf8bb12

Reviewed by:	melifaro
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27790
2020-12-27 16:32:27 -08:00
Martin Matuska
70a567c2c3 bsdcat,cpio,tar: Bump version number to 3.5.1
Matches import of libarchive 3.5.1
2020-12-28 00:37:06 +01:00
Martin Matuska
69a18c5826 contrib/libarchive: Import libarchive 3.5.1
Merge commit '8be2bb3d35e232080b4e39244020e650bbe31562' into main
2020-12-28 00:34:06 +01:00
Martin Matuska
8be2bb3d35 Update vendor/libarchive/dist to 227a4b9719a7fbeba6ba46e377ff7d953f405cd5
Libarchive 3.5.1
2020-12-28 00:06:27 +01:00
Ryan Libby
f2d48b5e2c Merge commit d8a09b3a0 from openzfs git (by Ryan Libby):
lua: avoid gcc -Wreturn-local-addr bug

  Avoid a bug with gcc's -Wreturn-local-addr warning with some
  obfuscation.  In buggy versions of gcc, if a return value is an
  expression that involves the address of a local variable, and even if
  that address is legally converted to a non-pointer type, a warning may
  be emitted and the value of the address may be replaced with zero.
  Howerver, buggy versions don't emit the warning or replace the value
  when simply returning a local variable of non-pointer type.

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90737

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11337
2020-12-27 14:33:13 -08:00
Ryan Libby
21ce674e3c Merge commit 956f94010 from openzfs git (by Ryan Libby):
spa: avoid type narrowing warning

  Building the spa module for i386 caused gcc to emit
  -Wint-to-pointer-cast "cast to pointer from integer of different size"
  because spa.spa_did was uint64_t but pthread_join (via thread_join in
  spa_deactivate) takes a pointer (32-bit on i386).  Define spa_did to be
  pointer-size instead.  For now spa_did is in fact never non-zero and the
  thread_join could instead be ifdef'd out, but changing the size of
  spa_did may be more useful for the future.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11336
2020-12-27 14:33:13 -08:00
Ryan Libby
48184e7661 Merge commit c7500ded3 from openzfs git (by Ryan Libby):
FreeBSD libzfs: gcc requires __thread after static

  Building libzfs with gcc on FreeBSD failed because gcc is picky about
  the order of keywords in declarations with __thread, whereas clang is
  more relaxed.

  https://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11331
2020-12-27 14:33:13 -08:00
Ryan Libby
e67d933d9c Merge commit 3fcd73747 from openzfs git (by Adrian Chadd):
Fix compiling on FreeBSD + gcc - don't assume illmnos bits

  This looks like it was once from the illumnos compat code.
  FreeBSD doesn't have cmn_err as a compiler format attribute, so
  it definitely errors out.

  It doesn't show up on LLVM because it doesn't trigger at all.

  Add in the format flags but keep them behind #if 0 for now;
  there are too many format issues that trigger when one does
  format checking in the shared code.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: adrian chadd <adrian@freebsd.org>
  Closes #11068
  Closes #11069
2020-12-27 14:33:13 -08:00
Ryan Libby
913f2d2e0c Merge commit 79a357c2a from openzfs git (by Adrian Chadd):
Fix pointer-is-uint64_t-sized assumption in the ioctl path

  This shows up when compiling freebsd-head on amd64 using gcc-6.4.
  The lib32 compat build ends up tripping over this assumption.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: adrian chadd <adrian@freebsd.org>
  Closes #11068
  Closes #11069
2020-12-27 14:33:13 -08:00
Ryan Libby
d021434a79 openzfs: fix gcc kernel module builds
- Suppress -Wredundant-decls.  Ultimately this warning is harmless in
   any case, and it does not look like there is a simple way to avoid
   redundant declarations in this case without a lot of header pollution
   (e.g. having openzfs's shim param.h pulling in sys/kernel.h for hz).
 - Suppress -Wnested-externs, which is useless anyway.

Unfortunately it was not sufficient just to modify OPENZFS_CFLAGS,
because the warning suppressions need to appear on the command line
after they are explicitly enabled by CWARNFLAGS from sys/conf/kern.mk,
but OPENZFS_CFLAGS get added before due to use of -I for the shims.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27685
2020-12-27 14:33:13 -08:00
Mark Johnston
599f904463 msdosfs: Fix a leak of dirent padding bytes
This was missed in r340856 / commit
6d2e2df764.  Three bytes from the kernel
stack may be leaked when reading directory entries.

Reported by:	Syed Faraz Abrar <faraz@elttam.com>
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2020-12-27 17:01:44 -05:00
Mark Johnston
81846def34 vm: Fix some bugs in the page busying code
In vm_page_busy_acquire(), load the object pointer using
atomic_load_ptr() as we do elsewhere.  Per the comment, the object
identity must be consistent across sleeps.

In vm_page_grab_sleep(), pass the correct pindex to
_vm_page_busy_sleep().  The pindex is used to re-check the page's
identity before going to sleep.  In particular, vm_page_grab_sleep() is
used in unlocked grab, so the object lock is not necessarily held when
verifying the page's identity, and the pindex may change if the page is
moved, or freed and re-allocated.  I believe this can result in spurious
VM_PAGER_FAILs from vm_page_grab_valid_unlocked() or early termination
of vm_page_grab_pages_unlocked().

In vm_page_grab_pages(), pass the correct pindex to
vm_page_grab_sleep().  Otherwise I believe vm_page_grab_pages() will
effectively spin when attempting to busy a busy page after the first
index in the range.

Reviewed by:	alc, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27607
2020-12-27 17:01:44 -05:00
Mark Johnston
d2f1c44bc9 uma: Remove the MINBUCKET flag from the flag name list
This should have been done in r368399 / commit
f8b6c51538.

Reported by:	rlibby
Sponsored by:	The FreeBSD Foundation
2020-12-27 17:01:33 -05:00
Mark Johnston
795a009b32 md: Set bio_completed properly in the face of errors
Account for any residual bytes.  This is only relevant for vnode-backed
md(4) devices.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27738
2020-12-27 16:49:35 -05:00
Stefan Eßer
e458944cf9 Import bc 3.2.4 2020-12-27 22:32:22 +01:00
Stefan Eßer
50fcb4ee77 Replace sscanf() by strtoul()
This change has been motivated by a mail from bde sent in 2015 in
which he mentioned inappropriate use of sscanf() in 3 programs in
/bin.

This change removes the potential mismatch of the types of the return
values and the variable width specified in the scan pattern. While
there was no issue with the patterns and types used, the new code is
simpler and more efficient.
2020-12-27 22:32:22 +01:00
Stefan Eßer
3fee777ec5 Simplify LS_COLWIDTHS processing
The previous version normalized the width list (replaced empty fields
with "0") just to be able to use sscanf() on the string.

It is much simpler to just parse the string as-is.

The clearing of f_notabs is preserved for the case that less than 9
width values have been defined, but I do not understand the rationale
for this particular condition. E.g., LS_COLWIDTHS="::::::::" will be
counted as 9 defined fields (may clear f_notabs) but is no different
fron LS_COLWIDTHS="" with regard to the field width (and that does not
clear f_notabs, since there are less than 9 fields).
2020-12-27 22:32:22 +01:00
Stefan Eßer
dbb25cbe55 Adjust to display more than 999 sleeping threads 2020-12-27 22:32:22 +01:00
Stefan Eßer
6fe8fbdc1c Statistics are for threads, not processes 2020-12-27 22:32:22 +01:00
Toomas Soome
2ae5841472 libsa: xdrproc_t should return bool
Since our xdr translation function are returning bool, so should
xdrproc_t.

Issue reported by gcc 10 build.
2020-12-27 23:25:18 +02:00
Mateusz Guzik
abd7ded451 cache: modification and last entry filling support in lockless lookup v2
The previous patch failed to set the ISDOTDOT flag when appropriate,
which in turn fail to properly handle degenerate lookups.

While here sprinkle some extra assertions.

Tested by:	pho (previous version)
2020-12-27 21:03:18 +00:00
Mateusz Guzik
623daa69f9 cache: assert internal flags are not passed by namei 2020-12-27 19:49:24 +00:00
Mateusz Guzik
a1fc1f10c6 Revert "cache: modification and last entry filling support in lockless lookup"
This reverts commit 6dbb07ed68.

Some ports unreliably fail to build with rmdir getting ENOTEMPTY.
2020-12-27 19:02:29 +00:00