]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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

3 years agoFix the module name for some arm drivers.
mmel [Sun, 12 Jul 2020 07:27:21 +0000 (07:27 +0000)]
Fix the module name for some arm drivers.
Module name (unlike of the of driver name) must be system wide unique.

Reported by: Mark Millard(bcm_pci), andrew(mvebu_gpio)
MFC with: r362954, r362385

3 years agoUpdate to bmake-20200710
sjg [Sun, 12 Jul 2020 01:11:48 +0000 (01:11 +0000)]
Update to bmake-20200710

Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.
In META MODE; a target flagged .META is out-of-date if meta file
is missing

MFC after:      1 week

3 years agoperiodic.conf: correct capitailization in the middle of a sentence
allanjude [Sat, 11 Jul 2020 22:14:44 +0000 (22:14 +0000)]
periodic.conf: correct capitailization in the middle of a sentence

Reported by: yuripv
Event: July 2020 Bugathon

3 years agosx: remove SX_NOADAPTIVE from the man page
mjg [Sat, 11 Jul 2020 21:57:43 +0000 (21:57 +0000)]
sx: remove SX_NOADAPTIVE from the man page

The flag itself was removed in r341593

3 years agofd: stop looping in pwd_hold
mjg [Sat, 11 Jul 2020 21:57:03 +0000 (21:57 +0000)]
fd: stop looping in pwd_hold

We don't expect to fail acquiring the reference unless running into a corner
case. Just in case ensure forward progress by taking the lock.

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

3 years agoAdd cross references betwen ttys(5) and related drivers
allanjude [Sat, 11 Jul 2020 20:56:57 +0000 (20:56 +0000)]
Add cross references betwen ttys(5) and related drivers

nmdm(4), ucom(4), and uart(4)

PR: 247638
Submitted by: Pau Amma <pauamma@gundo.com>
Reported by: 0mp
MFC after: 4 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon

3 years agoAdd a periodic script to backup the partition table and boot code
allanjude [Sat, 11 Jul 2020 20:53:31 +0000 (20:53 +0000)]
Add a periodic script to backup the partition table and boot code

Optionally, alert you if the contents change from the previous backup

PR: 86388
Submitted by: Rob Fairbanks <rob.fx907@gmail.com>, Miroslav Lachman <000.fbsd@quip.cz> (Original Version)
MFC after: 4 weeks
Relnotes: yes
Sponsored by: Klara Inc.
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D25628

3 years agonscd: does not warn about invalid values what parsing config file
allanjude [Sat, 11 Jul 2020 19:44:12 +0000 (19:44 +0000)]
nscd: does not warn about invalid values what parsing config file

PR: 202135
Submitted by: amutu@amutu.com
Reported By: Trond.Endrestol@ximalas.info
Reviewed by: markj, freqlabs
MFC after: 4 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D25627

3 years agoboot(8): fix sorting of cross references
allanjude [Sat, 11 Jul 2020 19:29:24 +0000 (19:29 +0000)]
boot(8): fix sorting of cross references

Reported by: yuripv
Event: July 2020 Bugathon

3 years agoboot(8): Add additional cross references
allanjude [Sat, 11 Jul 2020 19:18:43 +0000 (19:18 +0000)]
boot(8): Add additional cross references

Provide hints to direct people towards gptzfsboot, zfsbootcfg, efibootmgr, etc

PR: 199103
MFC after: 2 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon

3 years agoAdd orders man page
carlavilla [Sat, 11 Jul 2020 18:27:05 +0000 (18:27 +0000)]
Add orders man page

PR: 239020
Submitted by: gbe@
Approved by: imp@
Obtained from: NetBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24293

3 years agoppp: Document the fact that ppp_nat is enabled by default
allanjude [Sat, 11 Jul 2020 18:24:16 +0000 (18:24 +0000)]
ppp: Document the fact that ppp_nat is enabled by default

No functional change.

PR: 243062
Submitted by: Evilham <contact@evilham.com> (original version)
MFC after: 2 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D25623

3 years agoprocctl(2): consistently refer to the last agrument as 'data'
allanjude [Sat, 11 Jul 2020 18:04:09 +0000 (18:04 +0000)]
procctl(2): consistently refer to the last agrument as 'data'

Some older references called it 'arg'

Also fix a syntax error that was underlining an entire sentence.

PR: 247386
Reported by: Paul Floyd <paulf@free.fr>, PauAmma (research)
MFC after: 2 weeks
Sponsored by: Klara Inc.

3 years agobsdinstall: only kill the dhclient for the interface we are restarting
allanjude [Sat, 11 Jul 2020 17:20:17 +0000 (17:20 +0000)]
bsdinstall: only kill the dhclient for the interface we are restarting

PR: 205821
Reported by: mjg
MFC after: 2 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon

3 years agoping(8): Check for integer truncation when handling the value for -s.
markj [Sat, 11 Jul 2020 17:10:16 +0000 (17:10 +0000)]
ping(8): Check for integer truncation when handling the value for -s.

PR: 239976
Submitted by: Neeraj <neerajpal09@gmail.com>
MFC after: 1 week
Event: July 2020 Bugathon

3 years agobsdinstall: don't fail if fstab is empty
allanjude [Sat, 11 Jul 2020 17:06:48 +0000 (17:06 +0000)]
bsdinstall: don't fail if fstab is empty

PR: 210865
Submitted by: Tim Lukasiewicz <eclipzetech08@gmail.com>, h-fujishima@sakura.ad.jp (original version)
Reported by: h-fujishima@sakura.ad.jp
Reviewed by: sef
MFC after: 2 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon

3 years agodefaults/rc.conf: note that the default is ppp_nat="YES"
allanjude [Sat, 11 Jul 2020 16:57:44 +0000 (16:57 +0000)]
defaults/rc.conf: note that the default is ppp_nat="YES"

PR: 243062
Submitted by: Evilham <contact@evilham.com>
MFC after: 2 weeks
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D25621

3 years agobsdinstall: kill dhclient before starting a new instance
allanjude [Sat, 11 Jul 2020 15:32:53 +0000 (15:32 +0000)]
bsdinstall: kill dhclient before starting a new instance

PR: 205821
Submitted by: William Orr <will@worrbase.com>
MFC after: 2 weeks
Sponsored by: Klara Inc.
Event: July 2020 Bugathon
Differential Revision: https://reviews.freebsd.org/D14572

3 years agoHandle device removal and removal+add cases to fix infinity rate.
mr [Sat, 11 Jul 2020 13:56:36 +0000 (13:56 +0000)]
Handle device removal and removal+add cases to fix infinity rate.

PR: 219829
Submitted by: ota@j.email.ne.jp
Reported by: rezo@live.cn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25226

3 years agoMake linprocfs(5) report correct tty number in /proc/<PID>/stat.
trasz [Sat, 11 Jul 2020 13:11:54 +0000 (13:11 +0000)]
Make linprocfs(5) report correct tty number in /proc/<PID>/stat.
Fixes sudo (sudo-1.8.21p2-3ubuntu1.2); previously would fail
with "sudo: no tty present and no askpass program specified".

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

3 years agoMake linux stat(2) return the same st_dev for every devfs instance.
trasz [Sat, 11 Jul 2020 13:08:16 +0000 (13:08 +0000)]
Make linux stat(2) return the same st_dev for every devfs instance.
The reason for this is to work around an idiosyncrasy of glibc
getttynam(3) implementation: it checks whether st_dev returned for
fd 0 is the same as st_dev returned for the target of /proc/self/fd/0
symlink, and with linux chroots having their own devfs instance,
the check will fail if you chrooted into it.

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

3 years agoUpdate to version 3.1.3
se [Sat, 11 Jul 2020 07:33:18 +0000 (07:33 +0000)]
Update to version 3.1.3

This version fixes the following evaluation, which lead to a parse error:

     echo "if (1 < 3) 1" | bc

3 years agoloader: implement GELI writes
tsoome [Sat, 11 Jul 2020 06:51:42 +0000 (06:51 +0000)]
loader: implement GELI writes

Bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247482

This patch is based on initial work from allanjude.

PR: 247482
Obtained from: https://reviews.freebsd.org/D10236
Differential Revision: https://reviews.freebsd.org/D25605

3 years agoFix the tests for install(1): add support for STRIPBIN's -o option.
eugen [Fri, 10 Jul 2020 22:59:26 +0000 (22:59 +0000)]
Fix the tests for install(1): add support for STRIPBIN's -o option.

Reported by: lwhsu
MFC after: 1 week

3 years agoDon't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot.
trasz [Fri, 10 Jul 2020 21:41:09 +0000 (21:41 +0000)]
Don't emit warnings on MADV_HUGEPAGE; Firefox uses it a lot.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

3 years agoAdd a RELNOTES entry for r363084.
markj [Fri, 10 Jul 2020 19:58:26 +0000 (19:58 +0000)]
Add a RELNOTES entry for r363084.

3 years agoAdjust .Dd, missed in r363084.
markj [Fri, 10 Jul 2020 19:58:07 +0000 (19:58 +0000)]
Adjust .Dd, missed in r363084.

MFC with: r363084

3 years agoAdd a --sctp flag to nc.
markj [Fri, 10 Jul 2020 19:54:04 +0000 (19:54 +0000)]
Add a --sctp flag to nc.

The change adds an SCTP mode akin to UDP mode.  This is handy for doing
smoke testing of SCTP.

Use a long option to minimize the risk of option conflicts with OpenBSD.
For bonus points, this change unbreaks --no-tcpopt by adding a missing
case required by getopt_long().

Reviewed by: delphij, tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25610

3 years agoinstall(1): addition to r363067
eugen [Fri, 10 Jul 2020 17:42:22 +0000 (17:42 +0000)]
install(1): addition to r363067

Also, make it not break if STRIPBIN points to strip version without -o support
and destination does not exist before installing.

Reported by: lwhsu
MFC after:      1 month
X-MFC-With:     363064

3 years agoWhitespace changes due to upstreaming r363079.
tuexen [Fri, 10 Jul 2020 16:59:06 +0000 (16:59 +0000)]
Whitespace changes due to upstreaming r363079.

3 years agoProvide support for building SCTP as a loadable module.
markj [Fri, 10 Jul 2020 14:56:05 +0000 (14:56 +0000)]
Provide support for building SCTP as a loadable module.

With this change, a kernel compiled with "options SCTP_SUPPORT" and
without "options SCTP" supports dynamic loading of the SCTP stack.

Currently sctp.ko cannot be unloaded since some prerequisite teardown
logic is not yet implemented.  Attempts to unload the module will return
EOPNOTSUPP.

Discussed with: tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21997

3 years agoImplement the bitmap_subset() function in the LinuxKPI. This function
hselasky [Fri, 10 Jul 2020 12:06:18 +0000 (12:06 +0000)]
Implement the bitmap_subset() function in the LinuxKPI. This function
checks if the bitmap pointed to by the first argument is a subset of
the bitmap pointed to by the second argument. The function returns one
on success and zero on failure.

MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoImplement the array_size() function in the LinuxKPI. This function
hselasky [Fri, 10 Jul 2020 11:27:54 +0000 (11:27 +0000)]
Implement the array_size() function in the LinuxKPI. This function
basically multiplies its two arguments and returns SIZE_MAX if the
result overflows the size_t type.  Else the product of the two
arguments is returned.

Bump the FreeBSD_version to mitigate issues with existing
implementation of array_size() in drm-devel-kmod.

Discussed with: manu@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoFix a use-after-free bug for the userland stack. The kernel
tuexen [Fri, 10 Jul 2020 11:15:10 +0000 (11:15 +0000)]
Fix a use-after-free bug for the userland stack. The kernel
stack is not affected.
Thanks to Mark Wodrich from Google for finding and reporting the
bug.

MFC after: 1 week

3 years agoSplit long lines in the Raspberry Pi FB driver
andrew [Fri, 10 Jul 2020 09:34:47 +0000 (09:34 +0000)]
Split long lines in the Raspberry Pi FB driver

Sponsored by: Innovate UK

3 years agovfs: fix early termination of kern_getfsstat
mjg [Fri, 10 Jul 2020 09:24:27 +0000 (09:24 +0000)]
vfs: fix early termination of kern_getfsstat

The kernel would unlock already unlocked mutex if the buffer got filled up
before the mount list ended.

Reported by: pho
Fixes: r363069 ("vfs: depessimize getfsstat when only the count is requested")

3 years agovfs: fix trivial whitespace issues which don't interefere with blame
mjg [Fri, 10 Jul 2020 09:01:36 +0000 (09:01 +0000)]
vfs: fix trivial whitespace issues which don't interefere with blame

.. even without the -w switch

3 years agoAdvertise 64-bit physical-address capability.
grehan [Fri, 10 Jul 2020 07:26:50 +0000 (07:26 +0000)]
Advertise 64-bit physical-address capability.

This fixes a coredump with NetBSD guests when XHCI is configured.
On seeing the AC64 flag clear, the NetBSD XHCI driver was only writing
to the lower 32-bits of 64-bit physical address registers. The emulation
relies on a write to the hi 32-bits to calculate a host virtual address
for internal use, and has always supported 64-bit addressing.

All other guests were seen to write to both the lo- and hi- address
registers, regardless of the AC64 setting.

Discussed with:  Leon Dang (author)
Tested with:  Ubuntu 16/18/20, Windows10, OpenBSD UEFI guests.

MFC after: 2 weeks.

3 years agovfs: depessimize getfsstat when only the count is requested
mjg [Fri, 10 Jul 2020 06:47:58 +0000 (06:47 +0000)]
vfs: depessimize getfsstat when only the count is requested

This avoids relocking mountlist_mtx for each entry.

3 years agovfs: avoid spurious memcpy in vfs_statfs
mjg [Fri, 10 Jul 2020 06:46:42 +0000 (06:46 +0000)]
vfs: avoid spurious memcpy in vfs_statfs

It is quite often called for the very same buffer.

3 years agoinstall(1): correction after r363064
eugen [Fri, 10 Jul 2020 00:45:34 +0000 (00:45 +0000)]
install(1): correction after r363064

Make it not break if STRIPBIN points to strip version without -o support.
In that case, perform extra copy just like before r363064.

MFC after: 1 month
X-MFC-With: 363064

3 years agomemfd_create: turn on SHM_GROW_ON_WRITE
kevans [Fri, 10 Jul 2020 00:45:16 +0000 (00:45 +0000)]
memfd_create: turn on SHM_GROW_ON_WRITE

memfd_create fds will no longer require an ftruncate(2) to set the size;
they'll grow (to the extent that it's possible) upon write(2)-like syscalls.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25502

3 years agoshm_open2: Implement SHM_GROW_ON_WRITE
kevans [Fri, 10 Jul 2020 00:43:45 +0000 (00:43 +0000)]
shm_open2: Implement SHM_GROW_ON_WRITE

Lack of SHM_GROW_ON_WRITE is actively breaking Python's memfd_create tests,
so go ahead and implement it. A future change will make memfd_create always
set SHM_GROW_ON_WRITE, to match Linux behavior and unbreak Python's tests
on -CURRENT.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D25502

3 years agoOptimize install(1) a bit.
eugen [Fri, 10 Jul 2020 00:24:42 +0000 (00:24 +0000)]
Optimize install(1) a bit.

Currently, "install -s -S" behaviour is inefficient for upgrade.
First it finds that destination file already exists and copies
source file to temporary file. Then it calls strip(1)
with name of temporary file as single agrument and our strip(1) creates
another temporary file in the /tmp (or TMPDIR) making another copy
that is finally copied to DESTDIR third time.

Meantime, strip(1) has an option "-o dst" to specify destination
so install(1) is allowed to skip initial copying from obj to DESTDIR.
This change makes it do so.

Take a look at https://reviews.freebsd.org/D25551 for details
and efficiency numbers (in short: upto 32% gained for installword).

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D25551

3 years agoProperly backout r362998
imp [Fri, 10 Jul 2020 00:24:06 +0000 (00:24 +0000)]
Properly backout r362998

Correct a small mistake in r363060's backaout of r362998 by reverse-applying
r362998 by hand to loader.conf.

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

3 years agoshmfd: make shm_size a vm_ooffset_t
kevans [Fri, 10 Jul 2020 00:03:06 +0000 (00:03 +0000)]
shmfd: make shm_size a vm_ooffset_t

On 32-bit platforms, this expands the shm_size to a 64-bit quantity and
resolves a mismatch between the shmfd size and underlying vm_object size.
The implementation did not account for this kind of mismatch.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25602

3 years agoEnable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
cy [Thu, 9 Jul 2020 23:01:36 +0000 (23:01 +0000)]
Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
hostapd and wpa_supplicant.

Submitted by: bz
MFC after: 2 weeks
Relnotes: yes
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agoRevert r362998, r326999 while a better compatibility strategy is devised.
scottl [Thu, 9 Jul 2020 22:38:36 +0000 (22:38 +0000)]
Revert r362998, r326999 while a better compatibility strategy is devised.

3 years agosh: Do not ignore INTOFF during a trap
jilles [Thu, 9 Jul 2020 20:53:56 +0000 (20:53 +0000)]
sh: Do not ignore INTOFF during a trap

INTOFF postpones SIGINT processing and INTON enables it again. This is
important so an interactive shell can return to the top level prompt when
Ctrl+C is pressed.

Given that INTON is automatically done when a builtin completes, the part
where onsig() ignores suppressint when in_dotrap is true is both unnecessary
and unsafe. If the trap is for some other signal than SIGINT, arbitrary code
could have been interrupted.

Historically, INTOFF remained in effect for longer.

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25270

3 years agoApply the logic from r363051 to semctl(2) and __sem_base field.
markj [Thu, 9 Jul 2020 18:34:54 +0000 (18:34 +0000)]
Apply the logic from r363051 to semctl(2) and __sem_base field.

Reported by: Jeffball <jeffball@grimm-co.com>
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25600

3 years agowhois: Handle referrals to rwhois servers.
markj [Thu, 9 Jul 2020 17:27:14 +0000 (17:27 +0000)]
whois: Handle referrals to rwhois servers.

PR: 243862
Submitted by: ben@desync.com
Differential Revision: https://reviews.freebsd.org/D25156