]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoRework part of routing code to reduce difference to D26449.
Alexander V. Chernikov [Mon, 21 Sep 2020 20:02:26 +0000 (20:02 +0000)]
Rework part of routing code to reduce difference to D26449.

* Split rt_setmetrics into get_info_weight() and rt_set_expire_info(),
 as these two can be applied at different entities and at different times.
* Start filling route weight in route change notifications
* Pass flowid to UDP/raw IP route lookups
* Rework nd6_subscription_cb() and sysctl_dumpentry() to prepare for the fact
 that rtentry can contain multiple nexthops.

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

3 years agobsdbox: fix build after recent libifconfig changes
Kyle Evans [Mon, 21 Sep 2020 19:50:39 +0000 (19:50 +0000)]
bsdbox: fix build after recent libifconfig changes

libifconfig now generates file(s) into its .OBJDIR that are essential to the
build. Make sure we -I that in, like we already do in the ^/rescue build.

3 years agomkcsmapper: Fix UBSan signed shift error
Alex Richardson [Mon, 21 Sep 2020 19:03:17 +0000 (19:03 +0000)]
mkcsmapper: Fix UBSan signed shift error

usr.bin/mkcsmapper/yacc.y:466:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

3 years agoFix another UBSan error in awk
Alex Richardson [Mon, 21 Sep 2020 19:03:12 +0000 (19:03 +0000)]
Fix another UBSan error in awk

This applies my upstreamed fix: https://github.com/onetrueawk/awk/commit/ad9bd2f40a89ec9533b92254b86a756cf4f40fd4
Found By: UBSan

3 years agoawk: Fix subobject out-of-bounds access
Alex Richardson [Mon, 21 Sep 2020 19:03:07 +0000 (19:03 +0000)]
awk: Fix subobject out-of-bounds access

When matching a regex with ^, it would attempt to access
gototab[NSTATES][NCHARS+2], and therefore access the state for the \002
character instead. This change is required to run awk under CHERI (with
sub-object bounds) and when running with UBSan instrumentation.

This was committed upstream as https://github.com/onetrueawk/awk/commit/cbf924342b63a095a4c6842280c3085b1b63ae45

Found by: CHERI (with subobject bounds enabled)
Obtained from: CheriBSD
Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D26509

3 years agoWhitespace fix after r365948
David Bright [Mon, 21 Sep 2020 18:34:13 +0000 (18:34 +0000)]
Whitespace fix after r365948

MFC after: 1 week
Sponsored by: Dell EMC Isilon

3 years agoAdd support for Winbond USB CDC modem device found in Tenma power supply.
Hans Petter Selasky [Mon, 21 Sep 2020 18:32:57 +0000 (18:32 +0000)]
Add support for Winbond USB CDC modem device found in Tenma power supply.

PR: 249384
MFC after: 1 week
Submitted by: darius@dons.net.au
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd example to ng_bpf(4) showing how ng_bpf(4) can be used to prevent spoofing.
Hans Petter Selasky [Mon, 21 Sep 2020 18:17:01 +0000 (18:17 +0000)]
Add example to ng_bpf(4) showing how ng_bpf(4) can be used to prevent spoofing.

Differential Revision: https://reviews.freebsd.org/D26488
MFC after: 1 week
Reviewed by: pi, bcr (manpages)
Submitted by: lutz_donnerhacke.de (Lutz Donnerhacke)
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years ago[rcorder] [crunch] Fix C function declarations to include void
Adrian Chadd [Mon, 21 Sep 2020 17:59:45 +0000 (17:59 +0000)]
[rcorder] [crunch] Fix C function declarations to include void

This fixes a compile issue under gcc6 which complains about
legacy style C function declarations.

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

3 years agofsx: fix build with WARNS=6
Alan Somers [Mon, 21 Sep 2020 17:48:28 +0000 (17:48 +0000)]
fsx: fix build with WARNS=6

* signed/unsigned comparisons
* use standard warn(3)
* Suppress warnings about local vars and funcs not declared static
* const-correctness
* declaration shadows a variable in the global scope

Reviewed by: kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26516

3 years agoHide tunable definitions behind _KERNEL
Mitchell Horne [Mon, 21 Sep 2020 17:28:41 +0000 (17:28 +0000)]
Hide tunable definitions behind _KERNEL

Some userspace code include sys/kernel.h. Namely, some OpenZFS tests do
this, and it was causing breakage after r365945 due to a lack of bool
typedef. Userspace should not need the TUNABLE_** stuff, so hide it
behind an #ifdef _KERNEL.

Sorry for the breakage.

Reported by: andrew, Michael Butler, Jenkins
Discussed with: kevans, allanjude

3 years agoxargs: add some long options for GNU compatibility
Kyle Evans [Mon, 21 Sep 2020 17:06:36 +0000 (17:06 +0000)]
xargs: add some long options for GNU compatibility

These are low-effort to add, so let's just do it.

Reported by: "LukeShu" on Hacker News (-r / --no-run-if-empty)
MFC after: 1 week

3 years agoPull in fix from upstream NetBSD rev. 1.5:
Poul-Henning Kamp [Mon, 21 Sep 2020 16:43:38 +0000 (16:43 +0000)]
Pull in fix from upstream NetBSD rev. 1.5:

    If Unwind_Backtrace is broken, ctx.n will still contain ~0, and we will
    return that which poor behavior for the user, so return 0 instead.
    We could document ~0 to be an error, but that would deviate from the
    Linux behavior which is not desirable. Noted by Poul-Henning Kamp

PR: 209842

3 years agoamd64 pmap: only calculate page table page when needed.
Konstantin Belousov [Mon, 21 Sep 2020 15:53:41 +0000 (15:53 +0000)]
amd64 pmap: only calculate page table page when needed.

Noted by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26499

3 years agoWhen building on Ubuntu bootstrap bmake with bash as the default shell
Alex Richardson [Mon, 21 Sep 2020 15:49:02 +0000 (15:49 +0000)]
When building on Ubuntu bootstrap bmake with bash as the default shell

The Ubuntu /bin/sh (dash) removes all environment variables that contain
characters outside the [a-zA-Z0-9_] range and this breaks the bmake tests that
run as part of bootstrapping bmake.
This can be reverted when the bmake tests have been updated.

3 years agoAdd a tools/build/make.py script that bootstraps bmake and then runs the build
Alex Richardson [Mon, 21 Sep 2020 15:48:57 +0000 (15:48 +0000)]
Add a tools/build/make.py script that bootstraps bmake and then runs the build

This makes it possible to compile on non-FreeBSD systems since make will
usually be GNU make there. Even if they include bmake, it will often
either be a broken version or too old to build FreeBSD.

This should be the last commit needed to compile FreeBSD on Linux+macOS.
After over two years, I've finally managed to upstream all our local CheriBSD
changes to allow building on Linux (and as a result of being reviewed by more
people they are slightly less ugly than they were before).

It should now be possible to run the following to build on Linux+macOS if you
have LLVM/Clang 10 or newer installed:
MAKEOBJDIRPREFIX=/somewhere ./tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 buildworld

I have only tested macOS 15, Ubuntu 18.04 and openSUSE Leap, but other Linux
distributions might also work (as long as they ship a recent GLibc and compiler).

Reviewed By: emaste (should be fine to commit to tools/)
Differential Revision: https://reviews.freebsd.org/D16767

3 years agoHonor the FWUG value of some drives in nvmecontrol
David Bright [Mon, 21 Sep 2020 15:45:49 +0000 (15:45 +0000)]
Honor the FWUG value of some drives in nvmecontrol

nvmecontrol tries to upload firmware in chunks as large as it thinks
the device permits. It fails to take into account the FWUG value used
by some drives to advertise the size and alignment limits for firmware
chunks.

  - Use the firwmare update granularity value from the
  - If the granularity is not reported or not restricted, fall back to
    the previously existing logic that calculates the max transfer
    size based on MDTS.
  - Add firmware update granularity to the identify-controller output.

Reviewed by: imp (previous version), chuck
Obtained from: Dell EMC Isilon
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26390

3 years agoUse getenv_is_true() in init_static_kenv()
Mitchell Horne [Mon, 21 Sep 2020 15:44:23 +0000 (15:44 +0000)]
Use getenv_is_true() in init_static_kenv()

A small example of how these functions can be used to simplify checks of
this nature.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26271

3 years agoAdd an ioctl to get an NVMe device's maximum transfer size
David Bright [Mon, 21 Sep 2020 15:41:47 +0000 (15:41 +0000)]
Add an ioctl to get an NVMe device's maximum transfer size

Reviewed by: imp, chuck
Obtained from: Dell EMC Isilon
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26390

3 years agoAdd getenv(9) boolean parsing functions
Mitchell Horne [Mon, 21 Sep 2020 15:24:44 +0000 (15:24 +0000)]
Add getenv(9) boolean parsing functions

This adds the getenv_bool() function, to parse a boolean value from a
kernel environment variable or tunable. This works for traditional
boolean values like "0" and "1", and also "true" and "false"
(case-insensitive). These semantics do not yet apply to sysctls declared
using SYSCTL_BOOL with CTLFLAG_TUN (they still only parse 1 and 0).

Also added are two wrapper functions, getenv_is_true() and
getenv_is_false(). These are slightly simpler for callers wishing to
perform a single check of a configuration variable.

Reviewed by: jhb (slightly earlier version)
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26270

3 years agoaw_usbphy: add support for device mode operation
Andriy Gapon [Mon, 21 Sep 2020 10:02:11 +0000 (10:02 +0000)]
aw_usbphy: add support for device mode operation

OTG mode is not supported still.  It's easy to do it as a one-off
detection, but the proper support requires continuous monitoring and
communicating the current state to the USB layer.

Also, fix phy0_route setting for H3.  Remove duplicate register
definitions.

Tested on Orange Pi PC Plus with dr_mode="peripheral" using
  hw.usb.template=3
  umodem_load="YES"

Reviewed by: manu
MFC after: 5 weeks
Differential Revision: https://reviews.freebsd.org/D26348

3 years agoFix vi build on Linux/macOS
Alex Richardson [Mon, 21 Sep 2020 09:03:42 +0000 (09:03 +0000)]
Fix vi build on Linux/macOS

This absolute include causes a build failure on Linux for me:
.../cheri/freebsd/contrib/nvi/cl/../common/common.h:10:10: fatal error: '/usr/include/db.h' file not found

This change patches the file to use #include <db.h> instead until a
solution has been found upstream. See also https://github.com/lichray/nvi2/issues/69

Reviewed By: bapt
Differential Revision: https://reviews.freebsd.org/D26480

3 years agoFix -Wpointer-sign warnings in usr.bin/grep
Alex Richardson [Mon, 21 Sep 2020 09:03:37 +0000 (09:03 +0000)]
Fix -Wpointer-sign warnings in usr.bin/grep

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

3 years agoPrefer bootstrapped tools when running certctl.sh
Alex Richardson [Mon, 21 Sep 2020 09:03:32 +0000 (09:03 +0000)]
Prefer bootstrapped tools when running certctl.sh

Otherwise we get lots of warnings when building on Linux/macOS during
installworld:
Scanning /local/scratch/alr48/cheri/output/freebsd-x86/usr/share/certs/blacklisted for certificates...
install: invalid option -- 'U'
Try 'install --help' for more information.
install: invalid option -- 'U'
....

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

3 years agoloader: zfs should support bootonce an nextboot
Toomas Soome [Mon, 21 Sep 2020 09:01:10 +0000 (09:01 +0000)]
loader: zfs should support bootonce an nextboot

bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by: Netflix, Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25512

3 years agoatomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr
Jessica Clarke [Sun, 20 Sep 2020 23:20:18 +0000 (23:20 +0000)]
atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr

This was broken in r357940 which introduced the __typeof use. We need
the volatile qualifier to be on the pointee not the pointer otherwise it
does nothing. This was found by mhorne in D26498, noticing there was a
problem (a spin loop condition was hoisted for RISC-V boot code) but not
the root cause of it.

Reported by: mhorne
Reviewed by: mhorne, mjg
Approved by: mhorne, mjg
Differential Revision: https://reviews.freebsd.org/D26500

3 years agoamd64 pmap: handle cases where pml4 page table page is not allocated.
Konstantin Belousov [Sun, 20 Sep 2020 22:16:24 +0000 (22:16 +0000)]
amd64 pmap: handle cases where pml4 page table page is not allocated.

Possible in LA57 pmap config.

Noted by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D26492

3 years agoRemove unused nhop_ref_any() function.
Alexander V. Chernikov [Sun, 20 Sep 2020 21:32:52 +0000 (21:32 +0000)]
Remove unused nhop_ref_any() function.
Remove "opt_mpath.h" header where not needed.

No functional changes.

3 years agoAdjust DMA alignment for USB stack.
Michal Meloun [Sun, 20 Sep 2020 17:28:24 +0000 (17:28 +0000)]
Adjust DMA alignment for USB stack.
It should be at least as large as the maximum value of caheline size
for currently known CPUs.

MFC after: 2 weeks

3 years agoarm: allwinner: aw_nmi: Fix wrong logic when we disable the nmi
Emmanuel Vadot [Sun, 20 Sep 2020 16:11:38 +0000 (16:11 +0000)]
arm: allwinner: aw_nmi: Fix wrong logic when we disable the nmi

MFC after: 1 week

3 years agoAdd missing assignment forgotten in r365899
Michal Meloun [Sun, 20 Sep 2020 15:11:52 +0000 (15:11 +0000)]
Add missing assignment forgotten in r365899

Noticed by: mav
MFC after: 1 month
MFC with: r365899

3 years agoFix gw updates / flag updates during route changes.
Alexander V. Chernikov [Sun, 20 Sep 2020 12:31:48 +0000 (12:31 +0000)]
Fix gw updates / flag updates during route changes.

* Zero gw_sdl if switching to interface route - the assumption
 that underlying storage is zeroed is incorrect with route changes.
* Apply proper flag mask to rte.

Reported by: vangyzen

3 years agoApply an opimization for the kernels used by cexp(x) and cexpf(x) submitted
Stefan Eßer [Sun, 20 Sep 2020 05:32:53 +0000 (05:32 +0000)]
Apply an opimization for the kernels used by cexp(x) and cexpf(x) submitted
by Steve Kargl:

- Use sincos[f] instead of a call to cos[f] and a call to sin[f].

- While here, alphabetize declaration.

Submitted by:   sgk at troutmask.apl.washington.edu (Steve Kargl)

3 years agoApply fix for ld80 and ld128 submitted by Steve Kargl:
Stefan Eßer [Sun, 20 Sep 2020 05:28:31 +0000 (05:28 +0000)]
Apply fix for ld80 and ld128 submitted by Steve Kargl:

- Micro-optimization: use sincosl(x) instead of a call to cosl(x) and
  a call to sinl(x).  Argument reduction is done once not twice.

- Use a long double constant instead of an invalid double constant.

- Spell scale2 correctly

He could not test ld128, so that patch is untested.

Submitted by: sgk at troutmask.apl.washington.edu (Steve Kargl)

3 years agoUpdate the libufs cgget() and cgput() interfaces to have a similar
Kirk McKusick [Sat, 19 Sep 2020 22:48:30 +0000 (22:48 +0000)]
Update the libufs cgget() and cgput() interfaces to have a similar
API to the sbget() and sbput() interfaces. Specifically they take
a file descriptor pointer rather than the struct uufsd *disk pointer
used by the libufs cgread() and cgwrite() interfaces. Update fsck_ffs
to use these revised interfaces.

No functional changes intended.

Sponsored by: Netflix

3 years agoFix for use of the XHCI driver on Cortex-A72 by adding a missing cache
Hans Petter Selasky [Sat, 19 Sep 2020 22:37:45 +0000 (22:37 +0000)]
Fix for use of the XHCI driver on Cortex-A72 by adding a missing cache
flush operation before writing to the XHCI_ERSTBA_LO/HI register(s).

PR: 237666
Discussed with: Mark Millard <marklmi@yahoo.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies // Nvidia

3 years agoThe fsdb(8) utility uses the fsck_ffs(8) disk I/O interfaces, so
Kirk McKusick [Sat, 19 Sep 2020 20:06:12 +0000 (20:06 +0000)]
The fsdb(8) utility uses the fsck_ffs(8) disk I/O interfaces, so
switch from using libufs's bread() to using fsck_ffs's getdatablk()
when importing tools/diag/prtblnos's prtblknos().

Sponsored by: Netflix

3 years agofix integer underflow in getgrnam_r and getpwnam_r
Alan Somers [Sat, 19 Sep 2020 19:08:27 +0000 (19:08 +0000)]
fix integer underflow in getgrnam_r and getpwnam_r

Sometimes nscd(8) will return a 1-byte buffer for a nonexistent entry. This
triggered an integer underflow in grp_unmarshal_func, causing getgrnam_r to
return ERANGE instead of 0.

Fix the user's buffer size check, and add a correct check for a too-small
nscd buffer.

PR: 248932
Event: September 2020 Bugathon
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26204

3 years agoAddress compiler warnings in C code used by the DTrace test suite.
Mark Johnston [Sat, 19 Sep 2020 16:15:22 +0000 (16:15 +0000)]
Address compiler warnings in C code used by the DTrace test suite.

Reported by: Jenkins
MFC after: 1 week

3 years agoFix some nits in 1G page support in the amd64 pmap.
Mark Johnston [Sat, 19 Sep 2020 15:22:04 +0000 (15:22 +0000)]
Fix some nits in 1G page support in the amd64 pmap.

- Move assertions out of the main loop to avoid duplicate conditional
  expressions, and improve assertion messages.
- Fix va_next updates.  In some cases we were not doing the wraparound
  check before continuing the loop.
- Use the right va_next.  In pmap_advise() and pmap_copy() we would step
  through 1G pages 2M at a time.
- Copy 1G mappings in pmap_copy().

Reviewed by: alc, kib
MFC with: r365518
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26463

3 years agodiskless(8): Correct Sections out of conventional order error
Gordon Bergling [Sat, 19 Sep 2020 15:10:17 +0000 (15:10 +0000)]
diskless(8): Correct Sections out of conventional order error

Event: September 2020 Bugathon
MFC after: 1 week

3 years agocrypto(7): Correct Sections out of conventional order error
Gordon Bergling [Sat, 19 Sep 2020 15:08:57 +0000 (15:08 +0000)]
crypto(7): Correct Sections out of conventional order error

Event: September 2020 Bugathon
MFC after: 1 week

3 years agosrc.conf(5): Fix some mandoc issues in source files
Gordon Bergling [Sat, 19 Sep 2020 14:49:31 +0000 (14:49 +0000)]
src.conf(5): Fix some mandoc issues in source files

- new sentence, new line
- blank line in fill mode

Event: September 2020 Bugathon
MFC after: 1 week

3 years agoCirrus-CI: skip svn_head branch
Ed Maste [Sat, 19 Sep 2020 13:55:26 +0000 (13:55 +0000)]
Cirrus-CI: skip svn_head branch

svn_head has the same content as the master or main branch (it's just
the result of a `git svn` conversion instead of svn2git).

Sponsored by: The FreeBSD Foundation

3 years agoFix dtrace tools bootstrap on non-FreeBSD after OpenZFS import
Alex Richardson [Sat, 19 Sep 2020 12:08:16 +0000 (12:08 +0000)]
Fix dtrace tools bootstrap on non-FreeBSD after OpenZFS import

This required surprisingly few build system changes and only two changes to the
openZFS compat headers which have been upstreamed as
https://github.com/openzfs/zfs/pull/10863

Reviewed By: #zfs, freqlabs
Differential Revision: https://reviews.freebsd.org/D26193

3 years agoImplement workaround for broken access to configuration space.
Michal Meloun [Sat, 19 Sep 2020 11:27:16 +0000 (11:27 +0000)]
Implement workaround for broken access to configuration space.
Due to a HW bug in the RockChip PCIe implementation, attempting to access
a non-existent register in the configuration space will throw an exception.
Use new bus functions bus_peek() and bus_poke() to overcomme this limitation.

3 years agoAdd NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.
Michal Meloun [Sat, 19 Sep 2020 11:06:41 +0000 (11:06 +0000)]
Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.
One problem with the bus_space_read_N() and bus_space_write_N() family of
functions is that they provide no protection against exceptions which can
occur when no physical hardware or device responds to the read or write
cycles. In such a situation, the system typically would panic due to a
kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family
of functions provide a mechanism to handle these exceptions gracefully
without the risk of crashing the system.

Typical example is access to PCI(e) configuration space in bus enumeration
function on badly implemented PCI(e) root complexes (RK3399 or Neoverse
N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state.

This commit adds a real implementation for arm64 only. The remaining
architectures have bus_space_peek()/bus_space_poke() emulated by using
bus_space_read()/bus_space_write() (without exception handling).

MFC after: 1 month
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25371

3 years agoMove finalize_components_config from get_params to cmd_*.
Colin Percival [Sat, 19 Sep 2020 02:15:56 +0000 (02:15 +0000)]
Move finalize_components_config from get_params to cmd_*.

This allows us to redirect its output in cmd_cron, so that the
"src component not installed, skipped" message will be treated
the same way as other output from freebsd-update cron: Sent
in an email to root (or other address specified) if there are
updates to install, and silenced otherwise.

PR: 202492
MFC After: 1 week
Differential Revision: https://reviews.freebsd.org/D26432

3 years agocaroot: update base store
Kyle Evans [Sat, 19 Sep 2020 01:59:17 +0000 (01:59 +0000)]
caroot: update base store

Count:
- Two (2) removed
- Three (3) added

MFC after: 3 days

3 years agoFix a LOR between the NFS server and server side krpc.
Rick Macklem [Fri, 18 Sep 2020 23:52:56 +0000 (23:52 +0000)]
Fix a LOR between the NFS server and server side krpc.

Recent testing of the NFS-over-TLS code found a LOR between the mutex lock
used for sessions and the sleep lock used for server side krpc socket
structures in nfsrv_checksequence().  This was fixed by r365789.
A similar bug exists in nfsrv_bindconnsess(), where SVC_RELEASE() is called
while mutexes are held.
This patch applies a fix similar to r365789, moving the SVC_RELEASE() call
down to after the mutexes are released.

This patch fixes the problem by moving the SVC_RELEASE() call in
nfsrv_checksequence() down a few lines to below where the mutex is released.

MFC after: 1 week

3 years agoMFV 2.0-rc2
Matt Macy [Fri, 18 Sep 2020 23:21:24 +0000 (23:21 +0000)]
MFV 2.0-rc2

- Fixes divide by zero for unusual hz
- remove cryptodev dependency

3 years agoUpdate openzfs to 2.0.0-rc2-g4ce06f
Matt Macy [Fri, 18 Sep 2020 22:55:05 +0000 (22:55 +0000)]
Update openzfs to 2.0.0-rc2-g4ce06f

3 years agoamd64 pmap_pkru_same: prev_ppr was always NULL
Eric van Gyzen [Fri, 18 Sep 2020 20:53:40 +0000 (20:53 +0000)]
amd64 pmap_pkru_same: prev_ppr was always NULL

Fix the logic so it works as it appears.

Reported by: Coverity
Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: D26211 (in progress, so omitting full URL)

3 years agoInstall library symlinks atomically.
Mark Johnston [Fri, 18 Sep 2020 19:03:34 +0000 (19:03 +0000)]
Install library symlinks atomically.

As we do for shared library binaries, pass -S to install(1) when
installing symlinks.  Doing so helps avoid transient failures when
libraries are being reinstalled, which seems to be the root cause of
spurious libgcc_s.so link failures during CI builds.

PR: 233769
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26453

3 years agoys/contrib/dev/ath: remove unintentional double semicolon
Ed Maste [Fri, 18 Sep 2020 18:35:18 +0000 (18:35 +0000)]
ys/contrib/dev/ath: remove unintentional double semicolon

Approved by: adrian

3 years agobuild: provide a default WARNS for all in-tree builds
Kyle Evans [Fri, 18 Sep 2020 17:17:46 +0000 (17:17 +0000)]
build: provide a default WARNS for all in-tree builds

The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by: emaste, brooks, ngie (all earlier version)
Reviewed by: emaste, arichardson (depend-cleanup.sh change)
Differential Revision: https://reviews.freebsd.org/D26455

3 years agovm_ooffset_t is now unsigned
Eric van Gyzen [Fri, 18 Sep 2020 16:48:08 +0000 (16:48 +0000)]
vm_ooffset_t is now unsigned

vm_ooffset_t is now unsigned. Remove some tests for negative values,
or make other adjustments accordingly.

Reported by: Coverity
Reviewed by: kib markj
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26214

3 years agoarm64: generate ISO release images
Mitchell Horne [Fri, 18 Sep 2020 14:40:13 +0000 (14:40 +0000)]
arm64: generate ISO release images

Some IPMI implementations on arm64 are reportedly unable to load our
memstick installer images, but support the older ISO format. Start
generating these for arm64.

Unlike installer ISOs for other platforms, these images are UEFI-only.

Reviewed by: emaste
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26452

3 years agopkgbase: use consistent annotation for objectk eys
Kyle Evans [Fri, 18 Sep 2020 14:29:01 +0000 (14:29 +0000)]
pkgbase: use consistent annotation for objectk eys

Everywhere else we use objects ("scripts", generally) we do sepcify the
optional colon. Be consistent and do the same for directories.

PR: 249273
Submitted by: Martin <martin.jakob gmx com>
MFC after: 1 week

3 years agoRemove unnecessary include "../Makefile.inc"
Alex Richardson [Fri, 18 Sep 2020 14:05:31 +0000 (14:05 +0000)]
Remove unnecessary include "../Makefile.inc"

This is already pulled in by bsd.init.mk.

Reported By: kevans

3 years agoInitialize some local variables earlier
Mitchell Horne [Fri, 18 Sep 2020 14:01:10 +0000 (14:01 +0000)]
Initialize some local variables earlier

Move the initialization of these variables to the beginning of their
respective functions.

On our end this creates a small amount of unneeded churn, as these
variables are properly initialized before their first use in all cases.
However, changing this benefits at least one downstream consumer
(NetApp) by allowing local and future modifications to these functions
to be made without worrying about where the initialization occurs.

Reviewed by: melifaro, rscheff
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26454

3 years agoAdd pargs, penv, pwdx commands and aliases to procstat(1).
Konstantin Belousov [Fri, 18 Sep 2020 12:59:27 +0000 (12:59 +0000)]
Add pargs, penv, pwdx commands and aliases to procstat(1).

Intent is to mimic Solaris commands with the same names.

Submitted by: Juraj Lutter <juraj@lutter.sk>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26310

3 years agoAssert we are not traversing through superpages in the arm64 pmap.
Mark Johnston [Fri, 18 Sep 2020 12:37:41 +0000 (12:37 +0000)]
Assert we are not traversing through superpages in the arm64 pmap.

Reviewed by: alc, andrew
MFC after: 1 week
Sponsored by: Juniper Networks, Inc., Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26465

3 years agoEnsure that a protection key is selected in pmap_enter_largepage().
Mark Johnston [Fri, 18 Sep 2020 12:30:39 +0000 (12:30 +0000)]
Ensure that a protection key is selected in pmap_enter_largepage().

Reviewed by: alc, kib
Reported by: Coverity
MFC with: r365518
Differential Revision: https://reviews.freebsd.org/D26464

3 years agoFix error checking in shm_create_largepage().
Mark Johnston [Fri, 18 Sep 2020 12:30:15 +0000 (12:30 +0000)]
Fix error checking in shm_create_largepage().

Reviewed by: alc, kib
Reported by: Coverity
MFC with: r365524
Differential Revision: https://reviews.freebsd.org/D26464

3 years agolibarchive: fix mismatch between library and test configuration
Alex Richardson [Fri, 18 Sep 2020 11:22:34 +0000 (11:22 +0000)]
libarchive: fix mismatch between library and test configuration

I was investigating libarchive test failures on CheriBSD and it turns out
we get a reproducible SIGBUS for test_archive_m5, etc. Debugging this shows
that libarchive and the tests disagree when it comes to the definition of
archive_md5_ctx: libarchive assumes it's the OpenSSL type whereas the test
use the libmd type. The latter is not necessarily aligned enough to store
a pointer (16 bytes for CHERI RISC-V), so we were crashing when storing
EVP_MD_CTX* to an 8-byte-aligned archive_md5_ctx.

To avoid problems like this in the future, factor out the common compiler
flags into a Makefile.inc and include that from the tests Makefile.

Reviewed By: lwhsu
Differential Revision: https://reviews.freebsd.org/D26469

3 years agocrypto_buffer(9): Bring back the reference for bus_dma(9)
Gordon Bergling [Fri, 18 Sep 2020 11:04:16 +0000 (11:04 +0000)]
crypto_buffer(9): Bring back the reference for bus_dma(9)

The reference was accidentally deleted in r365855.

Reported by: jhb
Pointy hat to: gbe

3 years agoUse atf_fail instead of exit 1 to indicate mpath tests failure.
Alexander V. Chernikov [Fri, 18 Sep 2020 07:27:01 +0000 (07:27 +0000)]
Use atf_fail instead of exit 1 to indicate mpath tests failure.

3 years agoFix byte-reversal of language ID in string descriptor.
Peter Grehan [Fri, 18 Sep 2020 05:54:59 +0000 (05:54 +0000)]
Fix byte-reversal of language ID in string descriptor.

The language id of String Descriptors in usb mouse is
0x0904, while the spec require 0x0409 (English - United States)

Submitted by: Wanpeng Qian
Reviewed by: grehan
Approved by: grehan (#bhyve)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D26472

3 years agocxgbe(4): add the firmware binaries instead of the empty files that were added
Navdeep Parhar [Fri, 18 Sep 2020 03:11:47 +0000 (03:11 +0000)]
cxgbe(4): add the firmware binaries instead of the empty files that were added
in r365861.

Obtained from: Chelsio Communications
MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agocxgbe(4): add support for stateless offloads for VXLAN traffic.
Navdeep Parhar [Fri, 18 Sep 2020 03:01:47 +0000 (03:01 +0000)]
cxgbe(4): add support for stateless offloads for VXLAN traffic.

Hardware assistance includes checksumming (tx and rx), TSO, and RSS on
the inner traffic in a VXLAN tunnel.

Relnotes: Yes
Sponsored by: Chelsio Communications

3 years agoif_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS.
Navdeep Parhar [Fri, 18 Sep 2020 02:37:57 +0000 (02:37 +0000)]
if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS.

This lets a VXLAN pseudo-interface take advantage of hardware checksumming (tx
and rx), TSO, and RSS if the NIC is capable of performing these operations on
inner VXLAN traffic.

A VXLAN interface inherits the capabilities of its vxlandev interface if one is
specified or of the interface that hosts the vxlanlocal address. If other
interfaces will carry traffic for that VXLAN then they must have the same
hardware capabilities.

On transmit, if_vxlan verifies that the outbound interface has the required
capabilities and then translates the CSUM_ flags to their inner equivalents.
This tells the hardware ifnet that it needs to operate on the inner frame and
not the outer VXLAN headers.

An event is generated when a VXLAN ifnet starts. This allows hardware drivers to
configure their devices to expect VXLAN traffic on the specified incoming port.

On receive, the hardware does RSS and checksum verification on the inner frame.
if_vxlan now does a direct netisr dispatch to take full advantage of RSS. It is
not very clear why it didn't do this already.

Future work:
Rx: it should be possible to avoid the first trip up the protocol stack to get
the frame to if_vxlan just so it can decapsulate and requeue for a second trip
up the stack. The hardware NIC driver could directly call an if_vxlan receive
routine for VXLAN traffic instead.

Rx: LRO. depends on what happens with the previous item. There will have to to
be a mechanism to indicate that it's time for if_vxlan to flush its LRO state.

Reviewed by: kib@
Relnotes: Yes
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoAdd a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port.
Navdeep Parhar [Fri, 18 Sep 2020 02:21:15 +0000 (02:21 +0000)]
Add a knob to allow zero UDP checksums for UDP/IPv6 traffic on the given UDP port.

This will be used by some upcoming changes to if_vxlan(4).  RFC 7348 (VXLAN)
says that the UDP checksum "SHOULD be transmitted as zero.  When a packet is
received with a UDP checksum of zero, it MUST be accepted for decapsulation."
But the original IPv6 RFCs did not allow zero UDP checksum.  RFC 6935 attempts
to resolve this.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoAdd two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic.
Navdeep Parhar [Fri, 18 Sep 2020 02:10:28 +0000 (02:10 +0000)]
Add two new ifnet capabilities for hw checksumming and TSO for VXLAN traffic.

These are similar to the existing VLAN capabilities.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agombuf checksum flags and fields to support tunneling protocols.
Navdeep Parhar [Fri, 18 Sep 2020 01:38:47 +0000 (01:38 +0000)]
mbuf checksum flags and fields to support tunneling protocols.

These are being added to support VXLAN but will work for GENEVE as well.
ENCAP_RSVD1 will likely become ENCAP_GENEVE in the future.

The size of struct mbuf does not change and that means this change can be MFC'd.
If size wasn't a constraint a cleaner way may have been to add inner_csum_flags
and inner_csum_data to go with csum_flags and csum_data.

Reviewed by: kib@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25873

3 years agoState kgssapi dependency on xdr.
Konstantin Belousov [Thu, 17 Sep 2020 22:29:38 +0000 (22:29 +0000)]
State kgssapi dependency on xdr.

Submitted by: Dmitry Afanasiev
PR: 249378
MFC after: 3 days

3 years agocxgbe(4): Update T4/5/6 firmwares to 1.25.0.0.
Navdeep Parhar [Thu, 17 Sep 2020 22:14:11 +0000 (22:14 +0000)]
cxgbe(4): Update T4/5/6 firmwares to 1.25.0.0.

Obtained from: Chelsio Communications
MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoarch(7): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 21:24:11 +0000 (21:24 +0000)]
arch(7): Some markup fixes

- no blank before trailing delimiter

MFC after: 3 days

3 years agoman(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 21:08:11 +0000 (21:08 +0000)]
man(9): Some markup fixes

- whitespace at end of input line
- skipping paragraph macro: Pp after Sh

MFC after: 3 days

3 years agopwmbus(9): some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:55:42 +0000 (20:55 +0000)]
pwmbus(9): some markup fixes

- whitespace at end of input line

MFC after: 3 days

3 years agombuf(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:53:24 +0000 (20:53 +0000)]
mbuf(9): Some markup fixes

- whitespace at end of input line
- no blank before trailing delimiter: Dv MJUM16BYTES

MFC after: 3 days

3 years agocrypto_buffer(9): Sort the SEE ALSO section
Gordon Bergling [Thu, 17 Sep 2020 20:50:02 +0000 (20:50 +0000)]
crypto_buffer(9): Sort the SEE ALSO section

MFC after: 3 days

3 years agoVOP_INACTIVE(9): Remove trailing whitespace
Gordon Bergling [Thu, 17 Sep 2020 20:42:41 +0000 (20:42 +0000)]
VOP_INACTIVE(9): Remove trailing whitespace

MFC after: 3 days

3 years agodomainset(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:37:54 +0000 (20:37 +0000)]
domainset(9): Some markup fixes

- new sentence, new line
- whitespace at end of input line

MFC after: 3 days

3 years agoRevert r361257: bsdinstall: do a `certctl rehash` upon installation [...]
Kyle Evans [Thu, 17 Sep 2020 20:35:45 +0000 (20:35 +0000)]
Revert r361257: bsdinstall: do a `certctl rehash` upon installation [...]

As of r365829, any given base distribution set will now include the /etc/ssl
symlinks that this rehash would've otherwise installed. This extra step is
no longer required.

MFC after: 1 week
X-MFC-With: r365837

3 years agormlock(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:32:10 +0000 (20:32 +0000)]
rmlock(9): Some markup fixes

- new sentence, new line

MFC after: 3 days

3 years agobus_dma(9): Some markup fixes
Gordon Bergling [Thu, 17 Sep 2020 20:25:31 +0000 (20:25 +0000)]
bus_dma(9): Some markup fixes

- new sentence, new line
- no blank before trailing delimiter
- whitespace at end of input line

MFC after: 3 days

3 years agoMerge commit 46673763f from llvm git (by Craig Topper):
Dimitry Andric [Thu, 17 Sep 2020 19:47:41 +0000 (19:47 +0000)]
Merge commit 46673763f from llvm git (by Craig Topper):

  [X86] Place new constant node in topological order in
  X86DAGToDAGISel::matchBitExtract

  Fixes PR47482

This should fix 'Assertion failed: (Op->getNodeId() != -1 && "Node has
already selected predecessor node"), function DoInstructionSelection,
file
/usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp,
line 1149' when compiling part of the project_painter project, while
targeting the bdver2 (or higher) CPU.

Reported by: jkim
MFC after: 6 weeks
X-MFC-With: r364284

3 years agoMerge commit e09107ab8 from llvm git (by Raul Tambre):
Dimitry Andric [Thu, 17 Sep 2020 19:43:25 +0000 (19:43 +0000)]
Merge commit e09107ab8 from llvm git (by Raul Tambre):

  [Sema] Introduce BuiltinAttr, per-declaration builtin-ness

  Instead of relying on whether a certain identifier is a builtin,
  introduce BuiltinAttr to specify a declaration as having builtin
  semantics.

  This fixes incompatible redeclarations of builtins, as reverting the
  identifier as being builtin due to one incompatible redeclaration
  would have broken rest of the builtin calls.
  Mostly-compatible redeclarations of builtins also no longer have
  builtin semantics. They don't call the builtin nor inherit their
  attributes.
  A long-standing FIXME regarding builtins inside a namespace enclosed
  in extern "C" not being recognized is also addressed.

  Due to the more correct handling attributes for builtin functions are
  added in more places, resulting in more useful warnings.
  Tests are updated to reflect that.

  Intrinsics without an inline definition in intrin.h had `inline` and
  `static` removed as they had no effect and caused them to no longer
  be recognized as builtins otherwise.

  A pthread_create() related test is XFAIL-ed, as it relied on it being
  recognized as a builtin based on its name.
  The builtin declaration syntax is too restrictive and doesn't allow
  custom structs, function pointers, etc.
  It seems to be the only case and fixing this would require reworking
  the current builtin syntax, so this seems acceptable.

  Fixes PR45410.

  Reviewed By: rsmith, yutsumi

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

This should fix 'Assertion failed: (i < getNumParams() && "Illegal
param #"), function getParamDecl, file
/usr/src/contrib/llvm-project/clang/include/clang/AST/Decl.h, line 2430'
when building the graphics/pgplot port.

Note that there may also have been other ports which triggered this
assertion, if they redeclare standard functions with incompatible
arguments.

Reported by: zeising
MFC after: 6 weeks
X-MFC-With: r364284

3 years agomakefs: connect cd9660 El Torito EFI boot image system type
Ed Maste [Thu, 17 Sep 2020 19:41:10 +0000 (19:41 +0000)]
makefs: connect cd9660 El Torito EFI boot image system type

Sponsored by: The FreeBSD Foundation

3 years agoCirrus-CI: build as an unprivileged user
Ed Maste [Thu, 17 Sep 2020 18:47:23 +0000 (18:47 +0000)]
Cirrus-CI: build as an unprivileged user

The Cirrus-CI-provided working tree is owned by root.  Leave that as is
for simplicity but build as an unprivileged user; this tests building
with an unmodifiable source tree as a side effect.

Continue running the smoke test as root for now, as it failed when run
as an unprivileged user - pkg reported "Fail to chmod
/usr/bin/.pkgtemp.lpq.dUHpEqPGJ9pq:Operation not permitted"

Sponsored by: The FreeBSD Foundation

3 years agoFix additional memory leak in process_mapfile
Eric van Gyzen [Thu, 17 Sep 2020 18:24:51 +0000 (18:24 +0000)]
Fix additional memory leak in process_mapfile

Additional Coverity detected memory leak fix.

Submitted by: bret_ketchum@dell.com
Reported by: Coverity
Reviewed by: cem, emaste
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26462

3 years agoRemove no longer used variable.
John Baldwin [Thu, 17 Sep 2020 18:06:57 +0000 (18:06 +0000)]
Remove no longer used variable.

Pointy hat to: jhb
Reported by: kevans
MFC after: 1 week

3 years agoMove to a more robust and conservative alloation scheme for devctl messages
Warner Losh [Thu, 17 Sep 2020 17:29:33 +0000 (17:29 +0000)]
Move to a more robust and conservative alloation scheme for devctl messages

Change the zone setup:
- Allow slabs to be returned to the OS
- Set the number of slots to the max devctl will queue before discarding
- Reserve 2% of the max (capped at 100) for low memory allocations
- Disable per-cpu caching since we don't need it and we avoid some pathologies

Change the alloation strategiy a bit:
- If a normal allocation fails, try to get the reserve
- If a reserve allocation fails, re-use the oldest-queued entry for storage
- If there's a weird race/failure and nothing on the queue to steal, return NULL

This addresses two main issues in the old code:
- If devd had died, and we're generating a lot of messages, we have an
  unbounded leak. This new scheme avoids the issue that lead to this.
- The MPASS that was 'sure' the allocation couldn't have failed turned out
  to be wrong in some rare cases. The new code doesn't make this assumption.

Since we reserve only 2% of the space, we go from about 1MB of
allocation all the time to more like 50kB for the reserve.

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

3 years agoRemove support for setting some obscure fields.
John Baldwin [Thu, 17 Sep 2020 17:07:04 +0000 (17:07 +0000)]
Remove support for setting some obscure fields.

Don't permit setting the exception bitmap or VMCS entry interrupt
information.  These are not generally useful to set.  If it is needed
in the future, dedicated pseudo registers can be added for these that
would be used with vm_set_register().

Discussed with: grehan
MFC after: 1 week

3 years agoIncrease the default vm.max_user_wired value.
Mark Johnston [Thu, 17 Sep 2020 16:49:28 +0000 (16:49 +0000)]
Increase the default vm.max_user_wired value.

Since r347532 (merged to stable/12) we only count user-wired pages
towards the system limit.  However, we now also treat pages wired by
hypervisors (bhyve and virtualbox) as user-wired, so starting VMs with
large amounts of RAM tends to fail due to the low limit.

The purpose of the limit is to provide a seatbelt, not to impose some
policy on the use of wired memory.  Thus, increase the default limit to
allow reasonable VM configurations to work without tuning.

Reviewed by: kib
Discussed with: dougm
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26424

3 years agoAdd some basic regression tests for SHM_LARGEPAGE.
Mark Johnston [Thu, 17 Sep 2020 16:44:12 +0000 (16:44 +0000)]
Add some basic regression tests for SHM_LARGEPAGE.

Discussed with: kib
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D25900

3 years agoPromote the installworld `certctl rehash` to distributeworld
Kyle Evans [Thu, 17 Sep 2020 15:58:42 +0000 (15:58 +0000)]
Promote the installworld `certctl rehash` to distributeworld

Contrary to my belief, installworld is not sufficient for getting certs
installed into VM images. Promote the rehash to both installworld and
distributeworld (notably: not stageworld) and rehash the base distdir so we
end up with /etc/ssl/certs populated in the base dist archive. A future
commit will remove the rehash from bsdinstall, which doesn't really need to
happen if they're installed into base.txz.

While here, fix a minor typo: s/CERTCLTFLAGS/CERTCTLFLAGS/

MFC after: 1 week

3 years agoStop using lorder and ranlib when building libraries
Alex Richardson [Thu, 17 Sep 2020 15:07:25 +0000 (15:07 +0000)]
Stop using lorder and ranlib when building libraries

Use of ranlib or lorder is no longer necessary with current linkers
(probably anything newer than ~1990) and ar's ability to create an object
index and symbol table in the archive.
Currently the build system uses lorder+tsort to sort the .o files in
dependency order so that a single-pass linker can use them. However,
we can use the -s flag to ar to add an index to the .a file which makes
lorder unnecessary.
Running ar -s is equivalent to running ranlib afterwards, so we can also
skip the ranlib invocation.

Similarly, we don't have to pass the .o files for shared libraries in
dependency order since both ld.bfd and ld.lld will correctly resolve
references between the .o files.

This removes many fork()+execve calls for each library so should speed up
builds a bit. Additionally lorder.sh uses a regular expression that is not
supported by the macOS libc or glibc and results in many warnings when
cross-building (see D25989).

There is one functional change: lorder.sh removed duplicated .o files
from the linker command line which now no longer happens. I fixed the duplicates
in the base system in r364649. I also checked the ports tree for uses of
bsd.lib.mk and found one duplicate source file which I fixed in r548168.
Most ports use CMake/autotools rather than bsd.lib.mk but if this breaks any
ports that I missed in my search please let me know.

Avoiding the shell script actually speeds up the linking step noticeably: I
measured how long it takes to rebuild the .a and .so files for lib/libc using a
basic benchmark: `rm $LIBC_OBJDIR/*.so* $LIBC_OBJDIR/*.a* && /usr/bin/time make -DWITHOUT_TESTS -s > /dev/null`
Without this change ~4.5 seconds and afterwards ~3.1 seconds.
Looking at truss -cf output we can see that the number fork() system
calls goes down from 27 to 12 (and the speedup while tracing is more
noticeable: 81 seconds -> 65 seconds).

See also https://www.gnu.org/software/coreutils/manual/html_node/tsort-background.html
for some more background:
This whole procedure has been obsolete since about 1980, because Unix
archives now contain a symbol table (traditionally built by ranlib, now
generally built by ar itself), and the Unix linker uses the symbol table
to effectively make multiple passes over an archive file.

Or alternatively https://www.unix.com/man-page/osf1/1/lorder/:
The lorder command is essentially obsolete.  Use the following command in
its place: % ar -ts file.a

Reviewed By:  emaste, imp, dim
Differential Revision: https://reviews.freebsd.org/D26044

3 years agoAdd dtb/sifive module
Mitchell Horne [Thu, 17 Sep 2020 14:58:30 +0000 (14:58 +0000)]
Add dtb/sifive module

This allows building the HiFive Unleashed device tree blob.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D26459