]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoAdd a VM flag to prevent reclaim on a failed contig allocation
Ryan Stone [Fri, 29 Jan 2021 21:13:57 +0000 (16:13 -0500)]
Add a VM flag to prevent reclaim on a failed contig allocation

If a M_WAITOK contig alloc fails, the VM subsystem will try to
reclaim contiguous memory twice before actually failing the
request.  On a system with 64GB of RAM I've observed this take
400-500ms before it finally gives up, and I believe that this
will only be worse on systems with even more memory.

In certain contexts this delay is extremely harmful, so add a flag
that will skip reclaim for allocation requests to allow those
paths to opt-out of doing an expensive reclaim.

Sponsored by: Dell Inc
Differential Revision: https://reviews.freebsd.org/D28422
Reviewed by: markj, kib

3 years agodwmmc: Multiple busdma fixes.
Michal Meloun [Thu, 21 Jan 2021 14:06:19 +0000 (15:06 +0100)]
dwmmc: Multiple busdma fixes.

- limit maximum segment size to 2048 bytes.  Although dwmmc supports a buffer
  fragment with a maximum length of 4095 bytes, use the nearest lower power
  of two as the maximum fragment size. Otherwise, busdma create excessive
  buffer fragments.
- fix off by one error in computation of the maximum data transfer length.
- in addition, reserve two DMA descriptors that can be used by busdma
  bouncing. The beginning or end of the buffer can be misaligned.
- Don’t ignore errors passed to bus_dmamap_load() callback function.
- In theory, a DMA engine may be running at time when next dma descriptor is
  constructed. Create a full DMA descriptor before OWN bit is set.

MFC after: 2 weeks

3 years agolinux: remove locks around callout_drain in timerfd_close()
shu [Wed, 3 Feb 2021 19:10:58 +0000 (19:10 +0000)]
linux: remove locks around callout_drain in timerfd_close()

The lock around callout_drain() is unnecessary and may cause
deadlock when one closes a timer descriptor during timer execution.

Reviewed By: delphij
Submitted By: ankohuu_outlook.com (Shunchao Hu)
Differential Revision: https://reviews.freebsd.org/D28148

3 years agoRevert "Reimplement strlen"
Mateusz Guzik [Wed, 3 Feb 2021 19:38:10 +0000 (19:38 +0000)]
Revert "Reimplement strlen"

This reverts commit 710e45c4b8539d028877769f1a4ec088c48fb5f1.

It breaks for some corner cases on big endian ppc64.
Given the stage of the release process it is best to revert for now.

Reported by: jhibbits

3 years agolinux: make timerfd_settime(2) set expirations count to zero
shu [Wed, 3 Feb 2021 16:51:45 +0000 (16:51 +0000)]
linux: make timerfd_settime(2) set expirations count to zero

On Linux, read(2) from a timerfd file descriptor returns an unsigned
8-byte integer (uint64_t) containing the number of expirations
that have occurred, if the timer has already expired one or more
times since its settings were last modified using timerfd_settime(),
or since the last successful read(2).  That's to say, once we do
a read or call timerfd_settime(), timer fd's expiration count should
be zero.  Some Linux applications create timerfd and add it to epoll
with LT mode, when event comes, they do timerfd_settime instead
of read to stop event source from trigger.  On FreeBSD,
timerfd_settime(2) didn't set the count to zero, which caused high
CPU utilization.

Submitted by: ankohuu_outlook.com (Shunchao Hu)
Differential Revision: https://reviews.freebsd.org/D28231

3 years agotools/build/make.py: -DNO_CLEAN -> -DWITHOUT_CLEAN
Alex Richardson [Wed, 3 Feb 2021 15:56:03 +0000 (15:56 +0000)]
tools/build/make.py: -DNO_CLEAN -> -DWITHOUT_CLEAN

3 years agodu_test: Skip three tests if sparse files are not supported
Alex Richardson [Wed, 3 Feb 2021 16:07:05 +0000 (16:07 +0000)]
du_test: Skip three tests if sparse files are not supported

This fixes running the du tests with /tmp as tmpfs (which is what we do in the
CheriBSD CI).

Obtained from: CheriBSD
Reviewed By: ngie
Differential Revision: https://reviews.freebsd.org/D28398

3 years agodiff: Use unprivileged_user with report_identical test
Olivier Cochard [Wed, 3 Feb 2021 16:18:59 +0000 (17:18 +0100)]
diff: Use unprivileged_user with report_identical test

Approved by: bapt
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D28466

3 years agoExpose clang's alignment builtins and use them for roundup2/rounddown2
Alex Richardson [Wed, 3 Feb 2021 15:27:17 +0000 (15:27 +0000)]
Expose clang's alignment builtins and use them for roundup2/rounddown2

This makes roundup2/rounddown2 type- and const-preserving and allows
using it on pointer types without casting to uintptr_t first. Not
performing pointer-to-integer conversions also helps the compiler's
optimization passes and can therefore result in better code generation.
When using it with integer values there should be no change other than
the compiler checking that the alignment value is a valid power-of-two.

I originally implemented these builtins for CHERI a few years ago and
they have been very useful for CheriBSD. However, they are also useful
for non-CHERI code so I was able to upstream them for Clang 10.0.

Rationale from the clang documentation:
Clang provides builtins to support checking and adjusting alignment
of pointers and integers. These builtins can be used to avoid relying
on implementation-defined behavior of arithmetic on integers derived
from pointers. Additionally, these builtins retain type information
and, unlike bitwise arithmetic, they can perform semantic checking on
the alignment value.

There is also a feature request for GCC, so GCC may also support it in
the future: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641

Reviewed By: brooks, jhb, imp
Differential Revision: https://reviews.freebsd.org/D28332

3 years agousr.sbin/praudit: Fix tests after 5619d49e07
Alex Richardson [Wed, 3 Feb 2021 15:26:19 +0000 (15:26 +0000)]
usr.sbin/praudit: Fix tests after 5619d49e07

Commit 5619d49e07 made the getgrgid() call inside bsm work as
intended so we now print "wheel" instead of a numeric 0 in the rgid field.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D28462

3 years agoreadelf: Fix printing NT_FREEBSD_ARCH_TAG
Alex Richardson [Wed, 3 Feb 2021 15:24:28 +0000 (15:24 +0000)]
readelf: Fix printing NT_FREEBSD_ARCH_TAG

Looking at lib/csu/arm/crt1_s.S, this should be a string and therefore the
restriction to 4 characters seems wrong.
Found whle updating https://reviews.llvm.org/D74393.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D28470

3 years agoarm64: Initialize VFP control register.
Michal Meloun [Sat, 23 Jan 2021 20:19:07 +0000 (21:19 +0100)]
arm64: Initialize VFP control register.

The RW fields in this register reset to architecturally unknown values,
so initialize these to the proper rounding and denormal mode.
MFC after: 1 week

3 years agowg(4): Add authors of the wg(4) driver to the manual page
Gordon Bergling [Wed, 3 Feb 2021 15:01:32 +0000 (16:01 +0100)]
wg(4): Add authors of the wg(4) driver to the manual page

Glen (@gjb) noticed that I am haven't mentioned the authors of the
WireGuard device driver in the manual page.

This is commit addressed this commit.

Reviewed by: gjb, brueffer
Differential Revision: https://reviews.freebsd.org/D28464
X-MFC-with: e59d9cb412846cb5d2bc4c641d3cc44d243cd52d

3 years agoAlways clamp curve25519 keys prior to use.
Peter Grehan [Wed, 3 Feb 2021 09:05:09 +0000 (19:05 +1000)]
Always clamp curve25519 keys prior to use.

This fixes an issue where a private key contained bits that should
have been cleared by the clamping process, but were passed through
to the scalar multiplication routine and resulted in an invalid
public key.

Issue diagnosed (and an initial fix proposed) by shamaz.mazum in
PR 252894.

This fix suggested by Jason Donenfeld.

PR: 252894
Reported by: shamaz.mazum
Reviewed by: dch
MFC after: 3 days

3 years agoatf: Fix ATF_BUILD_* values when not using the bootstrap compiler
Alex Richardson [Wed, 3 Feb 2021 09:32:16 +0000 (09:32 +0000)]
atf: Fix ATF_BUILD_* values when not using the bootstrap compiler

Currently, we encode the full path and compile flags for the build
compiler in libatf. However, these values are not correct when
cross-compiling: For example, when I build on macOS, CC is set to the
host path /usr/local/Cellar/llvm/11.0.0_1/bin/clang-11. This path will
not exist on the target system.
Simplify this logic and use cc/cpp/c++ since those binaries will exist
on the target system unless the compiler was explicitly disabled.
I'm not convinced ATF needs to encode these values, but this is a
minimal fix for these tests when using a non-bootstrapped compiler.

Reviewed By: ngie, brooks
Differential Revision: https://reviews.freebsd.org/D28414

3 years agosbin/bectl: Skip tests if sparse files are not supported
Alex Richardson [Wed, 3 Feb 2021 09:31:32 +0000 (09:31 +0000)]
sbin/bectl: Skip tests if sparse files are not supported

The tests create a 1GB test file and this causes the tests to fail in the
CheriBSD CI setup where we run tests with a tmpfs mount on /tmp. Tmpfs
does not support sparse files and it appears that tmpfs default to creating
a 1GB mount, so there is not enough space to run these tests.

Instead of checking for at least 1GB of free space, this commit skips the
tests on file systems that do not support sparse files.

Reviewed By: kevans
Differential Revision: https://reviews.freebsd.org/D28463

3 years agoFix build with read-only source dir after 83c20b8a2da0
Alex Richardson [Wed, 3 Feb 2021 09:29:08 +0000 (09:29 +0000)]
Fix build with read-only source dir after 83c20b8a2da0

I changed the Makefile to use SRCS instead of LDADD, but since there is
still and absolute path to the source the .o file was created inside the
source directory instead of the build directory.
It would be nice if this was an error/warning by default, but for now just
fix this issue by using .PATH and the base name of the file.

Reported by: cy, peterj

3 years agoEnable multipath routing by default.
Alexander V. Chernikov [Wed, 3 Feb 2021 08:49:46 +0000 (08:49 +0000)]
Enable multipath routing by default.

ROUTE_MPATH was added to the GENERIC kernel in r368648.

According to the plan in D27428, it was enabled with `net.route.multipath` sysctl set to 0.
Given enough time has passed, this change enables route multipath by default.

The goal is to ship FreeBSD 13 with multipath turned on.

Reviewed By: donner, olivier
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28423

3 years agorelease.sh: Skip installing textproc/docproj when NODOC is set
Glen Barber [Wed, 3 Feb 2021 00:04:11 +0000 (19:04 -0500)]
release.sh: Skip installing textproc/docproj when NODOC is set

PR: 253192
Submitted by: Yasuhiro Kimura
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoCorrect description for kern.proc.proc_td
Ed Maste [Tue, 2 Feb 2021 21:55:51 +0000 (16:55 -0500)]
Correct description for kern.proc.proc_td

kern.proc.proc_td returns the process table with an entry for each
thread.  Previously the description included "no threads", presumably
a cut-and-pasteo in 2648efa621748.

Description suggested by PauAmma.

PR: 253146
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoAllow setting alias port ranges in libalias and ipfw. This will allow a system
Neel Chauhan [Tue, 2 Feb 2021 21:24:17 +0000 (13:24 -0800)]
Allow setting alias port ranges in libalias and ipfw. This will allow a system
to be a true RFC 6598 NAT444 setup, where each network segment (e.g. user,
subnet) can have their own dedicated port aliasing ranges.

Reviewed by: donner, kp
Approved by: 0mp (mentor), donner, kp
Differential Revision: https://reviews.freebsd.org/D23450

3 years agowg(4): Fix Copyright statement in man page
Gordon Bergling [Tue, 2 Feb 2021 19:16:52 +0000 (20:16 +0100)]
wg(4): Fix Copyright statement in man page

3 years agoAdd a wg(4) manual page
Gordon Bergling [Tue, 2 Feb 2021 19:13:53 +0000 (20:13 +0100)]
Add a wg(4) manual page

Reviewed by: brueffer, donner, debdrup, ygy
MFC after: 2 days

3 years agoMake DataSN counter of solicited Data-Out local.
Alexander Motin [Tue, 2 Feb 2021 18:37:13 +0000 (13:37 -0500)]
Make DataSN counter of solicited Data-Out local.

DataSN for solicited Data-Out is per-R2T.  Since we handle whole R2T
in one go, we don't need to store it anywhere, especially in global
per-command structure.  This may allow us to handle multiple R2T per
command at once, if we decide, or may be relax locking.

Rename the second use of that field to io_referenced_task_tag.

MFC after: 1 month

3 years agogit hooks: add "Tested by" to commit message template
Ed Maste [Tue, 2 Feb 2021 18:36:45 +0000 (13:36 -0500)]
git hooks: add "Tested by" to commit message template

Reported by: mjg
Reviewed by: imp
Sponsored by: The FreeBSD Foundation

3 years agocache: fix trailing slash support in face of permission problems
Mateusz Guzik [Tue, 2 Feb 2021 18:06:56 +0000 (18:06 +0000)]
cache: fix trailing slash support in face of permission problems

Reported by: Johan Hendriks <joh.hendriks gmail.com>
Tested by: kevans

3 years agorelease: update workaround during transition to git
Glen Barber [Tue, 2 Feb 2021 17:19:36 +0000 (12:19 -0500)]
release: update workaround during transition to git

PR: 253181
Submitted by: Yasuhiro Kimura
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agosrc.conf.5: regenerate
Konstantin Belousov [Tue, 2 Feb 2021 16:48:08 +0000 (18:48 +0200)]
src.conf.5: regenerate

3 years agoWITH_OFED build option: fix
Konstantin Belousov [Tue, 2 Feb 2021 13:01:26 +0000 (15:01 +0200)]
WITH_OFED build option: fix

Userspace has OFED build enabled for quite some time, but kernel modules
were not. This is useless config because any userspace IB code requires
kernel support. So enable modules build by default.

Move WITH_OFED to WITHOUT_OFED since defaults are now enabled.

Reviewed by: emaste, hselasky, kevans
MFC after: 3 days
Sponsored by: NVidia Networking / Mellanox Technologies
Differential Revision: https://reviews.freebsd.org/D28460

3 years agoUse compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux
Edward Tomasz Napierala [Tue, 2 Feb 2021 14:40:38 +0000 (14:40 +0000)]
Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux

In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs
are hardcoded to "/compat/linux".  Switching to the content of
compat.linux.emul_path sysctl would allow to switch linuxulator
to different place.

Submitted by: freebsdnewbie_freenet.de
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27807

3 years agortld: Fix null-pointer dereference
David Chisnall [Tue, 2 Feb 2021 14:06:33 +0000 (16:06 +0200)]
rtld: Fix null-pointer dereference

When a library is opened via fdlopen, it has a null pointer for its path
and so _rtld_bind can crash as a result of passing the null pointer to
basename() (which passes it to strrchr(), which doesn't do a null check).

PR: 253081
Submitted by: theraven
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28442

3 years agoRegister the bad read before bailing on terminal errors.
Poul-Henning Kamp [Tue, 2 Feb 2021 12:01:38 +0000 (12:01 +0000)]
Register the bad read before bailing on terminal errors.

This way running recoverdisk in a loop will not get stuck on a bad
block which causes the disk or SD card detach.

3 years agotests/sys/audit: Skip extattr tests if extattrs are not supported
Alex Richardson [Tue, 2 Feb 2021 09:55:18 +0000 (09:55 +0000)]
tests/sys/audit: Skip extattr tests if extattrs are not supported

In the CheriBSD CI, we run the testsuite with /tmp as tmpfs. This causes
the extattr audit tests to fail since tmpfs does not (yet) support
extattrs. Skip those tests if the target path is on a file system that
does not support extended file attributes.

While touching these two files also convert the ATF_REQUIRE_EQ(-1, ...)
checks to use ATF_REQURIE_ERRNO().

Reviewed By: asomers
Differential Revision: https://reviews.freebsd.org/D28392

3 years agotests/sys/kern/crc32: Check for SSE4.2 before using it
Alex Richardson [Tue, 2 Feb 2021 09:52:52 +0000 (09:52 +0000)]
tests/sys/kern/crc32: Check for SSE4.2 before using it

This avoids a SIGILL when running these tests on QEMU (which
defaults to a basic amd64 CPU without SSE4.2).

This commit also tests the table-based implementations in addition to
testing the hw-accelerated crc32 versions.

Reviewed By: cem, kib, markj
Differential Revision: https://reviews.freebsd.org/D28395

3 years agoRevert "diff: eliminate a useless lseek"
Baptiste Daroussin [Tue, 2 Feb 2021 09:07:57 +0000 (10:07 +0100)]
Revert "diff: eliminate a useless lseek"

This changes breaks when one of the files is stdin

This reverts commit fa977a3b2bb2d0e6c2957b14474c31b58dd3a8e1.

Reported by: olivier

3 years agobhyve/ioapic: improve the tracking of IRR bit
Roger Pau Monné [Tue, 19 Jan 2021 11:52:28 +0000 (12:52 +0100)]
bhyve/ioapic: improve the tracking of IRR bit

One common method of EOI'ing an interrupt at the IO-APIC level is to
switch the pin to edge triggering mode and then back into level mode.
That would cause the IRR bit to be cleared and thus further interrupts
to be injected. FreeBSD does indeed use that method if the IO-APIC EOI
register is not supported.

The bhyve IO-APIC emulation code didn't clear the IRR bit when doing
that switch, and was also missing acknowledging the IRR state when
trying to inject an interrupt in vioapic_send_intr.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28238

3 years agobhyve/ioapic: only account for asserted line in level mode
Roger Pau Monné [Tue, 19 Jan 2021 12:41:03 +0000 (13:41 +0100)]
bhyve/ioapic: only account for asserted line in level mode

After modifying a redirection entry only try to inject an interrupt if
the pin is in level mode, pins in edge mode shouldn't take into
account the line assert status as they are triggered by edge changes,
not the line status itself.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28237

3 years agobhyve/vioapic: remove an extra pin masked check
Roger Pau Monné [Tue, 19 Jan 2021 11:52:44 +0000 (12:52 +0100)]
bhyve/vioapic: remove an extra pin masked check

vioapic_send_intr does already check whether the pin is masked before
injecting the interrupt, there's no need to do it in vioapic_write
also.

No functional change intended.

Reviewed by: grehan
Differential revision: https://reviews.freebsd.org/D28236

3 years agoReplace the redundant MENTAT macro with SOLARIS.
Cy Schubert [Thu, 28 Jan 2021 05:50:04 +0000 (21:50 -0800)]
Replace the redundant MENTAT macro with SOLARIS.

MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

MFC after: 1 week

3 years agoIndentation cleanup resulting from the cleanup of #ifdefs.
Cy Schubert [Wed, 27 Jan 2021 15:25:00 +0000 (07:25 -0800)]
Indentation cleanup resulting from the cleanup of #ifdefs.

The conscious decision was made not to perform any indentation or
whitespace cleanup while cleaning out old redunant #ifdefs. The
reason for this was to avoid confusing future readers of history and
diffs with cosmetic changes, making bisection of any possible bugs
introduced more difficult. This commit cleans up the whitespace
detritus left behind from the previous #ifdef cleanup commits.

MFC after: 1 week

3 years agoRetire the K&R/STD C __P prototype declarations.
Cy Schubert [Tue, 26 Jan 2021 06:24:28 +0000 (22:24 -0800)]
Retire the K&R/STD C __P prototype declarations.

In the old days when K&R C and STD C were each in use a workaround
(read hack) was required to allow the same code to work on each
without modification. All C compilers support STD C. We can finally
put the __P prototype to rest.

MFC after: 1 week

3 years agoBump shared library versions after ncurses bump in 13.
John Baldwin [Tue, 2 Feb 2021 01:09:33 +0000 (17:09 -0800)]
Bump shared library versions after ncurses bump in 13.

A few shared libraries in the base system link against ncurses.  An
upgrade from a 12.x host to 13 results in ABI breakage for existing
binaries since the newer versions of these libraries link against the
newer ncurses while the binary itself links against the older ncurses.
For example, dialog4ports built on 12.x sometimes crashes on 13 since
it depends on libdialog which links against ncurses internally.

MFC after: 3 days
Reviewed by: kib, delphij
Differential Revision: https://reviews.freebsd.org/D28448

3 years agotail: fix "tail -F" file rotation detection
Chuck Silvers [Tue, 2 Feb 2021 00:21:14 +0000 (16:21 -0800)]
tail: fix "tail -F" file rotation detection

When checking if the newly opened file is the same as the old one,
we need to fstat() the new file descriptor, not the old one again.

Reviewed by: glebius
Sponsored by: Netflix

3 years agovt: parse_font_info_static should set refcount, not parse_font_info
Toomas Soome [Sun, 31 Jan 2021 21:04:59 +0000 (23:04 +0200)]
vt: parse_font_info_static should set refcount, not parse_font_info

As we get started with no memory allocator, we set up static font data
for font passed by loader (if there is any). At this time, we also must
set refcount 1, and refcount will get incremented in cnprobe() callback.

At some point the memory allocator will be available, and we will set up
properly allocated font data, but we should not disturb the refcount.

PR: 253147

3 years agozfs: update zfs_config.h to match OpenZFS gf11b09dec
Martin Matuska [Mon, 1 Feb 2021 21:08:19 +0000 (22:08 +0100)]
zfs: update zfs_config.h to match OpenZFS gf11b09dec

Update zfs_config.h to match latest merge in FreeBSD

The version string is declared as 2.0.0-FreeBSD_gf11b09dec to provide
more information about the loaded module:
- the OpenZFS version in base is 2.0
- we are using the in tree-module ("FreeBSD")
- the last merged OpenZFS git revision ("gf11b09dec")

With future merges the git revision tag should be updated.
As we are merging from OpenZFS master branch and already include features
like dRAID, referencing patchlevel releases (2.0.1, 2.0.2) is pointless.

Reviewed by: freqlabs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28447

3 years agoconfig: Fix typo in comment.
John Baldwin [Mon, 1 Feb 2021 21:13:36 +0000 (13:13 -0800)]
config: Fix typo in comment.

3 years agoipfw(8) crashes when ext6hdr option is omitted
Evgeniy Khramtsov [Mon, 1 Feb 2021 19:03:57 +0000 (20:03 +0100)]
ipfw(8) crashes when ext6hdr option is omitted

Verify that the option is passed, error out if it's not.
The problem can be trivially triggered with `ipfw add allow ext6hdr`.

PR: 253169
Reviewed by: kp@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28447

3 years agoiflib: Free resources in a consistent order during detach
Sai Rajesh Tallamraju [Mon, 1 Feb 2021 16:13:00 +0000 (11:13 -0500)]
iflib: Free resources in a consistent order during detach

Memory and PCI resources are freed with no particular order.  This could
cause use-after-frees when detaching following a failed attach.  For
instance, iflib_tx_structures_free() frees ctx->ifc_txqs[] but
iflib_tqg_detach() attempts to access this array. Similarly, adapter
queues gets freed by IFDI_QUEUES_FREE() but IFDI_DETACH() attempts to
access adapter queues to free PCI resources.

MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D27634

3 years agostand/amd64: remove unused addr parameter from bi_load64
Roger Pau Monné [Fri, 29 Jan 2021 11:29:37 +0000 (12:29 +0100)]
stand/amd64: remove unused addr parameter from bi_load64

All callers of bi_load64 pass 0 as the addr parameter, so just remove
it and always calculate the last load address from the module chain.

No functional change.

Sponsored by: Citrix Systems R&D
Reviewed by: tsoome, imp
Differential revision: https://reviews.freebsd.org/D28412

3 years agosrc.conf(5): regenerate after MK_ZFS change
Mitchell Horne [Mon, 1 Feb 2021 14:34:11 +0000 (10:34 -0400)]
src.conf(5): regenerate after MK_ZFS change

With e5cc1c474841, this option is also disabled by WITHOUT_OPENSSL and
WITHOUT_CRYPT.

3 years agosrc.opts.mk: set MK_ZFS conditional on MK_OPENSSL
Mitchell Horne [Sat, 30 Jan 2021 19:04:08 +0000 (15:04 -0400)]
src.opts.mk: set MK_ZFS conditional on MK_OPENSSL

libzfs has a dependency on libcrypto. This causes a buildworld link
failure when WITHOUT_OPENSSL/WITHOUT_CRYPT is set.

This dependency was added implicitly by the switch to OpenZFS, and
explicitly in 40d0fd287510 and cd568e2b1b67.

PR: 252841
Reviewed by: kevans, freqlabs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28431

3 years agobridge: fix STP roles and protos strings
Jonah Caplan [Sat, 30 Jan 2021 13:54:09 +0000 (14:54 +0100)]
bridge: fix STP roles and protos strings

Add the missing commas that got lost in e5539fb618cc7.

PR: 252532
Reviewd by: kp@, donner@, freqlabs@
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D28425

3 years agoarm64: Improve DDB backtrace support
Jessica Clarke [Mon, 1 Feb 2021 14:15:57 +0000 (14:15 +0000)]
arm64: Improve DDB backtrace support

The existing implementation relies on each trap handler saving a normal
stack frame record, which is a waste of time and space when we're
already saving a trapframe to the stack. It's also wrong as it currently
saves LR not ELR.

Instead of patching it up, rewrite it based on the RISC-V implementation
with inspiration from the amd64 implementation for how to handle
vectored traps to provide an improved implementation. This includes
compressing the information down to one line like other architectures
rather than the highly-verbose old form that repeats itself by printing
LR and FP in one frame only to print them as PC and SP in the next. It
also includes printing out actually useful information about the traps
that occurred, though FAR is not saved in the trapframe so we cannot
print it (in general it can be clobbered between when the trap happened
and now), only ESR.

The AAPCS also allows the stack frame record to be located anywhere in
the frame, not just the top, so the caller's SP is not at a fixed offset
from the callee's FP like on almost all other architectures in
existence. This means there is no way to derive the caller's SP in the
unwinder, and so we have to drop that bit of (unused) state everywhere.

Reviewed by: jhb, markj
Differential Revision: https://reviews.freebsd.org/D28026

3 years agoFix LINT kernel builds after 1a714ff20419 .
Hans Petter Selasky [Mon, 1 Feb 2021 12:23:21 +0000 (13:23 +0100)]
Fix LINT kernel builds after 1a714ff20419 .

MFC after: 1 week
Discussed with: rrs@
Differential Revision:  https://reviews.freebsd.org/D28357
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agosctp: small cleanup, no functional change intended.
Michael Tuexen [Mon, 1 Feb 2021 13:03:41 +0000 (14:03 +0100)]
sctp: small cleanup, no functional change intended.

MFC after: 3 days

3 years agozfs: remove incomplete ifdefs for lockless symlink support
Mateusz Guzik [Mon, 1 Feb 2021 12:18:27 +0000 (13:18 +0100)]
zfs: remove incomplete ifdefs for lockless symlink support

This wil be handled differently upstream and merged later.

3 years agocxgbe(4): Fixes to tx coalescing.
Navdeep Parhar [Mon, 1 Feb 2021 11:00:09 +0000 (03:00 -0800)]
cxgbe(4): Fixes to tx coalescing.

- The behavior implemented in r362905 resulted in delayed transmission
  of packets in some cases, causing performance issues.  Use a different
  heuristic to predict tx requests.

- Add a tunable/sysctl (hw.cxgbe.tx_coalesce) to disable tx coalescing
  entirely.  It can be changed at any time.  There is no change in
  default behavior.

3 years agoRemove the MK_LIBCPLUSPLUS option
Alex Richardson [Sat, 30 Jan 2021 17:56:35 +0000 (17:56 +0000)]
Remove the MK_LIBCPLUSPLUS option

This option has been equivalent to any form of C++ support since libstdc++
was removed. Therefore, replace all MK_LIBCPLUSPLUS uses with MK_CXX.

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D27974

3 years agomips: fix NLM platforms breakage caused by e0a0a3ef
Oleksandr Tymoshenko [Mon, 1 Feb 2021 07:56:22 +0000 (23:56 -0800)]
mips: fix NLM platforms breakage caused by e0a0a3ef

NetLogic platforms have their own implementation of cpu_init_interrupts.
Apply the same logic to it as to intr_machdep.c.

PR: 253051

3 years agox86: use compiler intrinsics for bswap*
Mateusz Guzik [Mon, 1 Feb 2021 03:00:13 +0000 (04:00 +0100)]
x86: use compiler intrinsics for bswap*

3 years agoamd64: use compiler intrinsics for bsf* and bsr*
Mateusz Guzik [Sun, 31 Jan 2021 23:35:30 +0000 (00:35 +0100)]
amd64: use compiler intrinsics for bsf* and bsr*

3 years agocache: add delayed degenerate path handling
Mateusz Guzik [Sun, 31 Jan 2021 20:54:35 +0000 (21:54 +0100)]
cache: add delayed degenerate path handling

3 years agocache: move hash computation into the parsing loop
Mateusz Guzik [Sun, 31 Jan 2021 18:25:18 +0000 (19:25 +0100)]
cache: move hash computation into the parsing loop

3 years agosctp: improve input validation
Michael Tuexen [Sun, 31 Jan 2021 22:43:15 +0000 (23:43 +0100)]
sctp: improve input validation

Improve the handling of INIT chunks in specific szenarios and
report and appropriate error cause.
Thanks to Anatoly Korniltsev for reporting the issue for the
userland stack.

MFC after: 3 days

3 years agomips: fix early kernel panic when setting up interrupt counters
Oleksandr Tymoshenko [Sat, 30 Jan 2021 06:11:24 +0000 (22:11 -0800)]
mips: fix early kernel panic when setting up interrupt counters

Commit 248f0ca converted intrcnt and intrnames from u_long[]
and char[] to u_long* and char* respectively, but for non-INTRNG mips
these symbols were defined in .S file as a pre-allocated static arrays,
so the problem wasn't cought at compile time. Conversion from an array
to a pointer requires pointer initialization and it wasn't done
for MIPS, so whatever happenned to be in the begginning of intcnt[]
array was used as a pointer value.

Move intrcnt/intrnames to C code and allocate them dynamically
although with a fixed size at the moment.

Reviewed by: emaste
PR: 253051
Differential Revision: https://reviews.freebsd.org/D28424
MFC after: 1 day

3 years agolibc: fix buffer overrun in getrpcport(3)
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:41:55 +0000 (21:41 +0000)]
libc: fix buffer overrun in getrpcport(3)

Reviewed By: markj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27332

3 years agomsdosfs: fix vnode leak with msdosfs_rename()
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:37:41 +0000 (21:37 +0000)]
msdosfs: fix vnode leak with msdosfs_rename()

This could happen when failing due to disappearing source file.

Reviewed By: kib
Tested by: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27338

3 years agomsdosfs: fix double unlock if the source file disappears
Edward Tomasz Napierala [Sun, 31 Jan 2021 21:07:02 +0000 (21:07 +0000)]
msdosfs: fix double unlock if the source file disappears

We would unlock fvp here, only to unlock it again below,
just before "bad".

Reviewed By: kib
Tested by: pho
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27339

3 years agoMerge commit '47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc'
Stefan Eßer [Sun, 31 Jan 2021 20:07:42 +0000 (21:07 +0100)]
Merge commit '47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc'

Update to version 3.2.6

MFC after: 3 days

3 years agoVendor import of Gavin Howard's bc version 3.2.6
Stefan Eßer [Sun, 31 Jan 2021 19:56:48 +0000 (20:56 +0100)]
Vendor import of Gavin Howard's bc version 3.2.6

3 years agocxgb(4): Remove assumption of physically contiguous mbufs.
Alexander Motin [Sun, 31 Jan 2021 17:46:57 +0000 (12:46 -0500)]
cxgb(4): Remove assumption of physically contiguous mbufs.

Investigation of iSCSI target data corruption reports brought me to
discovery that cxgb(4) expects mbufs to be physically contiguous, that
is not true after I've started using m_extaddref() in software iSCSI
for large zero-copy transmissions.  In case of fragmented memory the
driver transmitted garbage from pages following the first one due to
simple use of pmap_kextract() for the first pointer instead of proper
bus_dmamap_load_mbuf_sg().  Seems like it was done as some optimization
many years ago, and at very least it is wrong in a world of IOMMUs.

This patch just removes that optimization, plus limits packet coalescing
for mbufs crossing page boundary, also depending on assumption of one
segment per packet.

MFC after: 3 days
Sponsored by: iXsystems, Inc.
Reviewed by: mmacy, np
Differential revision: https://reviews.freebsd.org/D28428

3 years agotools: boot: use four jobs for building stand
Kyle Evans [Sun, 31 Jan 2021 16:07:31 +0000 (10:07 -0600)]
tools: boot: use four jobs for building stand

Parallel builds of stand should be assumed both possible and safe as of
7012461c9bf6, so let's start using some jobs to speed up lualoader test
harness builds.

3 years agoamd64: move memcmp checks upfront
Mateusz Guzik [Sun, 31 Jan 2021 15:46:18 +0000 (16:46 +0100)]
amd64: move memcmp checks upfront

This is a tradeoff which saves jumps for smaller sizes while making
the 8-16 range slower (roughly in line with the other cases).

Tested with glibc test suite.

For example size 3 (most common with vfs namecache) (ops/s):
before: 407086026
after: 461391995

The regressed range of 8-16 (with 8 as example):
before: 540850489
after: 461671032

3 years agoamd64: add a note about simd to libc memset, memmove and memcmp
Mateusz Guzik [Sun, 31 Jan 2021 15:50:34 +0000 (16:50 +0100)]
amd64: add a note about simd to libc memset, memmove and memcmp

3 years agoDrop temporary compat in setproctitle
Mateusz Guzik [Sun, 31 Jan 2021 12:23:42 +0000 (13:23 +0100)]
Drop temporary compat in setproctitle

3 years agolualoader: position hyphens at the beginning of character classes
Kyle Evans [Sun, 31 Jan 2021 15:51:39 +0000 (09:51 -0600)]
lualoader: position hyphens at the beginning of character classes

According to the Lua 5.4 manual section 6.4.1 ("Patterns"), the interaction
between ranges and classes is not defined and hyphens must be specified at
either the beginning or the end of a set if they are not escaped.

Move all such occurrences to the beginning.

Reported-by: _parv (twitter)
MFC-after: 3 days

3 years agocache: add trailing slash support
Mateusz Guzik [Tue, 26 Jan 2021 00:38:21 +0000 (01:38 +0100)]
cache: add trailing slash support

Tested by: pho

3 years agocache: handle NOFOLLOW requests for symlinks
Mateusz Guzik [Tue, 26 Jan 2021 22:14:49 +0000 (23:14 +0100)]
cache: handle NOFOLLOW requests for symlinks

Tested by: pho

3 years agoUse process fib for inet/inet6 fib_algo sysctls.
Alexander V. Chernikov [Sun, 31 Jan 2021 10:48:47 +0000 (10:48 +0000)]
Use process fib for inet/inet6 fib_algo sysctls.

This allows to set/query fib algo for non-default fibs.

MFC after: 3 days

3 years agosctp: fix a locking issue for old unordered data
Michael Tuexen [Sun, 31 Jan 2021 09:46:23 +0000 (10:46 +0100)]
sctp: fix a locking issue for old unordered data

Thanks to Anatoly Korniltsev for reporting the issue for the
userland stack.

MFC after: 3 days

3 years agoFix the design problem with delayed algorithm sync.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:45:46 +0000 (22:45 +0000)]
Fix the design problem with delayed algorithm sync.

Currently, if the immutable algorithm like bsearch or radix_lockless
 receives rtable update notification, it schedules algorithm rebuild.
This rebuild is executed by the callout after ~50 milliseconds.

It is possible that a script adding an interface address and than route
 with the gateway bound to that address will fail. It can happen due
 to the fact that fib is not updated by the time the route addition
 request arrives.

Fix this by allowing synchronous algorithm rebuilds based on certain
 conditions. By default, these conditions assume:
1) less than net.route.algo.fib_sync_limit=100 routes
2) routes without gateway.

* Move algo instance build entirely under rib WLOCK.
 Rib lock is only used for control plane (except radix algo, but there
  are no rebuilds).
* Add rib_walk_ext_locked() function to allow RIB iteration with
 rib lock already held.
* Fix rare potential callout use-after-free for fds by binding fd
 callout to the relevant rib rmlock. In that case, callout_stop()
 under rib WLOCK guarantees no callout will be executed afterwards.

MFC after: 3 days

3 years agoAdd rib_subscribe_locked() and rib_unsubsribe_locked() to support
Alexander V. Chernikov [Sat, 30 Jan 2021 21:52:44 +0000 (21:52 +0000)]
Add rib_subscribe_locked() and rib_unsubsribe_locked() to support
 subscriptions during RIB modifications.
Add new subscriptions to the beginning of the lists instead of
 the end. This fixes the situation when new subscription is created
 int the callback for the existing subscription, leading to the
 subscription notification handler pick it.

MFC after: 3 days

3 years agoMove business logic from rebuild_fd_callout() into rebuild_fd().
Alexander V. Chernikov [Sat, 30 Jan 2021 22:32:42 +0000 (22:32 +0000)]
Move business logic from rebuild_fd_callout() into rebuild_fd().

This simplifies code a bit and allows for future non-callout
 callers to request rebuild.

MFC after: 3 days

3 years agoImprove fib_algo debug messages.
Alexander V. Chernikov [Sat, 30 Jan 2021 22:06:40 +0000 (22:06 +0000)]
Improve fib_algo debug messages.

* Move per-prefix debug lines under LOG_DEBUG2
* Create fib instance counter to distingush log messages between
 instances
* Add more messages on rebuild reason.

MFC after: 3 days

3 years agoFix unused-function waring when compiling with FIB_ALGO.
Alexander V. Chernikov [Sat, 30 Jan 2021 23:24:26 +0000 (23:24 +0000)]
Fix unused-function waring when compiling with FIB_ALGO.

MFC after: 3 days

3 years agouserboot: provide stub gfx functions
Toomas Soome [Sat, 30 Jan 2021 19:16:20 +0000 (21:16 +0200)]
userboot: provide stub gfx functions

Make sure we have needed functions present, to avoi getting undefined
symbols error(s).

PR: 253088
Reported by: John Kennedy

3 years agoLinuxKPI: add module dependency on firmware(9)
Bjoern A. Zeeb [Sat, 30 Jan 2021 17:50:26 +0000 (17:50 +0000)]
LinuxKPI: add module dependency on firmware(9)

In a6c2507d1baedb183268e31bc6b6f659a9529904 support for LinuxKPI
firmware loading was added.  Record the dependency on firmware(9)
as otherwise (if built as module) linuxkpi will no longer load.

Reported-by: tijl
MFC after: 1 day
X-MFC-with: a6c2507d1baedb183268e31bc6b6f659a9529904
Sponsored-by: The FreeBSD Foundation

3 years agoRemove unused GNUCXX option descriptions
Ed Maste [Sat, 30 Jan 2021 17:43:42 +0000 (12:43 -0500)]
Remove unused GNUCXX option descriptions

Missed from 57f804675e65

Reported by: arhchardson in D27974
Sponsored by: The FreeBSD Foundation

3 years agog_provider_by_name(9): argument can be a geom name or fullpath
Robert Wing [Fri, 29 Jan 2021 23:18:28 +0000 (14:18 -0900)]
g_provider_by_name(9): argument can be a geom name or fullpath

The argument passed to g_provider_by_name(9) can be a geom name or a
fullpath.

- g_provider_by_name() gained this functionality in
  769afdc71ea6b0c09dae883ce49d913cbc8cff5b.

Reviewed by:    imp, kevans
Approved by:    kevans (mentor)
Differential Revision:  https://reviews.freebsd.org/D27566

3 years agobuild: options: mention ports in the WITH_OPENLDAP description
Kyle Evans [Sat, 30 Jan 2021 06:09:10 +0000 (00:09 -0600)]
build: options: mention ports in the WITH_OPENLDAP description

There's a third party dependency on this option; currently,
net/openldap24-{,sasl-}client.  At least mention that an openldap from ports
is needed for this option.

PR: 252866
Reported-by: Build Option Survey via Michael Dexter
MFC-after: 3 days

3 years agoRevert 2d4422e7991a, Eliminate lock order reversal in UFS ffs_unmount().
Kirk McKusick [Sat, 30 Jan 2021 08:03:37 +0000 (00:03 -0800)]
Revert 2d4422e7991a, Eliminate lock order reversal in UFS ffs_unmount().

After discussion with Chuck Silvers (chs@) we have decided that
there is a better way to resolve this lock order reversal which
will be committed separately.

Sponsored by: Netflix

3 years agokerberos5: fix the WITH_OPENLDAP build
Kyle Evans [Sat, 30 Jan 2021 06:07:17 +0000 (00:07 -0600)]
kerberos5: fix the WITH_OPENLDAP build

Restore WARNS to its former glory prior to the global WARNS change to fix
the build.

MFC-after: 3 days

3 years agoofed: fix the WITH_OFED_EXTRA build
Kyle Evans [Sat, 30 Jan 2021 05:48:28 +0000 (23:48 -0600)]
ofed: fix the WITH_OFED_EXTRA build

This option was not tested when WARNS was globally lifted in the src tree up
to 6.  Drop WARNS back down to unbreak the build; note that this is still
enabling more warnings than it had before the WARNS change, so the gcc build
may need to be independently evaluated at this level.

PR: 252865
Reported-by: Build Option Servey via Michael Dexter
MFC-after: 3 days

3 years agoacpica: Import ACPICA 20210105.
Jung-uk Kim [Wed, 6 Jan 2021 03:13:30 +0000 (22:13 -0500)]
acpica: Import ACPICA 20210105.

(cherry picked from commit a61ec1492c58c40bd0d968794c380668c157e2ef)

3 years agoacpica: Import ACPICA 20201217.
Jung-uk Kim [Mon, 4 Jan 2021 22:20:55 +0000 (17:20 -0500)]
acpica: Import ACPICA 20201217.

(cherry picked from commit a4634ed7779f0905e3bfeb781e58d40a5bdf9bb7)

3 years agoamd64: retire sse2_pagezero
Mateusz Guzik [Sat, 30 Jan 2021 00:17:15 +0000 (00:17 +0000)]
amd64: retire sse2_pagezero

All page zeroing is using temporal stores with rep movs*, the routine is
unused for several years.

Should a need arise for zeroing using non-temporal stores, a more
optimized variant can be implemented with a more descriptive name.

3 years agoamd64: add missing ALIGN_TEXT to loops in memset and memmove
Mateusz Guzik [Fri, 29 Jan 2021 15:09:14 +0000 (16:09 +0100)]
amd64: add missing ALIGN_TEXT to loops in memset and memmove

3 years agoReimplement strlen
Mateusz Guzik [Fri, 29 Jan 2021 21:48:11 +0000 (22:48 +0100)]
Reimplement strlen

The previous code neglected to use primitives which can find the end
of the string without having to branch on every character.

While here augment the somewhat misleading commentary -- strlen as
implemented here leaves performance on the table, especially so for
userspace. Every arch should get a dedicated variant instead.

In the meantime this commit lessens the problem.

Tested with glibc test suite.

Naive test just calling strlen in a loop on Haswell (ops/s):

$(perl -e "print 'A' x 3"):
before: 211198039
after: 338626619

$(perl -e "print 'A' x 100"):
before: 83151997
after: 98285919

3 years agoFix multipath support for rib_lookup_info().
Alexander V. Chernikov [Fri, 29 Jan 2021 23:10:52 +0000 (23:10 +0000)]
Fix multipath support for rib_lookup_info().

The initial plan was to remove rib_lookup_info() before
 FreeBSD 13. As several customers are still remaining,
 fix rib_lookup_info() for the multipath use case.

3 years agoFix subinterface vlan creation.
Alexander V. Chernikov [Tue, 26 Jan 2021 07:22:23 +0000 (07:22 +0000)]
Fix subinterface vlan creation.

D26436 introduced support for stacked vlans that changed the way vlans
 are configured.  In particular, this change broke setups that have
 same-number vlans as subinterfaces.

Vlan support was initially created assuming "vlanX" semantics. In this paradigm,
 automatic number assignment supported by cloning (ifconfig vlan create) was a
 natural fit.
When "ifaceX.Y" support was added, allowing to have the same vlan number on
 multiple devices, cloning code became more complex, as the is no
unified "vlan" namespace anymore. Such interfaces got the first spare
index from "vlan" cloner. This, in turn, led to the following problem:
 ifconfig ix0.333 create -> index 1
 ifconfig ix0.444 create -> index 2
 ifconfig vlan2 create -> allocation failure

This change fixes such allocations by using cloning indexes only for
 "vlanX" interfaces.

Reviewed by:            hselasky
MFC after: 3 days
Differential Revision:  https://reviews.freebsd.org/D27505