]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoTemporarily skip sys.netpfil.pf.forward.{v4,v6} and sys.netpfil.pf.set_tos.v4
lwhsu [Mon, 22 Jul 2019 18:54:26 +0000 (18:54 +0000)]
Temporarily skip sys.netpfil.pf.forward.{v4,v6} and sys.netpfil.pf.set_tos.v4
on i386 as they are flakey on it

PR: 239380
Sponsored by: The FreeBSD Foundation

4 years agoFix URL.
lwhsu [Mon, 22 Jul 2019 18:43:46 +0000 (18:43 +0000)]
Fix URL.

Sponsored by: The FreeBSD Foundation

4 years agoTemporarily skip lib.libc.regex.exhaust_test.regcomp_too_big and
lwhsu [Mon, 22 Jul 2019 18:42:55 +0000 (18:42 +0000)]
Temporarily skip lib.libc.regex.exhaust_test.regcomp_too_big and
lib.libregex.exhaust_test.regcomp_too_big on i386 as they are flakey on it

PR: 237450
Sponsored by: The FreeBSD Foundation

4 years agoBe consistent about temporary variable use in adjacent loops.
brooks [Mon, 22 Jul 2019 18:27:17 +0000 (18:27 +0000)]
Be consistent about temporary variable use in adjacent loops.

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoWakeup the application when doing PD-API for unordered DATA chunks.
tuexen [Mon, 22 Jul 2019 18:11:35 +0000 (18:11 +0000)]
Wakeup the application when doing PD-API for unordered DATA chunks.
Work done with rrs@.

MFC after: 1 week

4 years agomptutil: emit a warning on big-endian architectures
emaste [Mon, 22 Jul 2019 17:25:35 +0000 (17:25 +0000)]
mptutil: emit a warning on big-endian architectures

It is known to be broken.

PR: 162513
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoUnify BTL parsing for `camcontrol debug` and `reset`.
mav [Mon, 22 Jul 2019 17:08:18 +0000 (17:08 +0000)]
Unify BTL parsing for `camcontrol debug` and `reset`.

This makes `camcontrol debug` also allow peripheral device specification.

While there, make BTL parser more strict and switch from strtok() to
strsep().

MFC after: 2 weeks

4 years agoRemove unused header.
br [Mon, 22 Jul 2019 16:50:37 +0000 (16:50 +0000)]
Remove unused header.

Sponsored by: DARPA, AFRL

4 years agoo Add support for BERI IOMMU device
br [Mon, 22 Jul 2019 16:01:20 +0000 (16:01 +0000)]
o Add support for BERI IOMMU device
o Add an experimental IOMMU support to xDMA framework

The BERI IOMMU device is the part of CHERI device-model project [1]. It
translates memory addresses for various BERI peripherals modelled in
software. It accepts FreeBSD/mips64 page directories format and manages
BERI TLB.

1. https://github.com/CTSRD-CHERI/device-model

Sponsored by: DARPA, AFRL

4 years agoTemporarily skip flakey test case
lwhsu [Mon, 22 Jul 2019 10:37:56 +0000 (10:37 +0000)]
Temporarily skip flakey test case
sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger

PR: 239292
Sponsored by: The FreeBSD Foundation

4 years agoarm: Use -O2 instead of -O as optimization flag
manu [Mon, 22 Jul 2019 10:17:59 +0000 (10:17 +0000)]
arm: Use -O2 instead of -O as optimization flag

When using Clang -O is equivalent to -O2, change it -O2 to make it
consistent with other platforms.

Reference: https://clang.llvm.org/docs/ClangCommandLineReference.html#optimization-level

Submitted by: Daniel Engberg (daniel.engberg.lists@pyret.net)
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D21021

4 years agoVOP_PATHCONF.9: correct the type of the retval argument
asomers [Mon, 22 Jul 2019 04:14:53 +0000 (04:14 +0000)]
VOP_PATHCONF.9: correct the type of the retval argument

It was changed from int to register_t in r22521 and from register_t to long
in r328099, but the man page wasn't updated either time.

MFC after: 2 weeks

4 years agopowerpc64/mmu: Make moea64_pvo_enter() return if an entry already exists
jhibbits [Mon, 22 Jul 2019 03:11:54 +0000 (03:11 +0000)]
powerpc64/mmu: Make moea64_pvo_enter() return if an entry already exists

Summary:
Instead of searching for a PVO entry before adding, take advantage of
the fact that RB_INSERT() returns NULL if it inserts, and the existing entry if
an entry exists, without inserting a new entry.  This saves an extra tree
traversal in the cases where the PVO does not exist.

Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D20944

4 years agoSwitch the rest of the refcount(9) functions to bool return type.
kib [Sun, 21 Jul 2019 20:16:48 +0000 (20:16 +0000)]
Switch the rest of the refcount(9) functions to bool return type.

There are some explicit comparisions of refcount_release(9) result
with 0/1, which are fine.

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

4 years agoAdd support for setting the aging/frequency-offset register via sysctl.
ian [Sun, 21 Jul 2019 17:14:39 +0000 (17:14 +0000)]
Add support for setting the aging/frequency-offset register via sysctl.

The 2127 and 2129 chips support a frequency tuning value in the range of
-7 through +8 PPM; add a sysctl handler to read and set the value.

4 years agoWith the introduction of software dirty bit emulation for managed mappings,
alc [Sun, 21 Jul 2019 17:00:19 +0000 (17:00 +0000)]
With the introduction of software dirty bit emulation for managed mappings,
we should test ATTR_SW_DBM, not ATTR_AP_RW, to determine whether to set
PGA_WRITEABLE.  In effect, we are currently setting PGA_WRITEABLE based on
whether the dirty bit is preset, not whether the mapping is writeable.
Correct this mistake.

Reviewed by: markj
X-MFC with: r350004
Differential Revision: https://reviews.freebsd.org/D21013

4 years agoLink fileargs_lstat.3.
markj [Sun, 21 Jul 2019 16:35:49 +0000 (16:35 +0000)]
Link fileargs_lstat.3.

Sponsored by: The FreeBSD Foundation

4 years agoFix userspace build after r350199.
kib [Sun, 21 Jul 2019 16:24:40 +0000 (16:24 +0000)]
Fix userspace build after r350199.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agoCheck and avoid overflow when incrementing fp->f_count in
kib [Sun, 21 Jul 2019 15:07:12 +0000 (15:07 +0000)]
Check and avoid overflow when incrementing fp->f_count in
fget_unlocked() and fhold().

On sufficiently large machine, f_count can be legitimately very large,
e.g. malicious code can dup same fd up to the per-process
filedescriptors limit, and then fork as much as it can.
On some smaller machine, I see
kern.maxfilesperproc: 939132
kern.maxprocperuid: 34203
which already overflows u_int.  More, the malicious code can create
transient references by sending fds over unix sockets.

I realized that this check is missed after reading
https://secfault-security.com/blog/FreeBSD-SA-1902.fd.html

Reviewed by: markj (previous version), mjg
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D20947

4 years agoMark Felder has stepped down from portmgr and ports-secteam
rene [Sun, 21 Jul 2019 11:07:39 +0000 (11:07 +0000)]
Mark Felder has stepped down from portmgr and ports-secteam

4 years agoIntroduce pmap_store(), and use it to replace pmap_load_store() in places
alc [Sun, 21 Jul 2019 03:26:26 +0000 (03:26 +0000)]
Introduce pmap_store(), and use it to replace pmap_load_store() in places
where the page table entry was previously invalid.  (Note that I did not
replace pmap_load_store() when it was followed by a TLB invalidation, even
if we are not using the return value from pmap_load_store().)

Correct an error in pmap_enter().  A test for determining when to set
PGA_WRITEABLE was always true, even if the mapping was read only.

In pmap_enter_l2(), when replacing an empty kernel page table page by a
superpage mapping, clear the old l2 entry and issue a TLB invalidation.  My
reading of the ARM architecture manual leads me to believe that the TLB
could hold an intermediate entry referencing the empty kernel page table
page even though it contains no valid mappings.

Replace a couple direct uses of atomic_clear_64() by the new
pmap_clear_bits().

In a couple comments, replace the term "paging-structure caches", which is
an Intel-specific term for the caches that hold intermediate entries in the
page table, with wording that is more consistent with the ARM architecture
manual.

Reviewed by: markj
X-MFC after: r350004
Differential Revision: https://reviews.freebsd.org/D20998

4 years agopowerpc: Remove an unnecessary #ifdef guard from slb.c
jhibbits [Sun, 21 Jul 2019 03:19:54 +0000 (03:19 +0000)]
powerpc: Remove an unnecessary #ifdef guard from slb.c

slb.c is only compiled for powerpc64, so no need for the #ifdef in this block.

4 years agoTreat any inode with bad content as unknown (i.e., ask if it should
mckusick [Sat, 20 Jul 2019 21:39:32 +0000 (21:39 +0000)]
Treat any inode with bad content as unknown (i.e., ask if it should
be cleared).

Sponsored by: Netflix

4 years agoWhen running with journaled soft updates, some updated inodes were not
mckusick [Sat, 20 Jul 2019 21:20:40 +0000 (21:20 +0000)]
When running with journaled soft updates, some updated inodes were not
having their check hashes recomputed which resulted in spurious inode
check-hash errors when the system came back up after a crash.

Reported by:  Alan Somers
Sponsored by: Netflix

4 years agoRewrite the nxprtc chip init to extend battery life by using power-saving
ian [Sat, 20 Jul 2019 21:10:27 +0000 (21:10 +0000)]
Rewrite the nxprtc chip init to extend battery life by using power-saving
features offered by the chips.

For 2127 and 2129 chips, fix the detection of when chip-init is needed.  The
chip config needs to be reset whenever power was lost, but the logic was
wrong for 212x chips (it only worked for 8523).  Now the "oscillator
stopped" bit rather than the power manager mode is used to detect startup
after powerfail.

For all chips, disable the clock output pin.

For chips that have a timestamp/tamper-monitor feature, turn off monitoring
of the timestamp trigger pin.

The 8523, 2127, and 2129 chips have a "power manager" feature that offers
several options.  We've been using the default mode which enables
everything.  Now the code sets the power manager options to

 - direct-switch (when Vdd < Vbat, without extra threshold check)
 - no battery monitor
 - no external powerfail monitor

This reduces the current draw while running on battery from 1930nA to 880nA,
which should roughly double the lifespan of the battery under load.

Because battery checking is a nice thing to have, the code now does a check
at startup, and then once a day after that, instead of checking continuously
(but only actually reporting at startup).  The battery check is now done by
setting the power manager back to default mode, sleeping briefly while it
makes a voltage measurement, then switching back to power-saving mode.

4 years agomotd: Generate from template to /var/run
cem [Sat, 20 Jul 2019 20:56:31 +0000 (20:56 +0000)]
motd: Generate from template to /var/run

Update login(1), its manual pages, similar utilities, and motd.5 to refer to
the new location.

Suggested by: delphij@ (re: r349256)
Reviewed by: bcr (manpages), delphij
Differential Revision: https://reviews.freebsd.org/D20721

4 years agoIn trimming on startup, invoke swapon before closing the fd used for
dougm [Sat, 20 Jul 2019 20:47:07 +0000 (20:47 +0000)]
In trimming on startup, invoke swapon before closing the fd used for
trimming so that a geli device isn't detached before swapon is
invoked.

Submitted by: sigsys_gmail.com
Discussed with: alc
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D21006

4 years agoRename vm_page_{import,release}() to vm_page_zone_{import,release}().
markj [Sat, 20 Jul 2019 18:25:41 +0000 (18:25 +0000)]
Rename vm_page_{import,release}() to vm_page_zone_{import,release}().

I would like to use the name vm_page_release() for a different purpose,
and vm_page_{import,release}() are local to vm_page.c.

Reviewed by: kib
MFC after: 1 week

4 years agopowerpc/SPE: Enable SPV bit for EFSCFD instruction emulation
jhibbits [Sat, 20 Jul 2019 18:22:01 +0000 (18:22 +0000)]
powerpc/SPE: Enable SPV bit for EFSCFD instruction emulation

EFSCFD (floating point single convert from double) emulation requires saving
the high word of the register, which uses SPE instructions.  Enable the SPE
to avoid an SPV Unavailable exception.

MFC after: 1 week

4 years agodtso: allwinner: Add an overlay for H3 i2c0
manu [Sat, 20 Jul 2019 17:42:46 +0000 (17:42 +0000)]
dtso: allwinner: Add an overlay for H3 i2c0

Most of the H3 boards don't enable i2c as it is unused.
Add an overlay so it's easier for user to use i2c device.

4 years agoexpand_number(3) parses suffixes, not prefixes.
jhb [Sat, 20 Jul 2019 16:03:54 +0000 (16:03 +0000)]
expand_number(3) parses suffixes, not prefixes.

While here, tidy the opening sentence a bit.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20791

4 years agoImprove the precision of bhyve's vPIT.
jhb [Sat, 20 Jul 2019 15:59:49 +0000 (15:59 +0000)]
Improve the precision of bhyve's vPIT.

Use 'struct bintime' instead of 'sbintime_t' to manage times in vPIT
to postpone rounding to final results rather than intermediate
results.  In tests performed by Joyent, this reduced the error measured
by Linux guests by 59 ppm.

Smart OS bug: https://smartos.org/bugview/OS-6923
Submitted by: Patrick Mooney
Reviewed by: rgrimes
Obtained from: SmartOS / Joyent
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20335

4 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Sat, 20 Jul 2019 15:26:21 +0000 (15:26 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
8.0.1 final release r366581.  The only functional change is a fix for a
mismerge of upstream r360816, which properly restores the r2 register
when unwinding on PowerPC64 (See https://reviews.freebsd.org/D20337).

Relnotes: yes
PR: 236062
MFC after: 3 days
X-MFC-With: r349004

4 years agoarm64: Implement HWCAP
manu [Sat, 20 Jul 2019 14:29:11 +0000 (14:29 +0000)]
arm64: Implement HWCAP

Add HWCAP support for arm64.
defines are the same as in Linux and a userland program can use
elf_aux_info to get the data.
We only save the common denominator for all cores in case the
big and little cluster have different support (this is known to
exists even if we don't support those SoCs in FreeBSD)

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

4 years agoAdd emmc support for Rockchip RK3399 SoC.
ganbold [Sat, 20 Jul 2019 02:53:06 +0000 (02:53 +0000)]
Add emmc support for Rockchip RK3399 SoC.
Tested on NanoPC-T4 board.

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

4 years agoAdd driver for Rockchip RK3399 eMMC PHY.
ganbold [Sat, 20 Jul 2019 02:03:31 +0000 (02:03 +0000)]
Add driver for Rockchip RK3399 eMMC PHY.
Tested on NanoPC-T4 board.

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

4 years agoAvoid copying too much from the input string.
brooks [Fri, 19 Jul 2019 23:58:30 +0000 (23:58 +0000)]
Avoid copying too much from the input string.

This avoids reading past the end of the static strings.  On a system
with bounds checking these tests fault.

Reviewed by: asomers
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21004

4 years agoMake setting mips endian and ABI less verbose.
brooks [Fri, 19 Jul 2019 23:39:21 +0000 (23:39 +0000)]
Make setting mips endian and ABI less verbose.

Allow ABI to be over ridden to allow (with other changes) programs to be
built targeting ABIs other than the default.  This is used in CheriBSD.

Reviewed by: imp
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21001

4 years agoRemove an unneeded temporary variable in two functions.
brooks [Fri, 19 Jul 2019 23:10:43 +0000 (23:10 +0000)]
Remove an unneeded temporary variable in two functions.

There is no need to convert an intptr_t to a long just to cast it to a
(void *).

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoUse the __DECONST macro rather than hand rolling it.
brooks [Fri, 19 Jul 2019 22:54:09 +0000 (22:54 +0000)]
Use the __DECONST macro rather than hand rolling it.

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoFix leak of memory and file refs with sendmsg(2) over unix domain sockets.
kib [Fri, 19 Jul 2019 20:51:39 +0000 (20:51 +0000)]
Fix leak of memory and file refs with sendmsg(2) over unix domain sockets.

When sendmsg(2) sucessfully internalized one SCM_RIGHTS control
message, but failed to process some other control message later, both
file references and filedescent memory needs to be freed. This was not
done, only mbuf chain was freed.

Noted, test case written, reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21000

4 years agoDefine vm_map_entry_in_transition to handle an in-transition map
dougm [Fri, 19 Jul 2019 20:47:35 +0000 (20:47 +0000)]
Define vm_map_entry_in_transition to handle an in-transition map
entry, combining code currently in vm_map_unwire and
vm_map_wire_locked into a single function, called by each of them for
entries in transition.

Discussed with: kib, markj
Reviewed by: alc
Approved by: kib, markj (mentors, implicit)
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D20833

4 years agoRemove RELEASE_CRUNCH here
imp [Fri, 19 Jul 2019 20:04:31 +0000 (20:04 +0000)]
Remove RELEASE_CRUNCH here

If someone wants to subset, they can set MK_ICONV=no. We no longer use it for
the release.

4 years agoRemove RELEASE_CRUNCH in example
imp [Fri, 19 Jul 2019 20:04:26 +0000 (20:04 +0000)]
Remove RELEASE_CRUNCH in example

RELEASE_CRUNCH is no longer relevant.

4 years agoRemove obsolete RELEASE_CRUNCH
imp [Fri, 19 Jul 2019 20:04:21 +0000 (20:04 +0000)]
Remove obsolete RELEASE_CRUNCH

Remove documentation of RELEASE_CRUNCH here. It's obsolete and no longer a good
example.

4 years agoRemove RELEASE_CRUNCH
imp [Fri, 19 Jul 2019 20:04:13 +0000 (20:04 +0000)]
Remove RELEASE_CRUNCH

RELEASE_CRUNCH isn't used for releases any more. If someone wants to subset,
then they can set MK_JAIL=no instead.

4 years agoProperly report ACS revisions alike to kernel.
mav [Fri, 19 Jul 2019 20:02:01 +0000 (20:02 +0000)]
Properly report ACS revisions alike to kernel.

MFC after: 2 weeks

4 years agoAdd Accessible Max Address Configuration support to camcontrol.
mav [Fri, 19 Jul 2019 19:15:08 +0000 (19:15 +0000)]
Add Accessible Max Address Configuration support to camcontrol.

AMA replaced HPA in ACS-3 specification.  It allows to limit size of the
disk alike to HPA, but declares inaccessible data as indeterminate.  One
of its practical use cases is to under-provision SATA SSDs for better
reliability and performance.

While there, fix HPA Security detection/reporting.

MFC after: 2 weeks
Relnotes: yes
Sponsored by: iXsystems, Inc.

4 years agoRestore WARNS?=1 here. I missed that libexec/bootpd/bootpgw existed.
brooks [Fri, 19 Jul 2019 18:47:13 +0000 (18:47 +0000)]
Restore WARNS?=1 here.  I missed that libexec/bootpd/bootpgw existed.

4 years agoKeep track of the number of commands that exhaust their retry limit.
imp [Fri, 19 Jul 2019 18:39:24 +0000 (18:39 +0000)]
Keep track of the number of commands that exhaust their retry limit.

While we print failure messages on the console, sometimes logs are lost or
overwhelmed. Keeping a count of how many times we've failed retriable commands
helps get a magnitude of the problem.

4 years agoKeep track of the number of retried commands.
imp [Fri, 19 Jul 2019 18:39:18 +0000 (18:39 +0000)]
Keep track of the number of retried commands.

Retried commands can indicate a performance degredation of an nvme drive. Keep
track of the number of retries and report it out via sysctl, just like number of
commands an interrupts.

4 years agoRemove pre-FreeBSD 7.0 compatibility.
imp [Fri, 19 Jul 2019 18:38:47 +0000 (18:38 +0000)]
Remove pre-FreeBSD 7.0 compatibility.

4 years agoChain Makefile.inc's so default are inherited as expected.
brooks [Fri, 19 Jul 2019 17:52:23 +0000 (17:52 +0000)]
Chain Makefile.inc's so default are inherited as expected.

Remove unneeded or duplicate variables.

No functional change.

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoAdd comments about KERN_OPT here.
imp [Fri, 19 Jul 2019 17:48:29 +0000 (17:48 +0000)]
Add comments about KERN_OPT here.

4 years agopkgbase: move man pages from runtime-manual to runtime
manu [Fri, 19 Jul 2019 15:12:20 +0000 (15:12 +0000)]
pkgbase: move man pages from runtime-manual to runtime

We don't split the other man pages in their own package so do the same for runtime.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D20962

4 years agobsd.confs.mk: Test the correct value for the destination package
manu [Fri, 19 Jul 2019 15:11:32 +0000 (15:11 +0000)]
bsd.confs.mk: Test the correct value for the destination package

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D20961

4 years agopkgbase: Add a FreeBSD-dpv package
manu [Fri, 19 Jul 2019 15:10:53 +0000 (15:10 +0000)]
pkgbase: Add a FreeBSD-dpv package

Move the dpv related files from FreeBSD-runtime to a new package named
FreeBSD-dpv
The only consumer is bsdinstall which is already in it's own package.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D20960

4 years agopkgbase: Add a FreeBSD-bluetooth package
manu [Fri, 19 Jul 2019 15:10:03 +0000 (15:10 +0000)]
pkgbase: Add a FreeBSD-bluetooth package

Move the bluetooth related files from FreeBSD-runtime to a new package named
FreeBSD-bluetooth
The FreeBSD runtime is only intended to have everything for a working
FreeBSD installation and bluetooth isn't needed for that.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D20959

4 years agopkgbase: Add a FreeBSD-hostapd package
manu [Fri, 19 Jul 2019 15:09:00 +0000 (15:09 +0000)]
pkgbase: Add a FreeBSD-hostapd package

Move the hostapd related files from FreeBSD-runtime to a new package n
FreeBSD-hostapd
The FreeBSD runtime is only intended to have everything for a working
FreeBSD installation and hostapd isn't needed for that.

Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D20958

4 years agopkgbase: Add a FreeBSD-wpa package
manu [Fri, 19 Jul 2019 15:07:30 +0000 (15:07 +0000)]
pkgbase: Add a FreeBSD-wpa package

Move the wpa related files from FreeBSD-runtime to a new package named
FreeBSD-wpa
The FreeBSD runtime is only intended to have everything for a working
FreeBSD installation and wpa isn't needed for that.

Reviewed by:    bapt, gjb
Differential Revision:  https://reviews.freebsd.org/D20957

4 years agoUse sysctl + CTLRWTUN for hw.nvme.verbose_cmd_dump.
imp [Fri, 19 Jul 2019 00:32:56 +0000 (00:32 +0000)]
Use sysctl + CTLRWTUN for hw.nvme.verbose_cmd_dump.

Also convert it to a bool. While the rest of the driver isn't yet bool clean,
this will help.

Reviewed by: cem@
Differential Revision: https://reviews.freebsd.org/D20988

4 years agoRework some multi-output target dependency handling.
bdrewery [Fri, 19 Jul 2019 00:15:25 +0000 (00:15 +0000)]
Rework some multi-output target dependency handling.

This reworks my last commit in r301285 to more closely match what was in
r241298 (but reverted in r294878).

This is addressing "missing .meta file" rebuilds but also ensuring that
files are always generated when needed in each case.

Note that this is not a complete rework of the problem areas identified
in r301285 as most are "good enough" right now as the new pattern
is too verbose. It's only worth making this current change where headers
may be generated in the INCS list; where missing .meta file rebuilds are
spotted.

--- Technical details follow ---

Several attempts to deal with this problem of multi-output targets, with and
without META MODE, were explained in r241298, r294878, and r301285.

The general problem is with multi-output targets such as:
        foo.c foo.h:
                touch foo.c foo.h
        foo.c foo.h:
                touch foo.c
                touch foo.h
        foo.c foo.h: foo.in
                ./generator ${.ALLSRC}

This pattern is problematic in jobs mode as both files end up being
built concurrently and leads to races. With META MODE it is worse
as both targets end up rebuilding if they lack a .meta file. So the
generator is force built twice even though it is only needed once.
There are also problems in that 'make foo.h' may be ran before 'make foo.c';
The order of make generating the targets is not guaranteed.

An older attempted workaround to this (discussed in r294878) was:
        foo.h: foo.c
        foo.c: foo.in
                ./generator ${.ALLSRC}
This appears fine except that if foo.h is missing and foo.c exists then
foo.h will never be regenerated. This pattern is close to the solution
in this commit though:

        foo.h: foo.c .NOMETA
        .if !exists(foo.h)
        foo.c: .PHONY .META
        .endif
        foo.c: foo.in
                ./generator ${.ALLSRC}

There's 2 differences here:
1. foo.h will never expect to have a .meta file since the foo.c target
   will generate both and own the .meta file.
2. If foo.h does not exist then it needs to force foo.c to be rebuilt
   with .PHONY. That normally disables META MODE though so .META is
   given to tell bmake we do really expect a .meta file.

This pattern cannot work with implicit suffix rules since the .c and .h files
may be generated at different times (buildincludes vs depend/all).

Sponsored by: Dell EMC
MFC after: 2 weeks

4 years agoProvide new tunable hw.nvme.verbose_cmd_dump
imp [Thu, 18 Jul 2019 21:58:51 +0000 (21:58 +0000)]
Provide new tunable hw.nvme.verbose_cmd_dump

The nvme drive dumps only the most relevant details about a command when it
fails. However, there are times this is not sufficient (such as debugging weird
issues for a new drive with a vendor). Setting hw.nvme.verbose_cmd_dump=1
in loader.conf will enable more complete debugging information about each
command that fails.

Reviewed by: rpokala
Sponsored by: Netflix
Differential Version: https://reviews.freebsd.org/D20988

4 years agoInclude a mode when creating files with openat().
brooks [Thu, 18 Jul 2019 21:37:50 +0000 (21:37 +0000)]
Include a mode when creating files with openat().

Reviewed by: asomers
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20989

4 years agoDocument that setmode(3) is not thread safe.
brooks [Thu, 18 Jul 2019 21:33:55 +0000 (21:33 +0000)]
Document that setmode(3) is not thread safe.

In some circumstances, setmode(3) may call umask(2) twice to retrieve
the current mode and then restore it.  Between calls, the process will
have a umask of 0.

Reviewed by: markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20982

4 years agoProvide macros to extract the sub-fields of the CAP_LO and CAP_HI registers.
imp [Thu, 18 Jul 2019 15:41:10 +0000 (15:41 +0000)]
Provide macros to extract the sub-fields of the CAP_LO and CAP_HI registers.

These macros make places where we extract these easier to read. The shift and
mask stuff is also a bit tedious and error prone. Start with the CAP_LO and
CAP_HI registers since their scope is somewhat constrained. This is style
chagne only, no functional changes.

Reviewed by: chuck
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20979

4 years agoRename arm64 macros in preperation for a script to generate them.
andrew [Thu, 18 Jul 2019 13:58:04 +0000 (13:58 +0000)]
Rename arm64 macros in preperation for a script to generate them.

I have a script to generate most of the ID_AA64* macros from the Arm
XML source [1]. In preperation for using this we need to clean up the
macros to be in line with what the script will generate. This is the
first step, rename the macros to follow the names in said XML.

[1] https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools

MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20976

4 years agoerrno.h is no longer needed as of r340239 so remove it.
delphij [Thu, 18 Jul 2019 07:37:26 +0000 (07:37 +0000)]
errno.h is no longer needed as of r340239 so remove it.

No MFC planned as that revision was not merged.

4 years agoRemove support for FreeBSD 10.x.
delphij [Thu, 18 Jul 2019 07:26:30 +0000 (07:26 +0000)]
Remove support for FreeBSD 10.x.

MFC after: 1 month

4 years agoFix a paste-o, set is212x = false for other chip types. Doh!
ian [Thu, 18 Jul 2019 01:37:00 +0000 (01:37 +0000)]
Fix a paste-o, set is212x = false for other chip types.  Doh!

4 years agoHandle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip.
ian [Thu, 18 Jul 2019 01:30:56 +0000 (01:30 +0000)]
Handle the PCF2127 RTC chip the same as PCF2129 when init'ing the chip.

This affects the detection of 24-hour vs AM/PM mode... the ampm bit is in a
different location on 2127 and 2129 chips compared to other nxp rtc chips.
I noticed the 2127 case wasn't being handled correctly when I accidentally
misconfiged my system by claiming my PCF2129 was a 2127.

4 years agoMFV r350080:
cy [Thu, 18 Jul 2019 00:27:28 +0000 (00:27 +0000)]
MFV r350080:

Update sqlite3-3.28.0 (3280000) --> sqlite3-3.29.0 (3290000)

MFC after: 1 week

4 years agoRemove redundent decleration of __elf_phdr_match_addr().
brooks [Wed, 17 Jul 2019 23:46:47 +0000 (23:46 +0000)]
Remove redundent decleration of __elf_phdr_match_addr().

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoRemove a duplicate global (rfc931_timeout).
brooks [Wed, 17 Jul 2019 23:43:14 +0000 (23:43 +0000)]
Remove a duplicate global (rfc931_timeout).

It is declared here and in rfc931.c and unused here so keep that copy
and discard this one.

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoUse headers instead of manual declerations of standard functions and
brooks [Wed, 17 Jul 2019 23:36:36 +0000 (23:36 +0000)]
Use headers instead of manual declerations of standard functions and
variables.

4 years agoloader: ignore some variable settings if input unverified
sjg [Wed, 17 Jul 2019 23:33:14 +0000 (23:33 +0000)]
loader: ignore some variable settings if input unverified

libsecureboot can tell us if the most recent file opened was
verfied or not.
If it's state is VE_UNVERIFIED_OK, skip if variable
matches one of the restricted prefixes.

Reviewed by: stevek
MFC after: 1 week
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org//D20909

4 years agoUse ANSI C function definitions and declerations.
brooks [Wed, 17 Jul 2019 23:09:40 +0000 (23:09 +0000)]
Use ANSI C function definitions and declerations.

Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA, AFRL

4 years agoThe error reported in FS-14-UFS-3 can only happen on UFS/FFS
mckusick [Wed, 17 Jul 2019 22:07:43 +0000 (22:07 +0000)]
The error reported in FS-14-UFS-3 can only happen on UFS/FFS
filesystems that have block pointers that are out-of-range for their
filesystem. These out-of-range block pointers are corrected by
fsck(8) so are only encountered when an unchecked filesystem is
mounted.

A new "untrusted" flag has been added to the generic mount interface
that can be set when mounting media of unknown provenance or integrity.
For example, a daemon that automounts a filesystem on a flash drive
when it is plugged into a system.

This commit adds a test to UFS/FFS that validates all block numbers
before using them. Because checking for out-of-range blocks adds
unnecessary overhead to normal operation, the tests are only done
when the filesystem is mounted as an "untrusted" filesystem.

Reported by:  Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE
Reported as:  FS-14-UFS-3: Out of bounds read in write-2 (ffs_alloccg)
Reviewed by:  kib
Sponsored by: Netflix

4 years agoriscv: Return vm_paddr_t in pmap_early_vtophys()
kp [Wed, 17 Jul 2019 21:25:26 +0000 (21:25 +0000)]
riscv: Return vm_paddr_t in pmap_early_vtophys()

We can't use a u_int to compute the physical address in
pmap_early_vtophys(). Our int is 32-bit, but the physical address is
64-bit. This works fine if everything lives in below 0x100000000, but as
soon as it doesn't this breaks.

MFC after: 1 week
Sponsored by: Axiado

4 years agoRemove now-obsolete comment.
imp [Wed, 17 Jul 2019 20:43:14 +0000 (20:43 +0000)]
Remove now-obsolete comment.

4 years agobsearch.3: Improve the example.
kib [Wed, 17 Jul 2019 19:29:55 +0000 (19:29 +0000)]
bsearch.3: Improve the example.

Submitted by: fernape
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19902

4 years agoRemove an old warning from UPDATING.
markj [Wed, 17 Jul 2019 19:11:24 +0000 (19:11 +0000)]
Remove an old warning from UPDATING.

The clang switchover happened long enough ago that we can
garbage-collect this note.

Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D20978

4 years agoAdd an initial RELNOTES file.
markj [Wed, 17 Jul 2019 19:09:05 +0000 (19:09 +0000)]
Add an initial RELNOTES file.

The intent is to provide a convenient location to document changes
that are relevant to users of binary FreeBSD distributions, in contrast
with UPDATING, which exists to document caveats for users who build
FreeBSD from source.

This complements the "Relnotes:" tag in commit messages by providing a
place to document the change in more detail, or in case a "Relnotes:"
tag was accidentally omitted.  In particular, "Relnotes:" should be
used if you do not intend to document the change in RELNOTES for some
reason.

Changes to the file should not be MFCed.  For now the file will exist
only in head, but may be updated via direct commits to stable branches
depending on how things go.

I took the liberty of pre-populating the file with some recent release
notes-worthy changes.

Reviewed by: ian (earlier version)
Discussed with: cy, gjb, imp, rgrimes
Differential Revision: https://reviews.freebsd.org/D20762

4 years agoF_READAHEAD: Fix r349248's overflow protection, broken by r349391
asomers [Wed, 17 Jul 2019 17:01:07 +0000 (17:01 +0000)]
F_READAHEAD: Fix r349248's overflow protection, broken by r349391

I accidentally broke the main point of r349248 when making stylistic changes
in r349391.  Restore the original behavior, and also fix an additional
overflow that was possible when uio->uio_resid was nearly SSIZE_MAX.

Reported by: cem
Reviewed by: bde
MFC after: 2 weeks
MFC-With: 349248
Sponsored by: The FreeBSD Foundation

4 years agoRemove obsolete compatibility code from rtadvd.
markj [Wed, 17 Jul 2019 16:50:53 +0000 (16:50 +0000)]
Remove obsolete compatibility code from rtadvd.

MFC after: 1 week

4 years agoFix FASTTRAPIOC_GETINSTR.
markj [Wed, 17 Jul 2019 16:38:29 +0000 (16:38 +0000)]
Fix FASTTRAPIOC_GETINSTR.

This ioctl is used when a breakpoint is encountered while disassembling
a symbol in the target process.  Since only one DTrace consumer can
toggle or enumerate fasttrap probes from a given process at time, this
ioctl does not appear to be used in practice.

4 years agoReference stdint.h types in ctf.5.
markj [Wed, 17 Jul 2019 16:31:50 +0000 (16:31 +0000)]
Reference stdint.h types in ctf.5.

MFC after: 1 week

4 years agotzsetup: upgrade to zone1970.tab
tmunro [Wed, 17 Jul 2019 06:17:27 +0000 (06:17 +0000)]
tzsetup: upgrade to zone1970.tab

zone.tab is deprecated.  Install zone1970.tab alongside it, and use it
for tzsetup(8).  This is also useful for other applications that need
the modern better maintained file.

Reviewed by: philip
Approved by: allanjude (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20646

4 years agoI add the ability to accept the default pin widget configuration to help
sbruno [Wed, 17 Jul 2019 04:13:46 +0000 (04:13 +0000)]
I add the ability to accept the default pin widget configuration to help
with various laptops using hdaa(4) sound devices.  We don't seem to know
the "correct" configurations for these devices and the defaults are far
superiour, e.g. they work if you don't nuke the default configs.

PR: 200526
Differential Revision: https://reviews.freebsd.org/D17772

4 years agobhyve: update the NVMe CQ based on the status
chuck [Wed, 17 Jul 2019 03:19:30 +0000 (03:19 +0000)]
bhyve: update the NVMe CQ based on the status

Instead of skipping the NVMe Completion Queue update based on the
opcode, define a synthetic status value which indicates the completion
queue entry is invalid. This will also allow deferred completion queue
updates for other commands.

Also returns the correct status for unrecognized opcodes ("invalid
opcode").

Reviewed by: imp, jhb, araujo
Approved by: imp (mentor), jhb (maintainer)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20945

4 years agoMore follow-up to r350075, I forgot to update ObsoleteFiles.
kevlo [Wed, 17 Jul 2019 02:24:16 +0000 (02:24 +0000)]
More follow-up to r350075,  I forgot to update ObsoleteFiles.

Spotted by: lwhsu

4 years agoAdd an MLINK for igb.
kevlo [Wed, 17 Jul 2019 02:08:57 +0000 (02:08 +0000)]
Add an MLINK for igb.

Discussed with: lwhsu

4 years agoMention iflib(4).
kevlo [Wed, 17 Jul 2019 01:56:40 +0000 (01:56 +0000)]
Mention iflib(4).

4 years agoStyle.
mckusick [Tue, 16 Jul 2019 23:39:39 +0000 (23:39 +0000)]
Style.
No change intended.

4 years agoWhen a process attempts to allocate space on a full filesystem, a
mckusick [Tue, 16 Jul 2019 23:12:27 +0000 (23:12 +0000)]
When a process attempts to allocate space on a full filesystem, a
filesystem full message is sent to the offending process or the
kernel log if the offending process cannot be identified.

To prevent an explotion of messages, the kernel ppsratecheck()
function is used to limit the messages to one per second. This
revision changes the variable that tracks the rate of these messages
from a systemwide limit to a per-filesystem limit by moving it from
a global variable to a variable in the ufsmount structure.

Suggested by: kib
Reviewed by:  kib
Sponsored by: Netflix

4 years agoUse PT_GET_SC_ARGS and PT_GET_SC_RET in truss.
jhb [Tue, 16 Jul 2019 22:59:15 +0000 (22:59 +0000)]
Use PT_GET_SC_ARGS and PT_GET_SC_RET in truss.

This removes all of the architecture-specific functions from truss.

A per-ABI structure is still needed to map syscall numbers to names
and FreeBSD errno values to ABI error values as well as hold syscall
counters.  However, the linker set of ABI structures is now replaced
with a simple table mapping ABI names to structures.  This approach
permits sharing the same ABI structure among separate names such as
i386 a.out and ELF binaries as well as ELF v1 vs ELF v2 for powerpc64.

A few differences are visible due to using PT_GET_SC_RET to fetch the
error value of a system call.  Note that ktrace/kdump have had the
"new" behaviors for a long time already:
- System calls that return with EJUSTRETURN or ERESTART will now be
  noticed and logged as such.  Previously sigreturn (which uses
  EJUSTRETURN) would report whatever random value was in the register
  holding errno from the previous system call for example.  Now it
  reports EJUSTRETURN.
- System calls that return errno as their error value such as
  posix_fallocate() and posix_fadvise() now report non-zero return
  values as errors instead of success with a non-zero return value.

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

4 years agoAssume that the timeout value from the capacity is 1-based
imp [Tue, 16 Jul 2019 22:55:30 +0000 (22:55 +0000)]
Assume that the timeout value from the capacity is 1-based

Neither the 1.3 or 1.4 standards say this number is 1's based, but adding 1
costs little and copes with those NVMe drives that report '0' in this field
cheaply. This is consistent with what the Linux driver does as well.

4 years agoAdd missing mode in open(2) calls with O_CREAT.
brooks [Tue, 16 Jul 2019 22:27:49 +0000 (22:27 +0000)]
Add missing mode in open(2) calls with O_CREAT.

When O_CREAT is specified, the third, variadic argument is
required as the permission. If on is not passed, then depending
on the ABI, either the contents of the third argument register
or some arbitrary stuff on the stack will be used as the permission.

This has been merged to NetBSD.

Reviewed by: asomers, ngie
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D20972

4 years agoAs of upstream fil.c CVS r1.53 (March 1, 2009), prior to the import of
cy [Tue, 16 Jul 2019 19:00:42 +0000 (19:00 +0000)]
As of upstream fil.c CVS r1.53 (March 1, 2009), prior to the import of
ipfilter 5.1.2 into FreeBSD-10, the fix for, 2580062 from/to targets
should be able to use any interface name, moved frentry.fr_cksum to
prior to frentry.fr_func thereby making this code redundant. After
investigating whether this fix to move fr_cksum was correct and if it
broke anything, it has been determined that the fix is correct and this
code is redundant. We remove it here.

MFC after: 2 weeks

4 years agoRefactor, removing one compare.
cy [Tue, 16 Jul 2019 19:00:38 +0000 (19:00 +0000)]
Refactor, removing one compare.

This changes the return code however the caller only tests for 0 and != 0.
One might ask then, why multiple return codes when the caller only tests
for 0 and != 0? From what I can tell, Darren probably passed various
return codes for sake of debugging. The debugging code is long gone
however we can still use the different return codes using DTrace FBT
traces. We can still determine why the compare failed by examining the
differences between the fr1 and fr2 frentry structs, which is a simple
test in DTrace. This allows reducing the number of tests, improving the
code while not affecting our ability to capture information for
diagnostic purposes.

MFC after: 1 week