]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMakefile.inc1:
gjb [Thu, 16 Jul 2020 20:34:26 +0000 (20:34 +0000)]
Makefile.inc1:
- New file.  Adds logic to search for the git binary, as well
  as determining the branch and revision, used in various
  places.

Makefile:
- Remove searching for the svn{,lite} binary.

Makefile.ec2:
- Reduce duplicated code, removing searching for the svn{,lite}
  binary, in addition to EC2_SVN{BRANCH,REV}.
- Rename EC2_SVN* with GIT* for consistency.

Makefile.mirrors:
- Remove the SRCBRANCH declaration, replaced with the exported
  GITBRANCH variable.
- Update _SNAP_SUFFIX from SVNREVISION to GITREV, and remove
  the leading 'r' from it, since it will break git hashes.
- Remove yet another instance of duplicated code to search for
  the svn{,version}lite binary.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFH
gjb [Thu, 16 Jul 2020 17:14:34 +0000 (17:14 +0000)]
MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years ago(Re)-allow 0.0.0.0 to be used as an address in connect() for TCP
tuexen [Thu, 16 Jul 2020 16:46:24 +0000 (16:46 +0000)]
(Re)-allow 0.0.0.0 to be used as an address in connect() for TCP
In r361752 an error handling was introduced for using 0.0.0.0 or
255.255.255.255 as the address in connect() for TCP, since both
addresses can't be used. However, the stack maps 0.0.0.0 implicitly
to a local address and at least two regressions were reported.
Therefore, re-allow the usage of 0.0.0.0.
While there, change the error indicated when using 255.255.255.255
from EAFNOSUPPORT to EACCES as mentioned in the man-page of connect().

Reviewed by: rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D25401

3 years agoAdd VIRTIO_BLK_T_DISCARD support to the virtio-blk driver
allanjude [Thu, 16 Jul 2020 16:32:16 +0000 (16:32 +0000)]
Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver

If the hypervisor advertises support for the DISCARD command then the
guest can perform TRIM commands, freeing space on the backing store.

If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE

Tested with FreeBSD guests on bhyve and KVM

Reviewed by: jhb
Tested by: freqlabs
MFC after: 1 month
Relnotes: yes
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D21708

3 years agoAdd a RELNOTES entry for r363253.
markj [Thu, 16 Jul 2020 15:12:52 +0000 (15:12 +0000)]
Add a RELNOTES entry for r363253.

Sponsored by: The FreeBSD Foundation

3 years agoSwitch from SCTP to SCTP_SUPPORT in GENERIC configs.
markj [Thu, 16 Jul 2020 15:09:04 +0000 (15:09 +0000)]
Switch from SCTP to SCTP_SUPPORT in GENERIC configs.

This removes SCTP from in-tree kernel configuration files.  Now, SCTP
can be enabled by simply loading the module, as discussed on
freebsd-net@.

Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25611

3 years agotuntap: drop redundant if_mtu assignment in tuncreate
kevans [Thu, 16 Jul 2020 15:02:11 +0000 (15:02 +0000)]
tuntap: drop redundant if_mtu assignment in tuncreate

ether_ifattach will immediately clobber if_mtu with ETHERMTU anyways, just
let it happen.

MFC after: 1 week

3 years agosafexcel(4): Silence an integer truncation warning.
markj [Thu, 16 Jul 2020 14:21:55 +0000 (14:21 +0000)]
safexcel(4): Silence an integer truncation warning.

In practice overflow is not possible, but we might as well use the right
type for DMA ring sizes.

CID: 1430468
MFC after: 1 week

3 years agoRelax the rule against declaring variables in nested scopes and for
imp [Thu, 16 Jul 2020 14:12:54 +0000 (14:12 +0000)]
Relax the rule against declaring variables in nested scopes and for
initializations.

Relax some overly perscriptive rules against declarations: they may be at the
start of any blocks, even if things aren't super complicated. Allow more
initializations (those that call simple functions, like accessor functions for
newbus are fine). Allow the common idiom of declaring the loop variable in a for
loop.

This tries to codify what common exceptions are today, as well as give
some guidance on when it's best to do these things.

Reviewed by: tsoome, kp, markm, allanjude, jiles, cem, rpokala
(earlier versions: seanc, melifaro, bapt, pjd, bz, pstef, arichards,
 jhibits, vangyzen, jmallet, ian, glebius, jhb, dab, adrian,
 sef, gnn)
Differential Revision: https://reviews.freebsd.org/D25312

3 years agovfs: fix vn_poll performance with either MAC or AUDIT
mjg [Thu, 16 Jul 2020 14:09:18 +0000 (14:09 +0000)]
vfs: fix vn_poll performance with either MAC or AUDIT

The code would unconditionally lock the vnode to audit or call the
mac hoook, even if neither want to do anything. Pre-check the state
to avoid locking in the common case of nothing to do.

Note this code should not be normally executed anyway as vnodes are
always return ready. However, poll1/2 from will-it-scale use regular
files for benchmarking, presumably to focus on the interface itself
as the vnode handler is not supposed to do almost anything.

This in particular fixes poll2 which passes 128 fds.

$ ./poll2_processes -s 10
before: 134411
after:  271572

3 years agoRemove old devd rules for ActiveWire and Entrega Serial DB25
0mp [Thu, 16 Jul 2020 14:04:29 +0000 (14:04 +0000)]
Remove old devd rules for ActiveWire and Entrega Serial DB25

Those rules have been broken at least since 8-STABLE, when the port
providing the ezdownload binary was removed (misc/ezload).

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

3 years agovfs: fix MAC/AUDIT mismatch in vn_poll
mjg [Thu, 16 Jul 2020 14:04:28 +0000 (14:04 +0000)]
vfs: fix MAC/AUDIT mismatch in vn_poll

Auditing would not be performed without MAC compiled in.

3 years agoether_ifattach: set mtu before calling if_attach()
kevans [Thu, 16 Jul 2020 13:37:32 +0000 (13:37 +0000)]
ether_ifattach: set mtu before calling if_attach()

if_attach() -> if_attach_internal() will call if_attachdomain1(ifp) any time
an ethernet interface is setup *after*
SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_FIRST.  This eventually leads to
nd6_ifattach() -> nd6_setmtu0() stashing off ifp->if_mtu in ndi->maxmtu
*before* ifp->if_mtu has been properly set in some scenarios, e.g., USB
ethernet adapter plugged in later on.

For interfaces that are created in early boot, we don't have this issue as
domains aren't constructed enough for them to attach and thus it gets
deferred to domainifattach at SI_SUB_PROTO_IFATTACHDOMAIN/SI_ORDER_SECOND
*after* the mtu has been set earlier in ether_ifattach().

PR: 248005
Submitted by: Mathew <mjanelle blackberry com>
MFC after: 1 week

3 years agoamd64: patch ffsl to use the compiler builtin
mjg [Thu, 16 Jul 2020 11:28:24 +0000 (11:28 +0000)]
amd64: patch ffsl to use the compiler builtin

This shortens fdalloc by over 60 bytes. Correctness verified by running both
variants at the same time and comparing the result of each call.

Note someone(tm) should make a pass at converting everything else feasible.

3 years agoefibootmgr: typo in long option name
tsoome [Thu, 16 Jul 2020 10:20:35 +0000 (10:20 +0000)]
efibootmgr: typo in long option name

del-timout should be del-timeout

Reported by: mjg
MFC after: 1 week

3 years ago[ar71xx] fix watchdog to work on subsequent SoCs
adrian [Wed, 15 Jul 2020 19:34:19 +0000 (19:34 +0000)]
[ar71xx] fix watchdog to work on subsequent SoCs

The AR9341 AHB runs at 225MHz, much faster than the 33MHz of the
AR71xx AHB.  So not only is the math going to do weird things, it
will also wrap rather than being clamped.

So:

* clamp! don't wrap!
* tidy up some debugging
* add an option to throw an NMI rather than reset!

Tested:

* AR9341 SoC (TP-Link TL-WDR4300), patting/not patting the watchdog!

3 years agoopenssh: refer to OpenSSL not SSLeay, part 2
emaste [Wed, 15 Jul 2020 18:49:00 +0000 (18:49 +0000)]
openssh: refer to OpenSSL not SSLeay, part 2

This change was made upstream between 7.9p1 and 8.0p1.  We've made local
changes in the same places for handling the version_addendum; apply the
SSLeay_version to OpenSSL_version change in advance of importing 8.0p1.
This should have been part of r363225.

Obtained from: OpenSSH-portable a65784c9f9c5
MFC with: r363225
Sponsored by: The FreeBSD Foundation

3 years agoNote the merge of sendmail 8.16.1 from vendor "branch"
gshapiro [Wed, 15 Jul 2020 18:32:09 +0000 (18:32 +0000)]
Note the merge of sendmail 8.16.1 from vendor "branch"

3 years agoMerge sendmail 8.16.1 to HEAD: See contrib/sendmail/RELEASE_NOTES for details
gshapiro [Wed, 15 Jul 2020 18:28:54 +0000 (18:28 +0000)]
Merge sendmail 8.16.1 to HEAD: See contrib/sendmail/RELEASE_NOTES for details
Includes build infrastructure & config updates required for changes in 8.16.1

MFC after: 5 days

3 years agobuild DTS for Orange Pi PC Plus as well
avg [Wed, 15 Jul 2020 18:04:01 +0000 (18:04 +0000)]
build DTS for Orange Pi PC Plus as well

Reviewed by: manu
MFC after: 1 week

3 years agoAllow install(1)'s create_tempfile() to work on Linux hosts
arichardson [Wed, 15 Jul 2020 17:24:39 +0000 (17:24 +0000)]
Allow install(1)'s create_tempfile() to work on Linux hosts

GLibc expects six 'X' characters in the mkstemp template argument and
will return EINVAL otherwise.

Reviewed By: emaste, imp, mjg
Differential Revision: https://reviews.freebsd.org/D25662

3 years agoRemove warning that is no longer accurate after r361853
arichardson [Wed, 15 Jul 2020 17:24:34 +0000 (17:24 +0000)]
Remove warning that is no longer accurate after r361853

We now build the skein assembly with clangs integrated assembler.

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

3 years agoDon't imply that all action values can be OR'd.
brooks [Wed, 15 Jul 2020 17:05:37 +0000 (17:05 +0000)]
Don't imply that all action values can be OR'd.

This is neither POSIX compliant nor what the implementation does.
This could be allowed by changing the value of TCSAFLUSH from 2 to 3,
but that doesn't seem worthwhile after 25+ years.

Reviewed by: imp
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25659

3 years agoImprove description of the vector argument for i386 smp_targeted_tlb_shootdown().
kib [Wed, 15 Jul 2020 16:12:00 +0000 (16:12 +0000)]
Improve description of the vector argument for i386 smp_targeted_tlb_shootdown().

Submitted by: alc
MFC after: 20 days

3 years agoopenssh: refer to OpenSSL not SSLeay
emaste [Wed, 15 Jul 2020 15:35:26 +0000 (15:35 +0000)]
openssh: refer to OpenSSL not SSLeay

This change was made upstream between 7.9p1 and 8.0p1.  We've made local
changes in the same places for handling the version_addendum; apply the
SSLeay_version to OpenSSL_version change in advance of importing 8.0p1.

Obtained from: OpenSSH-portable a65784c9f9c5
Sponsored by: The FreeBSD Foundation

3 years agozpool-features(7): Note that the boot loader has support for large_blocks
allanjude [Wed, 15 Jul 2020 14:38:15 +0000 (14:38 +0000)]
zpool-features(7): Note that the boot loader has support for large_blocks

Since r304321 (-current: Aug 18, 2016) and r328866 (stable/11: Feb 5, 2018)
the FreeBSD loader has supported reading from datasets with the
large_blocks feature active.

PR: 247992
Reported by: Anton Saietskii <vsasjason@gmail.com>
MFC after: 2 weeks
Sponsored by: Klara Inc.

3 years agovlan(4): Minor grammar corrections
allanjude [Wed, 15 Jul 2020 14:27:23 +0000 (14:27 +0000)]
vlan(4): Minor grammar corrections

Note: date not bumped because "content" was not changed, just inserted some
missing words.

PR: 248001
Submitted by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 2 weeks
Sponsored by: Klara Inc.

3 years ago[PowerPC] Use PVO_PADDR to get the PA from PVO
luporl [Wed, 15 Jul 2020 13:43:48 +0000 (13:43 +0000)]
[PowerPC] Use PVO_PADDR to get the PA from PVO

Use PVO_PADDR macro to get the physical address from a PVO, instead of
explicitly ANDing pvo_pte.pa with LPTE_RPGN where it is needed.  Besides
improving readability, this is needed to support superpages (D25237), where
the steps to get the PA from a PVO are different.

Reviewed by: markj
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D25654

3 years agoFix style in r363220
vangyzen [Wed, 15 Jul 2020 13:26:15 +0000 (13:26 +0000)]
Fix style in r363220

Apply the style change Kostik suggested in the review.

Reported by: kib
MFC after: 2 weeks
X-MFC with: r363220
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D25676

3 years agoFix Coverity issues in OFED
vangyzen [Wed, 15 Jul 2020 13:17:16 +0000 (13:17 +0000)]
Fix Coverity issues in OFED

read_ibdiag_config NULL deref
read_ibdiag_config mem leak
ib_mad_inv_field_str Missing comma in a string array initialization
print_node_header NULL deref
diff_node_ports copy-paste error
ibportstate.c main() missing break in switch
set_thresholds NULL ptr deref
dump_unicast_tables leaks mapnd
umad_cm_attr_str dead code
__ibv_close_device close(-1)
check return value of listen()
mlx5 bitmap.h - bad bit shift - UB
get_dst_addr check return value of inet_pton
osm_perfmgr_init check return value of cl_spinlock_init
osm_port_new memory leak on error path
sa_mad_ctrl_rcv_callback missing break in switch case

I did not include CID numbers because these were found by an internal
run at Isilon.

Reviewed by: cem kib
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D25676

3 years agoFix BUILD_WITH_STRICT_TMPPATH builds
arichardson [Wed, 15 Jul 2020 12:08:06 +0000 (12:08 +0000)]
Fix BUILD_WITH_STRICT_TMPPATH builds

We need dd in $PATH for some of the MK_BOOT code and some tests also use it.

Obtained from: CheriBSD

3 years agoAllow bootstrapping localdef on non-FreeBSD systems
arichardson [Wed, 15 Jul 2020 12:07:59 +0000 (12:07 +0000)]
Allow bootstrapping localdef on non-FreeBSD systems

The current localedef simply assumes that the locale headers on build system
are compatible with those on the target system which is not necessarily true.
It generally works on FreeBSD (as long as we don't change the locale headers),
but Linux and macOS provide completely different locale headers.

This change adds new bootstrap headers that namespace certain xlocale
structures defined or used by in the headers that localdef needs.
This is required since system headers *must* be able to include the "real"
locale headers for printf(), etc., but we also want to access the target
systems's internal locale structures.

Reviewed By: yuripv, brooks
Differential Revision: https://reviews.freebsd.org/D25229

3 years agoAdd missing newline and return in localedef error message
arichardson [Wed, 15 Jul 2020 12:07:53 +0000 (12:07 +0000)]
Add missing newline and return in localedef error message

I hit those error messages when using a localedef built against headers
that don't match the target system (cross-building from a Linux host).
This problem will be fixed in the next commit.

3 years agoAvoid rebuilding libpmc in every incremental rebuild
arichardson [Wed, 15 Jul 2020 12:07:47 +0000 (12:07 +0000)]
Avoid rebuilding libpmc in every incremental rebuild

Generate libpmc_events.c in a temporary file first and only overwrite it
if the files are actually different.
This avoids compiling and relinking the different variants of libpmc on
every incremental build.

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D24784

3 years agopoll: factor fd lookup out of scan and rescan
mjg [Wed, 15 Jul 2020 10:24:39 +0000 (10:24 +0000)]
poll: factor fd lookup out of scan and rescan

3 years agofd: remove fd_lastfile
mjg [Wed, 15 Jul 2020 10:24:04 +0000 (10:24 +0000)]
fd: remove fd_lastfile

It keeps recalculated way more often than it is needed.

Provide a routine (fdlastfile) to get it if necessary.

Consumers may be better off with a bitmap iterator instead.

3 years agofd: add obvious branch predictions to fdalloc
mjg [Wed, 15 Jul 2020 10:14:00 +0000 (10:14 +0000)]
fd: add obvious branch predictions to fdalloc

3 years agolibprocstat: fix kvm filedesc access after introduction of fdescenttbl
mjg [Wed, 15 Jul 2020 10:13:23 +0000 (10:13 +0000)]
libprocstat: fix kvm filedesc access after introduction of fdescenttbl

3 years agoGrammar and typo fixes.
kib [Wed, 15 Jul 2020 09:48:36 +0000 (09:48 +0000)]
Grammar and typo fixes.

Submitted by: alc
MFC after: 20 days

3 years agoFix the pNFS flexible file layout client for servers with small write size.
rmacklem [Wed, 15 Jul 2020 01:26:28 +0000 (01:26 +0000)]
Fix the pNFS flexible file layout client for servers with small write size.

The code in nfscl_dofflayout() loops when a flexible file layout server
provides a small write data limit (no extant server is known to do this).
If/when it looped, it erroneously reused the "drpc" argument for the
mirror worker thread, corrupting it.
This patch fixes the problem by only using the calling thread after the
first loop iteration.

Found during testing by simulating a server with a small write size.

Since no extant pNFS server is known to provide a small write size,
this fix it not needed in practice at this time.

MFC after: 2 weeks

3 years agoRemove obsolete files after byacc 20200330 import (r363171).
jkim [Wed, 15 Jul 2020 00:13:15 +0000 (00:13 +0000)]
Remove obsolete files after byacc 20200330 import (r363171).

Reported by: lwhsu

3 years agoRemove a redundant file from test directory to unbreak yacc regression test.
jkim [Tue, 14 Jul 2020 23:59:00 +0000 (23:59 +0000)]
Remove a redundant file from test directory to unbreak yacc regression test.

It looks like the obsolete file from old regression test was accidentally
re-added between version 20170709 and 20180510.

Reported by: lwhsu

3 years agotop: VIS_SAFE turned out to be unsafe
yuripv [Tue, 14 Jul 2020 22:43:40 +0000 (22:43 +0000)]
top: VIS_SAFE turned out to be unsafe

Unset VIS_SAFE flag as it turned out to be actually unsafe
for continuos top display as it's passing through sequences
resulting cursor movement (backspace, tab, carriage-return),
and explicitly set VIS_TAB for the same reason.

Reported by: Mark Millard <marklmi@yahoo.com>, swills
Tested by: Mark Millard <marklmi@yahoo.com>, swills

3 years agohwpmc: Always set pmc_cpuid to something
freqlabs [Tue, 14 Jul 2020 22:25:06 +0000 (22:25 +0000)]
hwpmc: Always set pmc_cpuid to something

pmc_cpuid was uninitialized for most AMD processor families.  We can still
populate this string for unimplemented families.

Also added a CPUID_TO_STEPPING macro and converted existing code to use it.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D25673

3 years agolinuxkpi: Ignore NULL pointers passed to string parameter of kstr(n)dup
wulf [Tue, 14 Jul 2020 21:56:59 +0000 (21:56 +0000)]
linuxkpi: Ignore NULL pointers passed to string parameter of kstr(n)dup

That follows Linux and fixes related drm-kmod-5.3 panic.

Reviewed by: imp, hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25657

3 years agoImport sendmail 8.16.1
gshapiro [Tue, 14 Jul 2020 21:40:53 +0000 (21:40 +0000)]
Import sendmail 8.16.1

3 years agocache: make negative shrinker round robin on all lists every time
mjg [Tue, 14 Jul 2020 21:19:33 +0000 (21:19 +0000)]
cache: make negative shrinker round robin on all lists every time

Previously it would check 4, 3, 2, 1 lists. In practice by the time
it is getting called all lists have some elements and consequently
this does not result in new evictions.

Nonetheless, the code is clearer.

Tested by: pho

3 years agocache: remove numcalls
mjg [Tue, 14 Jul 2020 21:17:46 +0000 (21:17 +0000)]
cache: remove numcalls

The counter is not very useful and if necessary the value can be
found by summing up other counters.

3 years agocache: count dropped entries
mjg [Tue, 14 Jul 2020 21:17:08 +0000 (21:17 +0000)]
cache: count dropped entries

3 years agocache: remove neg_locked argument from cache_zap_locked
mjg [Tue, 14 Jul 2020 21:16:48 +0000 (21:16 +0000)]
cache: remove neg_locked argument from cache_zap_locked

Tested by: pho

3 years agocache: remove a useless argument from cache_negative_insert
mjg [Tue, 14 Jul 2020 21:16:07 +0000 (21:16 +0000)]
cache: remove a useless argument from cache_negative_insert

3 years agoReally fix cleandir after r362973
mhorne [Tue, 14 Jul 2020 21:15:16 +0000 (21:15 +0000)]
Really fix cleandir after r362973

I made an attempt to fix this in r362978, but all it really did was
confine the issue to the $MACHINE_CPUARCH == "riscv" case. The real
problem is that LINKER_FEATURES is not defined here, so bsd.linker.mk
needs to be included.

This error with cleandir only occurs when META_MODE is disabled, which
explains why it was missed by both CI and myself.

Note that this effectively reverts r362978.

Reported by: mjg
Reviewed by: imp, kevans (in IRC)

3 years agocache: create a dedicate struct for negative entries
mjg [Tue, 14 Jul 2020 21:14:59 +0000 (21:14 +0000)]
cache: create a dedicate struct for negative entries

.. and stuff if into the unused target vnode field

This gets rid of concurrent nc_flag modifications racing with the
shrinker and consequently fixes a bug where such a change could have
been missed when cache_ncp_invalidate was being issued..

Reported by: zeising
Tested by: pho, zeising
Fixes: r362828 ("cache: lockless forward lookup with smr")

3 years agoamd64: allow parallel shootdown IPIs
kib [Tue, 14 Jul 2020 20:37:50 +0000 (20:37 +0000)]
amd64: allow parallel shootdown IPIs

Stop using smp_ipi_mtx to protect global shootdown state, and
move/multiply the global state into pcpu.  Now each CPU can initiate
shootdown IPI independently from other CPUs.  Initiator enters
critical section, then fills its local PCPU shootdown info
(pc_smp_tlb_XXX), then clears scoreboard generation at location (cpu,
my_cpuid) for each target cpu.  After that IPI is sent to all targets
which scan for zeroed scoreboard generation words.  Upon finding such
word the shootdown data is read from corresponding cpu' pcpu, and
generation is set.  Meantime initiator loops waiting for all zeroed
generations in scoreboard to update.

Initiator does not disable interrupts, which should allow
non-invalidation IPIs from deadlocking, it only needs to disable
preemption to pin itself to the instance of the pcpu smp_tlb data.

The generation is set before the actual invalidation is performed in
handler. It is safe because target CPU cannot return to userspace
before handler finishes. In principle only NMI can preempt the
handler, but NMI would see the kernel handler frame and not touch
not-invalidated user page table.

Handlers loop until they do not see zeroed scoreboard generations.
This, together with hardware keeping one pending IPI in LAPIC IRR
should prevent lost shootdowns.

Notes.
1. The code does protect writes to LAPIC ICR with exclusion. I believe
   this is fine because we in fact do not send IPIs from interrupt
   handlers. More for !x2APIC mode where ICR access for write requires
   two registers write, we disable interrupts around it. If considered
   incorrect, I can add per-cpu spinlock around ipi_send().
2. Scoreboard lines owned by given target CPU can be padded to the
   cache line, to reduce ping-pong.

Reviewed by: markj (previous version)
Discussed with: alc
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D25510

3 years agoImprove the error handling in generating ASCONF chunks.
tuexen [Tue, 14 Jul 2020 20:32:50 +0000 (20:32 +0000)]
Improve the error handling in generating ASCONF chunks.
In case of errors, the cleanup was not consistent.
Thanks to Felix Weinrank for fuzzing the userland stack and making
me aware of the issue.

MFC after: 1 week

3 years agoMake CLOCK_REALTIME and TIMER_ABSTIME available for XOPEN_SOURCE >= 500.
kib [Tue, 14 Jul 2020 20:23:27 +0000 (20:23 +0000)]
Make CLOCK_REALTIME and TIMER_ABSTIME available for XOPEN_SOURCE >= 500.

Reported by: jbeich
PR: 247701
Reviewed by: jilles
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D25554

3 years agoUpdate to D25266, bin/ps: Make the rtprio option actually show
mckusick [Tue, 14 Jul 2020 18:57:31 +0000 (18:57 +0000)]
Update to D25266, bin/ps: Make the rtprio option actually show
realtime priorities

The current `ps -axO rtprio' show threads running at interrupt
priority such as the [intr] thread as '1:48' and threads running
at kernel priority such as [pagedaemon] as normal:4294967260.

This change shows [intr] as intr:48 and [pagedaemon] as kernel:4.

Reviewed by:    kib
MFC after: 1 week (together with -r362369)
Differential Revision: https://reviews.freebsd.org/D25660

3 years agoPrint the arm64 registers in more exception handling panics
andrew [Tue, 14 Jul 2020 18:50:48 +0000 (18:50 +0000)]
Print the arm64 registers in more exception handling panics

It can be useful to get a dump of all registers when investigating why we
received an exception that we are unable to handle. In these cases we
already call panic, however we don't always print the registers.

Add calls to print_registers and print esr and far when applicable.

Sponsored by: Innovate UK

3 years agoAdd stepping to the kern.hwpmc.cpuid string on x86.
mav [Tue, 14 Jul 2020 18:11:05 +0000 (18:11 +0000)]
Add stepping to the kern.hwpmc.cpuid string on x86.

It follows the equivalent Linux change to be able to differentiate
skylakex and cascadelakex, sharing the same model but not stepping.

This fixes skylakex handling broken by r363144.

MFC after: 6 days

3 years agoEnable EFI system partition on amd64 and i386 VM images
gonzo [Tue, 14 Jul 2020 18:02:24 +0000 (18:02 +0000)]
Enable EFI system partition on amd64 and i386 VM images

EFI support is a hard requirement for generating Hyper-V Gen2 VM images.

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

3 years agoAdd a RELNOTES entry for safexcel(4).
markj [Tue, 14 Jul 2020 15:05:38 +0000 (15:05 +0000)]
Add a RELNOTES entry for safexcel(4).

Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agosafexcel(4): Fix the INVARIANTS build after a last-second change.
markj [Tue, 14 Jul 2020 15:05:24 +0000 (15:05 +0000)]
safexcel(4): Fix the INVARIANTS build after a last-second change.

Reported by: Jenkins
MFC with: r363180

3 years agoAdd safexcel(4) to cryptotest.
markj [Tue, 14 Jul 2020 14:11:54 +0000 (14:11 +0000)]
Add safexcel(4) to cryptotest.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)

3 years agoAdd a driver for the SafeXcel EIP-97.
markj [Tue, 14 Jul 2020 14:09:29 +0000 (14:09 +0000)]
Add a driver for the SafeXcel EIP-97.

The EIP-97 is a packet processing module found on the ESPRESSObin.  This
commit adds a crypto(9) driver for the crypto and hash engine in this
device.  An initial skeleton driver that could attach and submit
requests was written by loos and others at Netgate, and the driver was
finished by me.

Support for separate AAD and output buffers will be added in a separate
commit, to simplify merging to stable/12 (where those features don't
exist).

Reviewed by: gnn, jhb
Feedback from: andrew, cem, manu
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC (Netgate)
Differential Revision: https://reviews.freebsd.org/D25417

3 years agoRevert r362809: Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).
gbe [Tue, 14 Jul 2020 12:02:30 +0000 (12:02 +0000)]
Revert r362809: Mention FreeBSD in the HISTORY sections of apropos(1) and makewhatis(8).

We don't mention the first appearance of a utility in FreeBSD, when it first
appeared in a BSD version that predates FreeBSD.

PR: 223520, 223521
Reported by: rgrimes, imp
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
Differential Revision: https://reviews.freebsd.org/D25521

3 years agoStart splitting-out the Intel DMAR busdma backend to a generic place,
br [Tue, 14 Jul 2020 10:55:19 +0000 (10:55 +0000)]
Start splitting-out the Intel DMAR busdma backend to a generic place,
so it can be used on other IOMMU systems.

Provide MI iommu_unit, iommu_domain and iommu_ctx structs in sys/iommu.h;
use them as a first member of MD dmar_unit, dmar_domain and dmar_ctx.

Change the namespace in DMAR backend: use iommu_ prefix instead of dmar_.

Move some macroses and function prototypes to sys/iommu.h.

Reviewed by: kib
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D25574

3 years ago[pmc] whoops, remove spurious #'s
adrian [Tue, 14 Jul 2020 05:33:23 +0000 (05:33 +0000)]
[pmc] whoops, remove spurious #'s

pointed out by gonzo@, thanks!

3 years ago[hwpmc] Compile 'pmc' only if we have C++11.
adrian [Tue, 14 Jul 2020 05:10:50 +0000 (05:10 +0000)]
[hwpmc] Compile 'pmc' only if we have C++11.

I noticed when compiling with ye olde gcc-6.3.0 on mips that it tripped over
a lack of C++11 bits.  This allows it to compile fine.

3 years ago[ipfw] quieten maybe-uninitialized errors in ipfw when compiled under mips-gcc-6...
adrian [Tue, 14 Jul 2020 05:07:16 +0000 (05:07 +0000)]
[ipfw] quieten maybe-uninitialized errors in ipfw when compiled under mips-gcc-6.3.0.

This is mostly an exercise to set variables to NULL/0 when declared, but
one was ensuring a string variable was set before printing it.
We should never see "<unknown>" in a printed rule; if we do then this code
definitely has some bugs that need addressing.

3 years ago[bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.
adrian [Tue, 14 Jul 2020 05:02:18 +0000 (05:02 +0000)]
[bc] Fix a "maybe uninitialized" compiler warning under mips-gcc-6.3.0.

I guess this didn't like the case statements.. ? But this does quieten
the compiler error.

3 years ago[flex] Fix compilation issue under mips-gcc-6.4
adrian [Tue, 14 Jul 2020 05:00:08 +0000 (05:00 +0000)]
[flex] Fix compilation issue under mips-gcc-6.4

This was triggering a pointer-losing-constness error.

3 years agoMFV: r362513
jkim [Tue, 14 Jul 2020 01:54:24 +0000 (01:54 +0000)]
MFV: r362513

Update byacc to 20200330.

3 years agoActually install the new 221.backup-gpart periodic script
allanjude [Tue, 14 Jul 2020 00:46:20 +0000 (00:46 +0000)]
Actually install the new 221.backup-gpart periodic script

Submitted by: Rob Fairbanks <rob.fx907@gmail.com>
Reported by: Michael Butler <imb@protected-networks.net>
MFC with: r363110
Sponsored by: Klara Inc.

3 years agocxgbev(4): Compare at most 16 bytes of the Ethernet header when trying
np [Mon, 13 Jul 2020 19:15:29 +0000 (19:15 +0000)]
cxgbev(4): Compare at most 16 bytes of the Ethernet header when trying
to coalesce tx work requests.

Note that Coverity will still treat this as an out-of-bounds access.  We
do want to compare 16B starting from ethmacdst but cmp_l2hdr was was
going beyond that by 2B.

cmp_l2hdr was introduced in r362905.

Reported by: Coverity (CID 1430284)
Sponsored by: Chelsio Communications

3 years agoipfw(8): Handle unaligned pointers in pr_u64.
markj [Mon, 13 Jul 2020 19:10:16 +0000 (19:10 +0000)]
ipfw(8): Handle unaligned pointers in pr_u64.

struct _ipfw_dyn_rule is defined as packed, and as a result, its
uint64_t fields are misaligned on some 32-bit platforms.  Since
pr_u64() is explicitly supposed to handle this case, avoid using a
uint64_t * for the input pointer to make sure that the compiler won't
(correctly) warn about the misalignment.

Reported by: jenkins
MFC with: r363164

3 years agoRevert r351416 to let lib.libc.gen.getmntinfo_test.getmntinfo_test get more test
lwhsu [Mon, 13 Jul 2020 18:19:02 +0000 (18:19 +0000)]
Revert r351416 to let lib.libc.gen.getmntinfo_test.getmntinfo_test get more test

This is supposed to be fixed by r363068

PR: 240049
Sponsored by: The FreeBSD Foundation

3 years agoipfw(8): Fix most warnings with the default WARNS level.
markj [Mon, 13 Jul 2020 17:51:04 +0000 (17:51 +0000)]
ipfw(8): Fix most warnings with the default WARNS level.

- Add missing const and static qualifiers.
- Avoid shadowing the global "co" by renaming it to "g_co".
- Avoid mixing signedness in loop bound checks.
- Leave -Wcast-align warnings disabled for now.

Reviewed by: ae, melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25456

3 years agoPrint arm64 physmem info during boot.
markj [Mon, 13 Jul 2020 17:05:44 +0000 (17:05 +0000)]
Print arm64 physmem info during boot.

PR: 243682
Reviewed by: andrew, emaste
MFC after: 1 week
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D25625

3 years agoAdd vm_map_valid_range_KBI().
markj [Mon, 13 Jul 2020 16:39:27 +0000 (16:39 +0000)]
Add vm_map_valid_range_KBI().

This is required for standalone module builds.

Reported by: hselasky
Reviewed by: dougm, hselasky, kib
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25650

3 years agoUpdate AMD Zen1 and add Zen2 events mapping.
mav [Mon, 13 Jul 2020 16:23:02 +0000 (16:23 +0000)]
Update AMD Zen1 and add Zen2 events mapping.

MFC after: 2 weeks

3 years agolseek(2): Document the seek behavior better and update the POSIX compliance
gbe [Mon, 13 Jul 2020 15:52:57 +0000 (15:52 +0000)]
lseek(2): Document the seek behavior better and update the POSIX compliance

In certain situations lseek(2) will return successful although if no seek
was performed. This can happen when operating on devices that don't support
seeking (older tape drives) or when operating on changeable media devices
(such as DVD or Blu-ray devices) without a medium inserted.

Document this within the man page and update the POSIX compliance while here.

PR: 162765
Submitted by: arundel@
Reported by: arundel@
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25646

3 years agogethostname(3): Correct the reference of the undefined value HOST_NAME_MAX
gbe [Mon, 13 Jul 2020 15:17:29 +0000 (15:17 +0000)]
gethostname(3): Correct the reference of the undefined value HOST_NAME_MAX

PR: 143472
Submitted by: bcran@
Reported by: Jeremy Huddleston <jeremyhu at apple dot com>
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25647

3 years agoarp(8) clarify the use of the '-a flag'
gbe [Mon, 13 Jul 2020 15:06:29 +0000 (15:06 +0000)]
arp(8) clarify the use of the '-a flag'

PR: 238146
Submitted by: Andrew Stevenson <andrew at ugh dot net dot au>
Reported by: Andrew Stevenson <andrew at ugh dot net dot au>
Reviewed by: bcr (mentor)
Approved by: bcr (mentor)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25645

3 years agoMinor textual fixes.
mav [Mon, 13 Jul 2020 14:25:25 +0000 (14:25 +0000)]
Minor textual fixes.

MFC after: 1 week

3 years agoRemove excess spaces from rc.d scripts
allanjude [Mon, 13 Jul 2020 13:44:54 +0000 (13:44 +0000)]
Remove excess spaces from rc.d scripts

The space between words is already being echoed by the space between quoted strings:

    % echo 'foo' 'bar'
    foo bar

    % echo 'foo' ' baz'
    foo  baz

Found in `ipfw` and `mountlate` messages.

PR: 247948
Submitted by: Jose Luis Duran <jlduran@gmail.com>
MFC after: 2 weeks
Sponsored by: Klara Inc.

3 years agoDon't print VNET pointer when initializing dummynet
thj [Mon, 13 Jul 2020 13:35:36 +0000 (13:35 +0000)]
Don't print VNET pointer when initializing dummynet

When dummynet initializes it prints a debug message with the current VNET
pointer unnecessarily revealing kernel memory layout. This appears to be left
over from when the first pieces of vimage support were added.

PR: 238658
Submitted by: huangfq.daxian@gmail.com
Reviewed by: markj, bz, gnn, kp, melifaro
Approved by: jtl (co-mentor), bz (co-mentor)
Event: July 2020 Bugathon
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25619

3 years agoFix invalid VHDX generation for image larger than 4Gb
gonzo [Mon, 13 Jul 2020 02:24:31 +0000 (02:24 +0000)]
Fix invalid VHDX generation for image larger than 4Gb

- Part of BAT payload location was lost due to invalid
    BAT entry encoding type (32 bits instead of 64 bits)
- The sequence of PB/SB entries in BAT was broken due to
    off-by-one index check. It worked for smaller than
    4Gb because there were no SB entries in BAT.

MFC after: 1 day

3 years agoLoader: explain the syntax of currdev
allanjude [Mon, 13 Jul 2020 02:09:21 +0000 (02:09 +0000)]
Loader: explain the syntax of currdev

The origin text was: "Syntax for devices is odd."
That is not very helpful.

PR: 199103
Reviewed by: kevans, tsoome
Sponsored by: Klara Inc.
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D25629

3 years agosed/multi_test: print comment for current test, not next one
yuripv [Mon, 13 Jul 2020 01:32:37 +0000 (01:32 +0000)]
sed/multi_test: print comment for current test, not next one

This is visible when e.g. 8.20 is failing:

not ok 96 8.20 # \ in y command

8.20's comment should be '[ as an s delimiter and its escapes'.

3 years agoMinor code cleanup that removes "nd->nd_bpos = mcp;" in both if and else.
rmacklem [Mon, 13 Jul 2020 01:28:45 +0000 (01:28 +0000)]
Minor code cleanup that removes "nd->nd_bpos = mcp;" in both if and else.

The statement "nd->nd_bpos = mcp;" was in both the if and else. Correct,
but potentially confusing.  This patch fixes this.

There should be no semantics change caused by this commit.

3 years agoinstall(1): another correction after r363064
eugen [Sun, 12 Jul 2020 20:59:52 +0000 (20:59 +0000)]
install(1): another correction after r363064

Make sure we call fsync(2) on strip result
in case of "safecopy" and "strip -o tempcopy -- src"
before renaming tempcopy to destination.

MFC after: 3 weeks
X-MFC-With: r363064

3 years agoCleanup, no functional change intended.
tuexen [Sun, 12 Jul 2020 18:34:09 +0000 (18:34 +0000)]
Cleanup, no functional change intended.

This file is only compiled if INET or INET6 is defined. So there
is no need for checking that.

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

3 years agoDon't leave `path` behind when executing `:chflags_success`
ngie [Sun, 12 Jul 2020 17:16:57 +0000 (17:16 +0000)]
Don't leave `path` behind when executing `:chflags_success`

Prior to this change a `SF_IMMUTABLE` chflagsat(2)'ed file (`path`) was left
behind, which sabotaged kyua(1) from being able to clean up the work directory,
This resulted in unnecessary work for folks having to clean up the work
directory on non-disposable systems, which defaults to `/tmp`. Use `UF_OFFLINE`
instead of `SF_IMMUTABLE`, in part because setting `SF_IMMUTABLE` isn't relevant
to the test and `SF_IMMUTABLE` cannot be cleared at all securelevels, as pointed
out by @asomers.

Additional work is required to catch cases like this upfront in the future to
avoid tester headache. See PR # 247765 for more details/followup.

Suggested by: asomers
Reviewed By: asomers, #tests
MFC after: 1 week
PR: 247761
Sponsored by: DellEMC
Differential Revision: https://reviews.freebsd.org/D25561

3 years agoFix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)),
netchild [Sun, 12 Jul 2020 14:57:29 +0000 (14:57 +0000)]
Fix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)),
by realy using the MONOTONIC version and not the REALTIME version.

Noticed by: myfreeweb at github

3 years ago(Re)activate SCTP system calls when compiling SCTP support into the kernel
tuexen [Sun, 12 Jul 2020 14:50:12 +0000 (14:50 +0000)]
(Re)activate SCTP system calls when compiling SCTP support into the kernel
r363079 introduced the possibility of loading the SCTP stack as a module in
addition to compiling it into the kernel. As part of this, the registration
of the system calls was removed and put into the loading of the module.
Therefore, the system calls are not registered anymore when compiling the
SCTP into the kernel. This patch addresses that.

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

3 years agoSwitch inet6 default route subscription to the new rib subscription api.
melifaro [Sun, 12 Jul 2020 11:24:23 +0000 (11:24 +0000)]
Switch inet6 default route subscription to the new rib subscription api.

Old subscription model allowed only single customer.

Switch inet6 to the new subscription api and eliminate the old model.

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

3 years agoAdd destructor for the rib subscription system to simplify users code.
melifaro [Sun, 12 Jul 2020 11:18:09 +0000 (11:18 +0000)]
Add destructor for the rib subscription system to simplify users code.

Subscriptions are planned to be used by modules such as route lookup engines.
In that case that's the module task to properly unsibscribe before detach.
However, the in-kernel customer - inet6 wants to track default route changes.
To avoid having inet6 store per-fib subscriptions, handle automatic
 destruction internally.

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

3 years agoImplement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).
netchild [Sun, 12 Jul 2020 09:51:09 +0000 (09:51 +0000)]
Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).

It is documented as a raw hardware-based clock not subject to NTP or
incremental adjustments. With this "not as precise as CLOCK_MONOTONIC"
description in mind, map it to our CLOCK_MONOTNIC_FAST (the same
mapping as for the linux CLOCK_MONOTONIC_COARSE).

This is needed for the webcomponent of steam (chromium) and some
other steam component or game.

The linux-steam-utils port contains a LD_PRELOAD based fix for this.
There this is mapped to CLOCK_MONOTONIC.
As an untrained ear/eye (= the majority of people) is normaly not
noticing a difference of jitter in the 10-20 ms range, specially
if you don't pay attention like for example in a browser session
while watching a video stream, the mapping to CLOCK_MONOTONIC_FAST
seems more appropriate than to CLOCK_MONOTONIC.

3 years agoReverse the processing order of assigned clocks property.
mmel [Sun, 12 Jul 2020 07:59:15 +0000 (07:59 +0000)]
Reverse the processing order of assigned clocks property.
Linux processes these clocks in reverse order and some DT relies
on this fact. For example, the frequency setting for a given PLL
is the last in the list, preceded by the frequency setting of its
following divider or so...

MFC after: 1 week

3 years ago Assigned clocks: fix off-by-one bug, don't leak allocated memory.
mmel [Sun, 12 Jul 2020 07:42:21 +0000 (07:42 +0000)]
 Assigned clocks: fix off-by-one bug, don't leak allocated memory.

 MFC after: 1 week