]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoifconfig: properly detect invalid mediaopt keywords.
Konstantin Belousov [Mon, 2 Nov 2020 21:47:34 +0000 (21:47 +0000)]
ifconfig: properly detect invalid mediaopt keywords.

When invalid keyword is specified, ifconfig(8) is silent about it,
instead random request is sent to the driver.

Before the patch:
root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause
ifconfig: SIOCSIFMEDIA (media): Device not configured

After:
root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause
ifconfig: unknown option: -txpause

Reviewed by: hselasky, kp
Sponsored by: Mellanox Technologies / NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27060

3 years agorelease: Add an image for CI
Emmanuel Vadot [Mon, 2 Nov 2020 21:10:49 +0000 (21:10 +0000)]
release: Add an image for CI

A lot of projects CI can't do FreeBSD tests currently.
The main reason is that the project CI infrastructure is runned on Linux
and that our images aren't modifiable from a Linux hosts.
Add a basic image specific for this case (called BASIC-CI for a lack of a
better name).
The image have no package pre-installed.
It only have a few modification to have dhcp client runned on the default
interface and sshd started with option to be able to log on without a password
as root.

Sponsored by: The FreeBSD Foundation

Reviewed by: re (gjb@)
Differential Revision: https://reviews.freebsd.org/D25598

3 years agoAdd routines for ARM System MMU (SMMU) pmap management.
Ruslan Bukin [Mon, 2 Nov 2020 19:56:15 +0000 (19:56 +0000)]
Add routines for ARM System MMU (SMMU) pmap management.

Reviewed by: markj
Discussed with: kib
Sponsored by: DARPA, Innovate UK
Differential Revision: https://reviews.freebsd.org/D26877

3 years agoTidy up the #includes. Recent changes, such as the introduction of
Alan Cox [Mon, 2 Nov 2020 19:20:06 +0000 (19:20 +0000)]
Tidy up the #includes.  Recent changes, such as the introduction of
VM_ALLOC_WAITOK and vm_page_unwire_noq(), have eliminated the need for
many of the #includes.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D27052

3 years agoRe-arrange some of the code to separate writable user tree variables from
Stefan Eßer [Mon, 2 Nov 2020 18:48:06 +0000 (18:48 +0000)]
Re-arrange some of the code to separate writable user tree variables from
R/O variables.

While here fix some nearby style. No functional change intended.

MFC after: 1 month

3 years agolinux(4): Quiesce unrecognized ioctl warning for F2FS query
Conrad Meyer [Mon, 2 Nov 2020 18:45:43 +0000 (18:45 +0000)]
linux(4): Quiesce unrecognized ioctl warning for F2FS query

On Linux, sqlite probes for underlying F2FS filesystems that support
certain kinds of atomic update with this ioctl.  The expected result on
non-F2FS filesystem (i.e., all FreeBSD filesystems) is any error value.

Minimally implement the ioctl and avoid the warning message.

(This shows up in Linux Chrome, which embeds sqlite.)

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27050

3 years agolinux(4): Deduplicate ioctl range construction with a helper macro
Conrad Meyer [Mon, 2 Nov 2020 18:45:15 +0000 (18:45 +0000)]
linux(4): Deduplicate ioctl range construction with a helper macro

No functional change.

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27049

3 years agopkgbase: Add incremental packages
Emmanuel Vadot [Mon, 2 Nov 2020 18:23:50 +0000 (18:23 +0000)]
pkgbase: Add incremental packages

This adds a new target update-packages which will create the new packages
compared to the last run.

This is how to use it:
At this point we cut a release
$ make buildworld ...
$ make buildkernel
$ make packages

    There is now a PKG_VERSION directory with latest link pointing to it
    Distribute the packages to server

$ something something that update the source tree
$ make buildworld ...
$ make buildkernel
$ make update-packages
You know have a PKG_VERSION directory in the REPODIR and latest link pointing to it.
In PKG_VERSION dir only the packages which differs from the latest run are
named PKG_VERSION, otherwise the old packages are there.

The process is :
Build the new packages in the PKG_VERSION directory
Compare the internal data with the PKG_VERSION_FROM version. The comparison is done
by checking the internal hash of the packages.
By default PKG_VERSION_FROM is set to what the latest link points to.
If the old and new version matches, we rm the new package and cp the old one.

Differential Revision: https://reviews.freebsd.org/D25984

3 years agozfs: zstd: short-circuit cleaning buffers if none exist
Mateusz Guzik [Mon, 2 Nov 2020 17:39:59 +0000 (17:39 +0000)]
zfs: zstd: short-circuit cleaning buffers if none exist

This avoids a barrage of locking every minute.

3 years agomalloc: prefix zones with malloc-
Mateusz Guzik [Mon, 2 Nov 2020 17:39:15 +0000 (17:39 +0000)]
malloc: prefix zones with malloc-

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

3 years agomalloc: export kernel zones instead of relying on them being power-of-2
Mateusz Guzik [Mon, 2 Nov 2020 17:38:08 +0000 (17:38 +0000)]
malloc: export kernel zones instead of relying on them being power-of-2

Reviewed by: markj (previous version)
Differential Revision: https://reviews.freebsd.org/D27026

3 years ago[libnetmap] Fix 32 bit compilation under gcc-6.4
Adrian Chadd [Mon, 2 Nov 2020 15:01:37 +0000 (15:01 +0000)]
[libnetmap] Fix 32 bit compilation under gcc-6.4

Use uintptr_t to cast a uint64_t to a pointer type.
Yeah, it isn't technically correct for platforms with pointers
> 64 bits, but it's fine here.

This fixes 32 bit compat library builds on amd64 and also
mips32 builds.

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

3 years agoFix for referencing file via its vnode in ibore.
Hans Petter Selasky [Mon, 2 Nov 2020 10:44:29 +0000 (10:44 +0000)]
Fix for referencing file via its vnode in ibore.

Use the native vnode lookup functions, instead of going via the LinuxKPI,
because the file referenced is typically created outside the LinuxKPI, and
the LinuxKPI's fdget() can only resolve file descriptor numbers which
were created by itself.

The vnode pointer is used as an identifier to identify XRCD handles which
are sharing resources.

This patch fixes the so-called XRCD support in ibcore for FreeBSD.
Refer to ibv_open_xrcd(3) for more information how the file descriptor
argument is used.

Reviewed by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoImprove loading of multipage aligned buffers.
Michal Meloun [Mon, 2 Nov 2020 08:26:19 +0000 (08:26 +0000)]
Improve loading of multipage aligned buffers.

The multipage alignment requirements is incompatible with many aspects
of actual busdma code. Multi-page alignment requests are incompatible
with many aspects of current busdma code. Mainly with partially bounced
buffer segments and per-page loop in bus_dmamap_load_buffer(). Because
proper implementation would be a major restructuring of the code, add
the fix only for already known uses and do KASSERT for all other cases.

For this reason, bus_dmamap_load_buffer () should take the memory allocated
by bus_dmam_alloc () as one segment bypassing per page segmentation. We can
do this because it is guaranteed that the memory is physically continuous.

Reviewed by: bz
Tested by:  imp, mv, daniel.engberg.lists_pyret.net, kjopek_gmail.com
Differential Revision: https://reviews.freebsd.org/D26735

3 years agolinux(4): Disambiguate identical ioctl errors in distinct paths
Conrad Meyer [Mon, 2 Nov 2020 06:16:11 +0000 (06:16 +0000)]
linux(4): Disambiguate identical ioctl errors in distinct paths

And stop truncating the full ioctl number in the error message.

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

3 years agoAdd icc (Isochronous Command Completion) ccb_ataio field.
Alexander Motin [Mon, 2 Nov 2020 01:01:41 +0000 (01:01 +0000)]
Add icc (Isochronous Command Completion) ccb_ataio field.

MFC after: 1 week

3 years agoifconfig.8: Improve formatting of -f in synopsis
Mateusz Piotrowski [Sun, 1 Nov 2020 22:50:21 +0000 (22:50 +0000)]
ifconfig.8: Improve formatting of -f in synopsis

MFC after: 3 days

3 years agoRemove Tn macros from ifconfig.8
Mateusz Piotrowski [Sun, 1 Nov 2020 22:46:43 +0000 (22:46 +0000)]
Remove Tn macros from ifconfig.8

MFC after: 3 days

3 years ago[ctld] Fix compilation under gcc-6.4
Adrian Chadd [Sun, 1 Nov 2020 21:18:21 +0000 (21:18 +0000)]
[ctld] Fix compilation under gcc-6.4

* remove dup yylex symbol; already defined in a header file
* uint64_t is always >= 0

Reviewed by: cem, imp
Differential Revision: https://reviews.freebsd.org/D27046

3 years agoDo not document default locations of the OpenBSD and NetBSD ports trees
Mateusz Piotrowski [Sun, 1 Nov 2020 20:54:02 +0000 (20:54 +0000)]
Do not document default locations of the OpenBSD and NetBSD ports trees

Our own Ports Collection is not targeting those systems at the moment,
so let's stop documenting bits specific to OpenBSD and NetBSD in the ports
documentation. Especially, that it might bit rot one day.

MFC after: 1 week

3 years agoFix psoition reporting for calendar data file in system directory
Stefan Eßer [Sun, 1 Nov 2020 20:38:35 +0000 (20:38 +0000)]
Fix psoition reporting for calendar data file in system directory

MFC after: 3 days

3 years agoFix year in 2 most recent entries (2010 -> 2020)
Stefan Eßer [Sun, 1 Nov 2020 19:13:55 +0000 (19:13 +0000)]
Fix year in 2 most recent entries (2010 -> 2020)

Reported by: mack@macktronics.com (Dan Mack)

3 years agoDocument how to use sudo for SU_CMD
Mateusz Piotrowski [Sun, 1 Nov 2020 17:27:48 +0000 (17:27 +0000)]
Document how to use sudo for SU_CMD

It is rather common for the ports users to replace su(1) with sudo(8)
within the SU_CMD variable. Let's document it in the manual page (so far
it's been hidden in a comment within bsd.commands.mk).

MFC after: 2 weeks

3 years agonet/if_media.c: improve IFMEDIA_DEBUG output.
Konstantin Belousov [Sun, 1 Nov 2020 16:38:30 +0000 (16:38 +0000)]
net/if_media.c: improve IFMEDIA_DEBUG output.

Use consistent output format for hex.
Print both media and mask where relevant.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().
Konstantin Belousov [Sun, 1 Nov 2020 16:36:21 +0000 (16:36 +0000)]
Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall().

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: some style.
Konstantin Belousov [Sun, 1 Nov 2020 16:30:17 +0000 (16:30 +0000)]
Cleanup of net/if_media.c: some style.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years agoCleanup of net/if_media.c: switch to ANSI C function definitions.
Konstantin Belousov [Sun, 1 Nov 2020 16:25:35 +0000 (16:25 +0000)]
Cleanup of net/if_media.c: switch to ANSI C function definitions.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27034

3 years ago[iscsictl] Fix compile issues that creep up with gcc-6.4
Adrian Chadd [Sun, 1 Nov 2020 15:57:14 +0000 (15:57 +0000)]
[iscsictl] Fix compile issues that creep up with gcc-6.4

This fixes two warnings:

* double-definition of a symbol in a yacc header
* Comparison of an unsigned int being >= 0; that's always
  going to be true.

Reviewed by: imp, rscheff
Differential Revision: https://reviews.freebsd.org/D27036

3 years agoMake sysctl user.local a tunable that can be written at run-time
Stefan Eßer [Sat, 31 Oct 2020 23:48:41 +0000 (23:48 +0000)]
Make sysctl user.local a tunable that can be written at run-time

This sysctl value had been provided as a read-only variable that is
compiled into the C library based on the value of _PATH_LOCALBASE in
paths.h.

After this change, the value is compiled into the kernel as an empty
string, which is translated to _PATH_LOCALBASE by the C library.

This empty string can be overridden at boot time or by a privileged
user at run time and will then be returned by sysctl.

When set to an empty string, the value returned by sysctl reverts to
_PATH_LOCALBASE.

This update does not change the behavior on any system that does
not modify the default value of user.localbase.

I consider this change as experimental and would prefer if the run-time
write permission was reconsidered and the sysctl variable defined with
CLFLAG_RDTUN instead to restrict it to be set at boot time.

MFC after: 1 month

3 years agoacpi_dock(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:20:42 +0000 (22:20 +0000)]
acpi_dock(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoacpi_wmi(4): Add ACPI_PNP_INFO
Vladimir Kondratyev [Sat, 31 Oct 2020 22:19:39 +0000 (22:19 +0000)]
acpi_wmi(4): Add ACPI_PNP_INFO

MFC after: 2 weeks

3 years agoAdd plug and play information macroses for ACPI and I2C buses.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:15:59 +0000 (22:15 +0000)]
Add plug and play information macroses for ACPI and I2C buses.

Matching table format is compatible with ACPI_ID_PROBE bus method.

Note that while ACPI_ID_PROBE matches against _HID and all _CIDs, current
acpi_pnpinfo_str() exports only _HID and first _CID.  That means second
and further _CIDs should be added to both acpi_pnpinfo_str() and
ACPICOMPAT_PNP_INFO if device matching against them is required.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26824

3 years agoFix 32-bit build after r367209
Brandon Bergren [Sat, 31 Oct 2020 22:14:37 +0000 (22:14 +0000)]
Fix 32-bit build after r367209

Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC with: r367209

3 years agodevmatch(8): Respect mask field when matching strings of Z type.
Vladimir Kondratyev [Sat, 31 Oct 2020 22:04:13 +0000 (22:04 +0000)]
devmatch(8): Respect mask field when matching strings of Z type.

While here, add debug output for this action.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26823

3 years agoImplement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).
Hans Petter Selasky [Sat, 31 Oct 2020 21:53:23 +0000 (21:53 +0000)]
Implement the USB_GET_DEVICEINFO ioctl(2) for uhid(4).

Submitted by: pedro martelletto <pedro@ambientworks.net>
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoFix 32-bit build after r367229.
Brandon Bergren [Sat, 31 Oct 2020 21:11:34 +0000 (21:11 +0000)]
Fix 32-bit build after r367229.

The use of atomic_sub_64() in zfs_zstd.c was breaking the 32-bit build on
platforms without native 64-bit atomics due to atomic_sub_64() not being
available, and no fallback being provided in _STANDALONE.

Provide a standalone stub to match atomic_add_64() using simple math.

While this is not actually atomic, it does not matter in libsa context,
since it always runs single-threaded and does not run under a scheduler.

Reviewed by: mjg (in email)

3 years agoacpi_video(4): Put display device in to D3 state on "Display off" event.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:28:13 +0000 (20:28 +0000)]
acpi_video(4):  Put display device in to D3 state on "Display off" event.

As required by ACPI specs 6.3, appendix A.6, table B-8.

3 years agoacpi_video(4): Add evdev support for reporting of video events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:25:55 +0000 (20:25 +0000)]
acpi_video(4): Add evdev support for reporting of video events.

3 years agoacpi(9): Add EVENTHANDLERs for video and AC adapter events.
Vladimir Kondratyev [Sat, 31 Oct 2020 20:14:28 +0000 (20:14 +0000)]
acpi(9): Add EVENTHANDLERs for video and AC adapter events.

They are required for coming ACPI support in LinuxKPI.

Reviewed by: hselasky, manu (as part of D26603)

3 years agoacpi: Tweak _DSM method evaluation helpers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:47:34 +0000 (19:47 +0000)]
acpi: Tweak _DSM method evaluation helpers.

- Use ACPI style for _DSM evaluation helper parameter types.
- Constify UUID parameter.
- Increase size of returned DSM function bitmap by acpi_DSMQuery() up to 64
  items. Old limit of 8 functions is not sufficient for JEDEC JESD245 NVDIMMs.
- Add new acpi_EvaluateDSMTyped() helper which performs additional return
  value type check as compared with acpi_EvaluateDSM().
- Reimplement acpi_EvaluateDSM() on top of the acpi_EvaluateDSMTyped() call.

Reviewed by: scottph, manu
Differential Revision: https://reviews.freebsd.org/D26602

3 years agoig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.
Vladimir Kondratyev [Sat, 31 Oct 2020 19:30:23 +0000 (19:30 +0000)]
ig4(4): Add PCI IDs for Intel Comit Lake I2C controllers.

MFC after: 2 weeks

3 years agozfs: zstd: track allocator statistics
Mateusz Guzik [Sat, 31 Oct 2020 19:07:32 +0000 (19:07 +0000)]
zfs: zstd: track allocator statistics

This applies:
commit c4ede65bdfca11b532403620bbf0d6e33f0c1c1d
Author: Mateusz Guzik <mjguzik@gmail.com>
Date:   Fri Oct 30 23:26:10 2020 +0100

    zstd: track allocator statistics

    Note that this only tracks sizes as requested by the caller.
    Actual allocated space will almost always be bigger (e.g., rounded up to
    the next power of 2 or page size). Additionally the allocated buffer may
    be holding other areas hostage. Nonetheless, this is a starting point
    for tracking memory usage in zstd.

from openzfs

3 years agoMention the more strict consistency checks performed by calendar(), which
Stefan Eßer [Sat, 31 Oct 2020 16:39:27 +0000 (16:39 +0000)]
Mention the more strict consistency checks performed by calendar(), which
can make the program abort with an error message on previously accepted
but malformed input files.

3 years agoreadelf: Add -z decompression support
Ed Maste [Sat, 31 Oct 2020 15:27:45 +0000 (15:27 +0000)]
readelf: Add -z decompression support

Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909

3 years agoImprove calendar file parsing and consistency tests
Stefan Eßer [Sat, 31 Oct 2020 15:11:24 +0000 (15:11 +0000)]
Improve calendar file parsing and consistency tests

Add line number information to more warning and error messages.
Detect #else and #endif without corresponing #ifdef/#ifndef as error.
Detect missing #endif at end of file and print warning but continue.

Support for #undef has been added to reverse the effect of a prior #define.
It is no error if the argument value has not been defined before.

These changes may cause error aborts on malformed input files (e.g. with
spurious #else or #endif), but no such errors exist in the calendar files
in the FreeBSD base system and the calendar-data port and all tests pass.

More tests will be added in a follow-up commit to detect regressions that
might affect the newly added features.

This commit ends a series of updates that enhance the pre-processor and
make it behave much more like prior versions of the calendar progarm that
called cpp to pre-process the data files.

MFC after: 3 days
Relnotes: yes

3 years agoAdd file names and line numbers to debug messages
Stefan Eßer [Sat, 31 Oct 2020 13:55:10 +0000 (13:55 +0000)]
Add file names and line numbers to debug messages

MFC after: 3 days

3 years agoAdd file names and line numbers to calendar format error messages
Stefan Eßer [Sat, 31 Oct 2020 13:32:08 +0000 (13:32 +0000)]
Add file names and line numbers to calendar format error messages

Without file name and line number it is very cumbersum to identify the
locations of errors in calendar files.

MFC after: 3 days

3 years agoFix reversed condition after attempted style fix in r367196
Stefan Eßer [Sat, 31 Oct 2020 12:10:43 +0000 (12:10 +0000)]
Fix reversed condition after attempted style fix in r367196

Reported by: xtouqh@hotmail.com
MFC after: 3 days

3 years agoFix style, no functional change
Stefan Eßer [Sat, 31 Oct 2020 11:44:10 +0000 (11:44 +0000)]
Fix style, no functional change

Submitted by: kib
MFC after: 3 days

3 years agoAttempt to defuse a land mine before anyone else steps on it: The
Colin Percival [Sat, 31 Oct 2020 03:36:31 +0000 (03:36 +0000)]
Attempt to defuse a land mine before anyone else steps on it: The
freebsd-boot partition is not always the first one.

Following the instructions in UPDATING resulted in my overwriting
the efiboot0 partition on my laptop with ZFS boot blocks, which
had negative effects on the system's bootability.

Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D27002

3 years agolinux(4): Add missing clone(2) flags
Conrad Meyer [Sat, 31 Oct 2020 01:12:35 +0000 (01:12 +0000)]
linux(4): Add missing clone(2) flags

3 years agoIntegrate 4.4BSD-Lite2 changes to IOC_* definitions
Warner Losh [Fri, 30 Oct 2020 22:00:35 +0000 (22:00 +0000)]
Integrate 4.4BSD-Lite2 changes to IOC_* definitions

Bring in the long-overdue 4.4BSD-Lite2 rev 8.3 by cgd of
sys/ioccom.h. This uses UL suffix for the IOC_* constants so they
don't sign extend. Also bring in the handy diagram from NetBSD's
version of this file. This alters the 4.4BSD-Lite2 code slightly
in a way that's semantically the same but more compact.

This should stop the warnings from Chrome for bogus sign extension.

Reviewed by: kib@, jhb@
Differential Revision: https://reviews.freebsd.org/D26423

3 years agoUse a dynamic buffer for the copy of a node's new value.
John Baldwin [Fri, 30 Oct 2020 21:13:05 +0000 (21:13 +0000)]
Use a dynamic buffer for the copy of a node's new value.

This permits setting a node's value to a string longer than BUFSIZ.

Reported by: Sony Arpita Das @ Chelsio
Reviewed by: freqlabs
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D27027

3 years agoRemove IF_SND_TAG_TYPE_TLS_RATE_LIMIT conditionals.
John Baldwin [Fri, 30 Oct 2020 21:05:50 +0000 (21:05 +0000)]
Remove IF_SND_TAG_TYPE_TLS_RATE_LIMIT conditionals.

Support for TLS rate limit tags is now in the tree, so this macro is
always defined.

Reviewed by: hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27020

3 years agomalloc: delegate M_EXEC handling to dedicacted routines
Mateusz Guzik [Fri, 30 Oct 2020 20:02:32 +0000 (20:02 +0000)]
malloc: delegate M_EXEC handling to dedicacted routines

It is almost never needed and adds an avoidable branch.

While here do minior clean ups in preparation for larger changes.

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

3 years agoAdd ossl(4) to cryptotest.
Jung-uk Kim [Fri, 30 Oct 2020 19:53:16 +0000 (19:53 +0000)]
Add ossl(4) to cryptotest.

3 years agoUpdate man-pages to describe the user.localbase variable added in r367179.
Stefan Eßer [Fri, 30 Oct 2020 19:37:53 +0000 (19:37 +0000)]
Update man-pages to describe the user.localbase variable added in r367179.

MFC after: 3 days

3 years agobectl(8): missing flag in the help message
Luca Pizzamiglio [Fri, 30 Oct 2020 19:37:34 +0000 (19:37 +0000)]
bectl(8): missing flag in the help message

Flag -o for destroy subcommand is missing in the help message,
but present in the man page. Fix it.

PR: 249325
Approved by: kevans
Differential Revision: https://reviews.freebsd.org/D26429

3 years agolinux(4): Quiesce warning about madvise(..., -1)
Conrad Meyer [Fri, 30 Oct 2020 19:02:59 +0000 (19:02 +0000)]
linux(4): Quiesce warning about madvise(..., -1)

This API misuse is intended to produce an error value to detect certain
bogus stub implementations of MADV_WIPEONFORK.  We don't need to log a
warning about it.

Example:
https://boringssl.googlesource.com/boringssl/+/ad5582985cc6b89d0e7caf0d9cc7e301de61cf66%5E%21/

Reviewed by: emaste, trasz
Differential Revision: https://reviews.freebsd.org/D27017

3 years agoUFS2: Fix DoS due to corrupted extattrfile
Conrad Meyer [Fri, 30 Oct 2020 19:00:42 +0000 (19:00 +0000)]
UFS2: Fix DoS due to corrupted extattrfile

Prior versions of FreeBSD (11.x) may have produced a corrupt extattr file.
(Specifically, r312416 accidentally fixed this defect by removing a strcpy.)
CURRENT FreeBSD supports disk images from those prior versions of FreeBSD.
Validate the internal structure as soon as we read it in from disk, to
prevent these extattr files from causing invariants violations and DoS.

Attempting to access the extattr portion of these files results in
EINTEGRITY.  At this time, the only way to repair files damaged in this way
is to copy the contents to another file and move it over the original.

PR: 244089
Reported by: Andrea Venturoli <ml AT netfence.it>
Reviewed by: kib
Discussed with: mckusick (earlier draft)
Security: no
Differential Revision: https://reviews.freebsd.org/D27010

3 years agoAdd help messages for camcontrol(8) MMCCAM functionality
Ilya Bakulin [Fri, 30 Oct 2020 18:55:08 +0000 (18:55 +0000)]
Add help messages for camcontrol(8) MMCCAM functionality

This adds the help messages for camcontrol(8) in-binary help.
Man page will follow in the separate change.

Reviewed by: bz
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D25963

3 years agoAdd read only sysctl variable user.localbase
Stefan Eßer [Fri, 30 Oct 2020 18:48:09 +0000 (18:48 +0000)]
Add read only sysctl variable user.localbase

The value is provided by the C library as for other sysctl variables in
the user tree. It is compiled in and returns the value of _PATH_LOCALBASE
defined in paths.h.

Reviewed by: imp, scottl
Differential Revision: https://reviews.freebsd.org/D27009

3 years agoarm64: set the correct partition type in make-memstick.sh
Mitchell Horne [Fri, 30 Oct 2020 18:22:46 +0000 (18:22 +0000)]
arm64: set the correct partition type in make-memstick.sh

We create a UFS root filesystem using makefs(8), and later pass it to
mkimg(1) when creating the final image. The correct partition type is
freebsd-ufs; the freebsd parition type is for partitions containing a
BSD disklabel.

Reviewed by: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26987

3 years agoarm64: convert virtual machine images to GPT
Mitchell Horne [Fri, 30 Oct 2020 18:20:52 +0000 (18:20 +0000)]
arm64: convert virtual machine images to GPT

These images were switched to MBR in r281876 as a way to cope with a
hard-coded partition GUID in QEMU's default EFI firmware. Enough time
has passed that this is no longer a problem; QEMU versions >= 4.0
include a copy of edk2 EFI firmware that can detect the root filesystem
properly. Alternatively, sysutils/u-boot-qemu-arm64 can be used.

Switch back to building these images with a GPT partition table, and
re-enable the swap partition.

Reviewed by: gjb, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26986

3 years agovmimage.subr: noisier failure for unsupported targets
Mitchell Horne [Fri, 30 Oct 2020 18:18:25 +0000 (18:18 +0000)]
vmimage.subr: noisier failure for unsupported targets

The return code of write_partition_layout() doesn't bubble up, so an
invocation of make vm-release for an incorrect/unsupported target will
appear to succeed while make vm-install will fail due to missing
files. This isn't a common point of failure, but is worth handling
properly.

Upgrade this case to print a message to stderr, and exit in place. This
is okay to do since at this point in the execution of mk-vmimage.sh,
cleanup() has already been run.

Reviewed by: gjb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26985

3 years agoSlight refactor in vmimage.subr
Mitchell Horne [Fri, 30 Oct 2020 18:16:10 +0000 (18:16 +0000)]
Slight refactor in vmimage.subr

De-duplicate the invocation of mkimg(1). No functional change.

Reviewed by: gjb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26984

3 years agoopencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const
Mark Johnston [Fri, 30 Oct 2020 17:05:36 +0000 (17:05 +0000)]
opencrypto: Annotate hmac_init_(i|o)pad() to make auth_hash const

This makes them friendlier to drivers that try to use const pointers
whenever possible in their internal structures.

Reviewed by: jhb
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D26901

3 years agoPrint calendar entries in the order they occur
Stefan Eßer [Fri, 30 Oct 2020 15:43:52 +0000 (15:43 +0000)]
Print calendar entries in the order they occur

The calendar program used to output entries in reverse order, due to the
way an internal linked list was built up.

A regression test with 2 entries for the same day has been adapted to the
now non-reversed order.

MFC after: 3 days

3 years agoRevert debug output committed in r367166 by accident
Stefan Eßer [Fri, 30 Oct 2020 14:34:51 +0000 (14:34 +0000)]
Revert debug output committed in r367166 by accident

MFC after: 3 days

3 years agoFix length calculation in memmove
Stefan Eßer [Fri, 30 Oct 2020 14:32:13 +0000 (14:32 +0000)]
Fix length calculation in memmove

MFC after: 3 days

3 years agotmpfs: change tmpfs dirent zone into a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:07:25 +0000 (14:07 +0000)]
tmpfs: change tmpfs dirent zone into a malloc type

It is 64 bytes.

3 years agovfs: change vnode poll to just a malloc type
Mateusz Guzik [Fri, 30 Oct 2020 14:02:56 +0000 (14:02 +0000)]
vfs: change vnode poll to just a malloc type

The size is 120, close fit for 128 and rarely used. The infrequent use
avoidably populates per-CPU caches and ends up with more memory.

3 years agonet: add ETHER_IS_IPV6_MULTICAST
Mitchell Horne [Fri, 30 Oct 2020 13:32:58 +0000 (13:32 +0000)]
net: add ETHER_IS_IPV6_MULTICAST

This can be used to detect if an ethernet address is specifically an
IPv6 multicast address, defined in accordance to RFC 2464.

ETHER_IS_MULTICAST is still preferred in the general case.

Reviewed by: ae
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26611

3 years agocache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename
Mateusz Guzik [Fri, 30 Oct 2020 10:46:35 +0000 (10:46 +0000)]
cache: add cache_vop_mkdir and rename cache_rename to cache_vop_rename

3 years agoRe-implement comment parsing missing in the internal pre-processor
Stefan Eßer [Fri, 30 Oct 2020 10:44:46 +0000 (10:44 +0000)]
Re-implement comment parsing missing in the internal pre-processor

The internal pre-processor ignored lines that did not parse a calendar
entries, but did not support multi-line comments in the way the external
cpp did.

The calendar files distributed with the base system (now in a port) do
use comments, though.

Implement comment processing for single-line (//) and multi-line comments
(/* */) with same semantics as in a standard C pre-processor.

All tests pass with this version, but there are no tests that specifically
verify comment processing.

Reported by: jhs@berklix.com (Julian H. Stacey)
MFC after: 3 days

3 years agofetch(1): Fix style
Fernando Apesteguía [Fri, 30 Oct 2020 09:48:41 +0000 (09:48 +0000)]
fetch(1): Fix style

Fix style problems introduced in r367141:

* s/Ql/Pa/ for file names
* Break line properly in macro
* Properly generate back slash character

Not bumping .Dd

Reported by: xtouqh@icloud.com, steffen@sdaoden.eu
Approved by: 0mp@
Differential Revision: https://reviews.freebsd.org/D26946

3 years agobeinstall.sh: Use bectl instead of beadm by default
Mateusz Piotrowski [Fri, 30 Oct 2020 09:40:55 +0000 (09:40 +0000)]
beinstall.sh: Use bectl instead of beadm by default

This patch also introduces an environment variable BE_UTILITY,
which can be used to specify the utility to use for managing
ZFS boot environments (which can be either bectl or beadm).

While here, fix some typos in the manual page and
remove beadm from section "SEE ALSO".

Reviewed by: bcr, kevans, rpokala
Approved by: will
Differential Revision: https://reviews.freebsd.org/D21111

3 years agoFix a couple of silly bugs in r367149.
John Baldwin [Fri, 30 Oct 2020 00:06:36 +0000 (00:06 +0000)]
Fix a couple of silly bugs in r367149.

- Assign the TLS rate limit value to the correct member of the
  rl_params for the nested rate limit tag.

- Remove a dead condition.

Pointy hat to: jhb

3 years agobhyve currently reports each of "smbios.system.maker" and
Olivier Cochard [Fri, 30 Oct 2020 00:03:59 +0000 (00:03 +0000)]
bhyve currently reports each of "smbios.system.maker" and
"smbios.system.family" as " ".
This presents challenges for both humans and tools when trying to parse output
that uses those results.
The new values reported are now:
smbios.system.family="Virtual Machine"
smbios.system.maker="FreeBSD"

PR: 250728
Approved by: grehan@FreeBSD.org
Sponsored by: Netflix

3 years agoAdd m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().
John Baldwin [Thu, 29 Oct 2020 23:28:39 +0000 (23:28 +0000)]
Add m_snd_tag_alloc() as a wrapper around if_snd_tag_alloc().

This gives a more uniform API for send tag life cycle management.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27000

3 years agoConvert flags from int to bool. Some (compress) were already used in
Gleb Smirnoff [Thu, 29 Oct 2020 23:15:11 +0000 (23:15 +0000)]
Convert flags from int to bool.  Some (compress) were already used in
comparisons with bool values.  No functional changes.

3 years agoUse public interfaces to manage the nested rate limit send tag.
John Baldwin [Thu, 29 Oct 2020 22:22:27 +0000 (22:22 +0000)]
Use public interfaces to manage the nested rate limit send tag.

Each TLS send tag in mlx5 contains a nested rate limit send tag.
Previously, the driver was calling internal functions to manage the
nested tag.  Calling free methods directly instead of m_snd_tag_rele()
leaked send tag references and references on the ifp.  Changes to use
the ifp methods for the nested tag for other methods are more cosmetic
but do simplify the code.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26996

3 years agoCall m_snd_tag_rele() to free send tags.
John Baldwin [Thu, 29 Oct 2020 22:18:56 +0000 (22:18 +0000)]
Call m_snd_tag_rele() to free send tags.

Send tags are refcounted and if_snd_tag_free() is called by
m_snd_tag_rele() when the last reference is dropped on a send tag.

Reviewed by: gallatin, hselasky
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26995

3 years agoRemove an extra if_ref().
John Baldwin [Thu, 29 Oct 2020 22:16:59 +0000 (22:16 +0000)]
Remove an extra if_ref().

In r348254, if_snd_tag_alloc() routines were changed to bump the ifp
refcount via m_snd_tag_init().  This function wasn't in the tree at
the time and wasn't updated for the new semantics, so was still doing
a separate bump after if_snd_tag_alloc() returned.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26999

3 years agoStore the new send tag in the right place.
John Baldwin [Thu, 29 Oct 2020 22:14:34 +0000 (22:14 +0000)]
Store the new send tag in the right place.

r350501 added the 'st' parameter, but did not pass it down to
if_snd_tag_alloc().

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D26997

3 years agovfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite
Mateusz Guzik [Thu, 29 Oct 2020 18:43:37 +0000 (18:43 +0000)]
vfs: add NAMEI_DBG_HADSTARTDIR handling lost in rewrite

Noted by: rpokala

3 years agofold(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:39:04 +0000 (18:39 +0000)]
fold(1): Add EXAMPLES section

A couple of examples covering -s and -w flags.

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26948

3 years agofmt(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:37:20 +0000 (18:37 +0000)]
fmt(1): Add EXAMPLES section

Very small EXAMPLES section.

While here, remove reference to nroff(1).

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26947

3 years agofetch(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 29 Oct 2020 18:34:47 +0000 (18:34 +0000)]
fetch(1): Add EXAMPLES section

Add a few examples covering flags: 1, R, a, o, q, r, s, v

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D26946

3 years agoMake linprocfs(4) print a warning when there's not enough room to fill
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:44:44 +0000 (15:44 +0000)]
Make linprocfs(4) print a warning when there's not enough room to fill
/proc/self/maps.

Submitted by: dchagin (earlier version)
Reviewed by: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20576

3 years agoOptimize set_syscall_retval for riscv by predicting the return
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:36:20 +0000 (15:36 +0000)]
Optimize set_syscall_retval for riscv by predicting the return
value to be zero.

Reviewed by: mhorne, kp
MFC after: 2 weeks
Sponsored by: EPSRC
Differential Revision: https://reviews.freebsd.org/D26990

3 years agoMake it possible to mount nullfs(5) using plain mount(8)
Edward Tomasz Napierala [Thu, 29 Oct 2020 15:28:15 +0000 (15:28 +0000)]
Make it possible to mount nullfs(5) using plain mount(8)
instead of mount_nullfs(8).

Obviously you'd need to force mount(8) to not call
mount_nullfs(8) to make use of it.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26934

3 years agoWhitespace cleanup
Li-Wen Hsu [Thu, 29 Oct 2020 14:44:09 +0000 (14:44 +0000)]
Whitespace cleanup

MFC after: 3 days

3 years agoFix typo.
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:42:51 +0000 (14:42 +0000)]
Fix typo.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoRemove superfluous `this` in comment
Li-Wen Hsu [Thu, 29 Oct 2020 14:42:02 +0000 (14:42 +0000)]
Remove superfluous `this` in comment

PR: 250721
Submitted by: Hiroya EBINE <hebiyan@protonmail.com>
MFC after: 3 days

3 years agoAdd defines for Linux errno values and use them to make linux_errtbl[]
Edward Tomasz Napierala [Thu, 29 Oct 2020 14:23:52 +0000 (14:23 +0000)]
Add defines for Linux errno values and use them to make linux_errtbl[]
more readable.  While here, add linux_check_errtbl() function to make
sure we don't leave holes.

No objections: emaste (earlier version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26972

3 years agoUpdate the due date of the quarterly status report
Li-Wen Hsu [Thu, 29 Oct 2020 14:21:25 +0000 (14:21 +0000)]
Update the due date of the quarterly status report

While here, move the date to keep 2 weeks ahead notificaion
and fix the part of speech.

Reviewed by: debdrup
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26998

3 years agovfs: add NDREINIT to facilitate repeated namei calls
Mateusz Guzik [Thu, 29 Oct 2020 12:56:02 +0000 (12:56 +0000)]
vfs: add NDREINIT to facilitate repeated namei calls

struct nameidata mixes caller arguments, internal state and output, which
can be quite error prone.

Recent addition of valdiating ni_resflags uncovered a caller which could
repeatedly call namei, effectively operating on partially populated state.

Add bare minimium validation this does not happen. The real fix would
decouple aforementioned state.

Reported by: pho
Tested by: pho (different variant)

3 years agoSimplify test for closing delimiter of #include argument (no functional
Stefan Eßer [Thu, 29 Oct 2020 08:31:47 +0000 (08:31 +0000)]
Simplify test for closing delimiter of #include argument (no functional
change).

While here: Fix invalid parameters of a commented-out debug printf() found
when testing with this code enabled.

MFC after: 3 days

3 years agoFix calendar -a processing of files included in the user's home directory
Stefan Eßer [Thu, 29 Oct 2020 08:26:38 +0000 (08:26 +0000)]
Fix calendar -a processing of files included in the user's home directory

The existing code performed a chdir() into the home directory, but the
parser fell back to using the invoking user's home directory as the base
directory for the search for an include file.

Since use of the -a option is limited to UID==0, the directory searched
was typically ~root/.calendar, not the .calendar directory of the user
whose file is being processed.

PR: 205580
Reported by: greg.bal4@gmail.com (Greg Balfour)
MFC after: 3 days