]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years ago- Retire pc-sysinstall(8)
kmoore [Tue, 3 Sep 2019 19:42:04 +0000 (19:42 +0000)]
- Retire pc-sysinstall(8)

https://reviews.freebsd.org/D21094

Submitted by: kmoore@FreeBSD.org
Approved by: imp@FreeBSD.org

4 years agoAdd stackgap control mode to proccontrol(1).
kib [Tue, 3 Sep 2019 18:58:48 +0000 (18:58 +0000)]
Add stackgap control mode to proccontrol(1).

PR: 239894
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D21352

4 years agoAdd procctl(PROC_STACKGAP_CTL)
kib [Tue, 3 Sep 2019 18:56:25 +0000 (18:56 +0000)]
Add procctl(PROC_STACKGAP_CTL)

It allows a process to request that stack gap was not applied to its
stacks, retroactively.  Also it is possible to control the gaps in the
process after exec.

PR: 239894
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21352

4 years agoUse makefs -t msdos in make_esp_file
mmacy [Tue, 3 Sep 2019 18:37:55 +0000 (18:37 +0000)]
Use makefs -t msdos in make_esp_file

With this last piece in place, make -C /usr/src/release release.iso is
finally able to run in a jail. This was not possible before because
msdosfs cannot be mounted inside a jail.

Submitted by: ryan@ixsystems.com
Reviewed by: emaste@, imp@, gjb@
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D21385

4 years agoAdd conv=fsync flag to dd
mmacy [Tue, 3 Sep 2019 18:35:55 +0000 (18:35 +0000)]
Add conv=fsync flag to dd

The fsync flag performs an fsync(2) on the output file before closing it.
This will be useful for the ZFS test suite.

Submitted by: ryan@ixsystems.com
Reviewed by: jilles@, imp@
MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agobsdgrep(1): add some basic tests for some GNU Extension support
kevans [Tue, 3 Sep 2019 18:32:29 +0000 (18:32 +0000)]
bsdgrep(1): add some basic tests for some GNU Extension support

These will be expanded later as I come up with good test cases; for now,
these seem to be enough to trigger bugs in base gnugrep and expose missing
features in bsdgrep.

4 years agoMake linprocfs(4) report Tgid, Linux ltrace(1) needs it.
trasz [Tue, 3 Sep 2019 16:33:02 +0000 (16:33 +0000)]
Make linprocfs(4) report Tgid, Linux ltrace(1) needs it.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agovfs: implement usecount implying holdcnt
mjg [Tue, 3 Sep 2019 15:42:11 +0000 (15:42 +0000)]
vfs: implement usecount implying holdcnt

vnodes have 2 reference counts - holdcnt to keep the vnode itself from getting
freed and usecount to denote it is actively used.

Previously all operations bumping usecount would also bump holdcnt, which is
not necessary. We can detect if usecount is already > 1 (in which case holdcnt
is also > 1) and utilize it to avoid bumping holdcnt on our own. This saves
on atomic ops.

Reviewed by: kib
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21471

4 years agoImplement nvme suspend / resume for pci attachment
imp [Tue, 3 Sep 2019 15:26:11 +0000 (15:26 +0000)]
Implement nvme suspend / resume for pci attachment

When we suspend, we need to properly shutdown the NVME controller. The
controller may go into D3 state (or may have the power removed), and
to properly flush the metadata to non-volatile RAM, we must complete a
normal shutdown. This consists of deleting the I/O queues and setting
the shutodown bit. We have to do some extra stuff to make sure we
reset the software state of the queues as well.

On resume, we have to reset the card twice, for reasons described in
the attach funcion. Once we've done that, we can restart the card. If
any of this fails, we'll fail the NVMe card, just like we do when a
reset fails.

Set is_resetting for the duration of the suspend / resume. This keeps
the reset taskqueue from running a concurrent reset, and also is
needed to prevent any hw completions from queueing more I/O to the
card. Pass resetting flag to nvme_ctrlr_start. It doesn't need to get
that from the global state of the ctrlr. Wait for any pending reset to
finish. All queued I/O will get sent to the hardware as part of
nvme_ctrlr_start(), though the upper layers shouldn't send any
down. Disabling the qpairs is the other failsafe to ensure all I/O is
queued.

Rename nvme_ctrlr_destory_qpairs to nvme_ctrlr_delete_qpairs to avoid
confusion with all the other destroy functions.  It just removes the
queues in hardware, while the other _destroy_ functions tear down
driver data structures.

Split parts of the hardware reset function up so that I can
do part of the reset in suspsend. Split out the software disabling
of the qpairs into nvme_ctrlr_disable_qpairs.

Finally, fix a couple of spelling errors in comments related to
this.

Relnotes: Yes
MFC After: 1 week
Reviewed by: scottl@ (prior version)
Differential Revision: https://reviews.freebsd.org/D21493

4 years agoRevert a portion of r351628 that I did not mean to commit.
markj [Tue, 3 Sep 2019 14:39:36 +0000 (14:39 +0000)]
Revert a portion of r351628 that I did not mean to commit.

Reported by: mjg
MFC with: r351628

4 years agoAdd preliminary support for atomic updates of per-page queue state.
markj [Tue, 3 Sep 2019 14:29:58 +0000 (14:29 +0000)]
Add preliminary support for atomic updates of per-page queue state.

Queue operations on a page use the page lock when updating the page to
reflect the desired queue state, and the page queue lock when physically
enqueuing or dequeuing a page.  Multiple pages share a given page lock,
but queue state is per-page; this false sharing results in heavy lock
contention.

Take a small step towards the use of atomic_cmpset to synchronize
updates to per-page queue state by introducing vm_page_pqstate_cmpset()
and using it in the page daemon.  In the longer term the plan is to stop
using the page lock to protect page identity and rely only on the object
and page busy locks.  However, since the page daemon avoids acquiring
the object lock except when necessary, some synchronization with a
concurrent free of the page is required.  vm_page_pqstate_cmpset() can
be used to ensure that queue state updates are successful only if the
page is not scheduled for a dequeue, which is sufficient for the page
daemon.

Add vm_page_swapqueue(), which moves a page from one queue to another
using vm_page_pqstate_cmpset().  Use it in the active queue scan, which
does not use the object lock.  Modify vm_page_dequeue_deferred() to
use vm_page_pqstate_cmpset() as well.

Reviewed by: kib
Discussed with: jeff
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21257

4 years agoMap the vm_page array into KVA on amd64.
markj [Tue, 3 Sep 2019 13:18:51 +0000 (13:18 +0000)]
Map the vm_page array into KVA on amd64.

r351198 allows the kernel to use domain-local memory to back the vm_page
array (up to 2MB boundaries) and reserves a separate PML4 entry for that
purpose.  One consequence of that change is that the vm_page array is no
longer present in minidumps, which only adds pages mapped above
VM_MIN_KERNEL_ADDRESS.

To avoid the friction caused by having kernel data structures mapped
below VM_MIN_KERNEL_ADDRESS, map the vm_page array starting at
VM_MIN_KERNEL_ADDRESS instead of using a dedicated PML4 entry.

Reviewed by: kib
Discussed with: jeff
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21491

4 years agopseudofs: fix a LOR pfs_node vs pidhash (sleepable after non-sleepable)
mjg [Tue, 3 Sep 2019 12:54:51 +0000 (12:54 +0000)]
pseudofs: fix a LOR pfs_node vs pidhash (sleepable after non-sleepable)

Sponsored by: The FreeBSD Foundation

4 years agosuperio: fix the copyright block and update the year
avg [Tue, 3 Sep 2019 12:40:58 +0000 (12:40 +0000)]
superio: fix the copyright block and update the year

MFC after: 2 weeks

4 years agoTemporarily skip sys.sys.qmath_test.qdivq_s64q in CI because it is unstable
lwhsu [Tue, 3 Sep 2019 10:49:13 +0000 (10:49 +0000)]
Temporarily skip sys.sys.qmath_test.qdivq_s64q in CI because it is unstable

PR: 240219
Discussed with: trasz
Sponsored by: The FreeBSD Foundation

4 years agoAdd sysctlbyname system call
mjg [Tue, 3 Sep 2019 04:16:30 +0000 (04:16 +0000)]
Add sysctlbyname system call

Previously userspace would issue one syscall to resolve the sysctl and then
another one to actually use it. Do it all in one trip.

Fallback is provided in case newer libc happens to be running on an older
kernel.

Submitted by: Pawel Biernacki
Reported by: kib, brooks
Differential Revision: https://reviews.freebsd.org/D17282

4 years agoAdd a sysctl to dump kernel mappings and their properties on amd64.
markj [Mon, 2 Sep 2019 21:57:57 +0000 (21:57 +0000)]
Add a sysctl to dump kernel mappings and their properties on amd64.

The sysctl is called vm.pmap.kernel_maps.  It dumps address ranges
and their corresponding protection and mapping mode, as well as
counts of 2MB and 1GB pages in the range.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21380

4 years agoReplace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.
markj [Mon, 2 Sep 2019 21:54:08 +0000 (21:54 +0000)]
Replace PMAP_LARGEMAP_MAX_ADDRESS() with a more general predicate.

No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoThis patch improves the DSACK handling to conform with RFC 2883.
tuexen [Mon, 2 Sep 2019 19:04:02 +0000 (19:04 +0000)]
This patch improves the DSACK handling to conform with RFC 2883.
The lowest SACK block is used when multiple Blocks would be elegible as
DSACK blocks ACK blocks get reordered - while maintaining the ordering of
SACK blocks not relevant in the DSACK context is maintained.

Reviewed by: rrs@, tuexen@
Obtained from: Richard Scheffenegger
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21038

4 years agoFix the name of the devicetree bindings document file cited in the manpage.
ian [Mon, 2 Sep 2019 18:32:08 +0000 (18:32 +0000)]
Fix the name of the devicetree bindings document file cited in the manpage.

Reported by: thj@

4 years agoBump Linux version to 3.2.0. Without it, binaries linked against
trasz [Mon, 2 Sep 2019 18:10:35 +0000 (18:10 +0000)]
Bump Linux version to 3.2.0.  Without it, binaries linked against
glibc 2.24 and up (eg Ubuntu 19.04) fail with "FATAL: kernel too old".

This alone is not enough to make newer binaries actually work;
fix/hack/workaround is pending review at https://reviews.freebsd.org/D20687.

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

4 years agoIn nvme_completion_poll, add a sanity check to make sure that we complete the
imp [Mon, 2 Sep 2019 17:11:32 +0000 (17:11 +0000)]
In nvme_completion_poll, add a sanity check to make sure that we complete the
polling within a second. Panic if we don't. All the commands that use this
interface should typically complete within a few tens to hundreds of
microseconds. Panic rather than return ETIMEDOUT because if the command somehow
does later complete, it will randomly corrupt memory. Also, it helps to get a
traceback from where the unexpected failure happens, rather than an infinite
loop.

4 years agoIn all the places that we use the polled for completion interface, except crash
imp [Mon, 2 Sep 2019 17:11:27 +0000 (17:11 +0000)]
In all the places that we use the polled for completion interface, except crash
dump support code, move the while loop into an inline function. These aren't
done in the fast path, so if the compiler choses to not inline, any performance
hit is tiny.

4 years agoAdd a brief comment explaining why we can return ETIMEDOUT from the call to the
imp [Mon, 2 Sep 2019 17:10:46 +0000 (17:10 +0000)]
Add a brief comment explaining why we can return ETIMEDOUT from the call to the
polled interface. Normally this would have the potential to corrupt stack memory
because the completion routines would run after we return. In this case,
however, we're doing a dump so it's safe for reasons explained in the comment.

4 years agoRelax compat.linux.osrelease checks. This way one can do eg
trasz [Mon, 2 Sep 2019 16:57:42 +0000 (16:57 +0000)]
Relax compat.linux.osrelease checks.  This way one can do eg
'compat.linux.osrelease=3.10.0-957.12.1.el7.x86_64', which
corresponds to CentOS 7.

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

4 years agovfs: restore mp null check in vop_stdgetwritemount
mjg [Mon, 2 Sep 2019 15:24:25 +0000 (15:24 +0000)]
vfs: restore mp null check in vop_stdgetwritemount

The initially read mount point can already be NULL.

Reported by: markj
Fixes: r351656 ("vfs: stop refing freed mount points in vop_stdgetwritemount")
Sponsored by: The FreeBSD Foundation

4 years agoLinuxKPI: Add sysfs create/remove functions that handles multiple files in one call.
johalun [Mon, 2 Sep 2019 14:51:59 +0000 (14:51 +0000)]
LinuxKPI: Add sysfs create/remove functions that handles multiple files in one call.

Reviewed by: hps
Approved by: imp (mentor), hps
MFC after: 1 week
Differential Revision: D21475

4 years agolibc: Use musl's optimized memchr
emaste [Mon, 2 Sep 2019 13:56:44 +0000 (13:56 +0000)]
libc: Use musl's optimized memchr

Parentheses added to HASZERO macro to avoid a GCC warning.

Reviewed by: kib, mjg
Obtained from: musl (snapshot at commit 4d0a82170a)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D17631

4 years agolibutil: remove SIGSYS handling from setusercontext
mjg [Mon, 2 Sep 2019 13:55:31 +0000 (13:55 +0000)]
libutil: remove SIGSYS handling from setusercontext

It was a workaround for cases where the kernel lacks setloginclass(2),
added in the 9.x era.

Submitted by: Pawel Biernacki

4 years agoBelatedly bump __FreeBSD_version for r351659, gets(3) removal
emaste [Mon, 2 Sep 2019 12:48:18 +0000 (12:48 +0000)]
Belatedly bump __FreeBSD_version for r351659, gets(3) removal

Reported by: linimon

4 years agoproc: clear pid bitmap entry after dropping proctree lock
mjg [Mon, 2 Sep 2019 12:46:43 +0000 (12:46 +0000)]
proc: clear pid bitmap entry after dropping proctree lock

There is no correctness change here, but the procid lock is contended in
the fork path and taking it while holding proctree avoidably extends its
hold time.

Note that there are other ids which can end up getting cleared with the
lock.

Sponsored by: The FreeBSD Foundation

4 years agoloader.efi: use and prefer coninex interface
tsoome [Mon, 2 Sep 2019 11:04:17 +0000 (11:04 +0000)]
loader.efi: use and prefer coninex interface

Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.

4 years agoloader.efi: some systems do not translate scan code 0x8 to backspace
tsoome [Mon, 2 Sep 2019 10:45:10 +0000 (10:45 +0000)]
loader.efi: some systems do not translate scan code 0x8 to backspace

Add scancode translation for backspace.

4 years agoUse DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
hselasky [Mon, 2 Sep 2019 08:34:45 +0000 (08:34 +0000)]
Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
This fixes system hangs on reading device registers on aarch64.

Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu
Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D20789
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoFix regression issue after r351616. Make sure the mbuf queue gets initialized.
hselasky [Mon, 2 Sep 2019 08:31:18 +0000 (08:31 +0000)]
Fix regression issue after r351616. Make sure the mbuf queue gets initialized.

Found by: gonzo@
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoRemove remnants of optimization for > pagesize allocations.
brooks [Mon, 2 Sep 2019 08:03:29 +0000 (08:03 +0000)]
Remove remnants of optimization for > pagesize allocations.

In the past, this allocator seems to have allocated things larger than
a page seperately. Much of this code was removed at some point (perhaps
along with sbrk() used) so remove the rest. Instead, keep allocating in
power-of-two bins up to FIRST_BUCKET_SIZE << (NBUCKETS - 1). If we want
something more efficent, we should use a fancier allocator.

While here, remove some vestages of sbrk() use. Most importantly, don't
try to page align the pagepool since it's always page aligned by mmap().

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D21453

4 years agomips: fix some mcount nits
kevans [Mon, 2 Sep 2019 01:55:55 +0000 (01:55 +0000)]
mips: fix some mcount nits

The symbol version for _mcount was removed 12 years ago in r169525 from
gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked
in this, so _mcount has no symver. Add it back to where it should have been,
rather than where it would go if it were added today, since we're correcting
a historical mistake.

Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90
world as it's not getting explicitly thrown into .text, so do this now. This
fixes the libc build that was previously failing due to relocations in
.mdebug.abi32. This is specifically due to the way clang's integrated AS
works and that they emit the .mdebug.abiNN section early in the process. An
LLVM bug has been submitted[0] and an agreement has been made that the
mips backend should switch to .text following .mdebug.abiNN for
compatibility.

[0] https://bugs.llvm.org/show_bug.cgi?id=43119

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

4 years agoExtend uma_reclaim() to permit different reclamation targets.
markj [Sun, 1 Sep 2019 22:22:43 +0000 (22:22 +0000)]
Extend uma_reclaim() to permit different reclamation targets.

The page daemon periodically invokes uma_reclaim() to reclaim cached
items from each zone when the system is under memory pressure.  This
is important since the size of these caches is unbounded by default.
However it also results in bursts of high latency when allocating from
heavily used zones as threads miss in the per-CPU caches and must
access the keg in order to allocate new items.

With r340405 we maintain an estimate of each zone's usage of its
(per-NUMA domain) cache of full buckets.  Start making use of this
estimate to avoid reclaiming the entire cache when under memory
pressure.  In particular, introduce TRIM, DRAIN and DRAIN_CPU
verbs for uma_reclaim() and uma_zone_reclaim().  When trimming, only
items in excess of the estimate are reclaimed.  Draining a zone
reclaims all of the cached full buckets (the previous behaviour of
uma_reclaim()), and may further drain the per-CPU caches in extreme
cases.

Now, when under memory pressure, the page daemon will trim zones
rather than draining them.  As a result, heavily used zones do not incur
bursts of bucket cache misses following reclamation, but large, unused
caches will be reclaimed as before.

Reviewed by: jeff
Tested by: pho (an earlier version)
MFC after: 2 months
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D16667

4 years agoRestrict the input domain set in cpuset_setdomain(2) to all_domains.
markj [Sun, 1 Sep 2019 21:38:08 +0000 (21:38 +0000)]
Restrict the input domain set in cpuset_setdomain(2) to all_domains.

To permit larger values of MAXMEMDOM, which is currently 8 on amd64,
cpuset_setdomain(2) accepts a mask of size 256.  In the kernel, domain
set masks are 64 bits wide, but can only represent a set of MAXMEMDOM
domains due to the use of the ds_order table.

Domain sets passed to cpuset_setdomain(2) are restricted to a subset
of their parent set, which is typically the root set, but before this
happens we modify the input set to exclude empty domains.
domainset_empty_vm() and other code which manipulates domain sets
expect the mask to be a subset of all_domains, so enforce that when
performing validation of cpuset_setdomain(2) parameters.

Reported and tested by: pho
Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21477

4 years agoFix an off-by-one bug in the CPU and domain ID parser.
markj [Sun, 1 Sep 2019 21:20:31 +0000 (21:20 +0000)]
Fix an off-by-one bug in the CPU and domain ID parser.

The "size" parameter is the size of the corresponding bit set, so the
maximum CPU or domain index is size - 1.

MFC after: 1 week

4 years agoMove CAS check in powerpc64 ofw loader until after the PVR check.
bdragon [Sun, 1 Sep 2019 18:26:21 +0000 (18:26 +0000)]
Move CAS check in powerpc64 ofw loader until after the PVR check.

This unbreaks using the powerpc64 loader on a 32-bit processor.

Approved by: jhibbits (mentor)
Differential Revision: https://reviews.freebsd.org/D21297

4 years agomakefs: share msdosfsmount.h between kernel msdosfs and makefs
emaste [Sun, 1 Sep 2019 16:55:33 +0000 (16:55 +0000)]
makefs: share msdosfsmount.h between kernel msdosfs and makefs

Sponsored by: The FreeBSD Foundation

4 years agovnic: correct and simplify SIOCSIFFLAGS
emaste [Sun, 1 Sep 2019 16:53:17 +0000 (16:53 +0000)]
vnic: correct and simplify SIOCSIFFLAGS

PR: 223573, 223575
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D13028

4 years agoar: use more correct size_t type for loop index
emaste [Sun, 1 Sep 2019 16:51:25 +0000 (16:51 +0000)]
ar: use more correct size_t type for loop index

Submitted by: cem
MFC after: 1 week

4 years agolldb: shorten thread names to make logs easier to follow
emaste [Sun, 1 Sep 2019 16:50:34 +0000 (16:50 +0000)]
lldb: shorten thread names to make logs easier to follow

lldb prepends the thread name to log entries, and the existing thread
name for the FreeBSD ProcessMonitor thread was longer than the kernel's
supported thread name length, and so was truncated.  This made logs hard
to read, as the truncated thread name ran into the log message.  Shorten
"lldb.process.freebsd.operation" to just "freebsd.op" so that logs are
more readable.

(Upstreaming to lldb still to be done).

4 years agoRemove CLANG_NO_IAS definition
emaste [Sun, 1 Sep 2019 16:47:48 +0000 (16:47 +0000)]
Remove CLANG_NO_IAS definition

CLANG_NO_IAS is not used anywhere in the tree.

Sponsored by: The FreeBSD Foundation

4 years agolibstdc++: remove gets
emaste [Sun, 1 Sep 2019 16:41:24 +0000 (16:41 +0000)]
libstdc++: remove gets

Removed from libc in r351659

4 years agolibc: remove gets
emaste [Sun, 1 Sep 2019 16:12:05 +0000 (16:12 +0000)]
libc: remove gets

gets is unsafe and shouldn't be used (for many years now).  Leave it in
the existing symbol version so anything that previously linked aginst it
still runs, but do not allow new software to link against it.

(The compatability/legacy implementation must not be static so that
the symbol and in particular the compat sym gets@FBSD_1.0 make it
into libc.)

PR: 222796 (exp-run)
Reported by: Paul Vixie
Reviewed by: allanjude, cy, eadler, gnn, jhb, kib, ngie (some earlier)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D12298

4 years agoAdd myself (fox) and update the mentor information.
fox [Sun, 1 Sep 2019 15:39:28 +0000 (15:39 +0000)]
Add myself (fox) and update the mentor information.

Approved by: philip (mentor)

4 years agonetmap: import changes from upstream (SHA 137f537eae513)
vmaffione [Sun, 1 Sep 2019 14:47:41 +0000 (14:47 +0000)]
netmap: import changes from upstream (SHA 137f537eae513)

 - Rework option processing.
 - Use larger integers for memory size values in the
   memory management code.

MFC after: 2 weeks

4 years agovfs: stop refing freed mount points in vop_stdgetwritemount
mjg [Sun, 1 Sep 2019 14:01:09 +0000 (14:01 +0000)]
vfs: stop refing freed mount points in vop_stdgetwritemount

The code used blindly ref based on an unsafely red address and then would
backpedal if necessary. This was safe in terms of memory access since
mounts are type-stable, but made for a potential a bug where the mount
was reused and had the count reset to 0 before this code decreased it.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21411

4 years agoFix initialization of top_fsn.
tuexen [Sun, 1 Sep 2019 10:39:16 +0000 (10:39 +0000)]
Fix initialization of top_fsn.

MFC after: 3 days

4 years agoImprove the handling of state cookie parameters in INIT-ACK chunks.
tuexen [Sun, 1 Sep 2019 10:09:53 +0000 (10:09 +0000)]
Improve the handling of state cookie parameters in INIT-ACK chunks.
This fixes problem with parameters indicating a zero length or partial
parameters after an unknown parameter indicating to stop processing. It
also fixes a problem with state cookie parameters after unknown
parametes indicating to stop porcessing.
Thanks to Mark Wodrich from Google for finding two of these issues
by fuzz testing the userland stack and reporting them in
https://github.com/sctplab/usrsctp/issues/355
and
https://github.com/sctplab/usrsctp/issues/352

MFC after: 3 days

4 years agoAdd support for TP-Link Archer T2U Nano.
jkim [Sun, 1 Sep 2019 06:40:58 +0000 (06:40 +0000)]
Add support for TP-Link Archer T2U Nano.

MFC after: 2 weeks

4 years agonullfs: reduce areas protected by vnode interlock in null_lock
mjg [Sun, 1 Sep 2019 02:52:00 +0000 (02:52 +0000)]
nullfs: reduce areas protected by vnode interlock in null_lock

Similarly to the other routine stop taking the interlock for the lower
vnode. The interlock for nullfs vnode is still taken to ensure
stability of ->v_data.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21480

4 years agoposixshm: switch to OBJT_SWAP in advance of other changes
kevans [Sun, 1 Sep 2019 00:33:16 +0000 (00:33 +0000)]
posixshm: switch to OBJT_SWAP in advance of other changes

Future changes to posixshm will start tracking writeable mappings in order
to support file sealing. Tracking writeable mappings for an OBJT_DEFAULT
object is complicated as it may be swapped out and converted to an
OBJT_SWAP. One may generically add this tracking for vm_object, but this is
difficult to do without increasing memory footprint of vm_object and blowing
up memory usage by a significant amount.

On the other hand, the swap pager can be expanded to track writeable
mappings without increasing vm_object size. This change is currently in
D21456. Switch over to OBJT_SWAP in advance of the other changes to the
swap pager and posixshm.

4 years agoARM kernel can get RAM regions three ways:
ray [Sat, 31 Aug 2019 21:28:06 +0000 (21:28 +0000)]
ARM kernel can get RAM regions three ways:
o from FDT;
o from EFI;
o from Linux Boot API (ATAG).
U-Boot may pass RAM info all that 3 ways simultaneously.
We do select between FDT and EFI, but not for ATAG.
So this is not problem fix, but correctness check.

MFC after: 2 weeks

4 years agoUnskip test cases from netbsd-tests by defining __HAVE_FENV
lwhsu [Sat, 31 Aug 2019 20:45:45 +0000 (20:45 +0000)]
Unskip test cases from netbsd-tests by defining __HAVE_FENV

This unskips:
  - lib.libc.stdlib.strtod_test.strtod_round
  - lib.msun.fe_round_test.t_nofe_round

In lib/msun/tests/Makefile only define on fe_round_test.c because
lib.msun.ilogb_test.ilogb will get wrong results and needs more examination.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoFix dtrace test case after r351423 due to ping6(8) options changed
lwhsu [Sat, 31 Aug 2019 15:10:27 +0000 (15:10 +0000)]
Fix dtrace test case after r351423 due to ping6(8) options changed

Failure test case:
    cddl.usr.sbin.dtrace.common.ip.t_dtrace_contrib.tst_ipv6localicmp_ksh

Sponsored by: The FreeBSD Foundation

4 years agoFix tests use /etc/motd after r350184 by using an always existing file
lwhsu [Sat, 31 Aug 2019 14:41:58 +0000 (14:41 +0000)]
Fix tests use /etc/motd after r350184 by using an always existing file

Sponsored by: The FreeBSD Foundation

4 years agozfs: fix snapshot dir destruction after introducion of VOP_NEED_INACTIVE
mjg [Sat, 31 Aug 2019 13:24:22 +0000 (13:24 +0000)]
zfs: fix snapshot dir destruction after introducion of VOP_NEED_INACTIVE

Reported by: lwhsu
PR: 240221
Sponsored by: The FreeBSD Foundation

4 years agoImprove function definition.
tuexen [Sat, 31 Aug 2019 13:13:40 +0000 (13:13 +0000)]
Improve function definition.

MFC after: 3 days

4 years agoImprove the handling of illegal sequence number combinations in received
tuexen [Sat, 31 Aug 2019 08:18:49 +0000 (08:18 +0000)]
Improve the handling of illegal sequence number combinations in received
data chunks. Abort the association if there are data chunks with larger
fragement sequence numbers than the fragement sequence of the last
fragment.
Thanks to Mark Wodrich from Google who found this issue by fuzz testing
the userland stack and reporting this issue in
https://github.com/sctplab/usrsctp/issues/355

MFC after: 3 days

4 years agoloader.efi: use shift 16 in efipart as it is max ashift supported by zfs
tsoome [Sat, 31 Aug 2019 06:24:09 +0000 (06:24 +0000)]
loader.efi: use shift 16 in efipart as it is max ashift supported by zfs

4 years agovfs: add a missing VNODE_REFCOUNT_FENCE_REL to v_incr_usecount_locked
mjg [Fri, 30 Aug 2019 21:54:45 +0000 (21:54 +0000)]
vfs: add a missing VNODE_REFCOUNT_FENCE_REL to v_incr_usecount_locked

Sponsored by: The FreeBSD Foundation

4 years agoEarliest reference to /dev/null I can find is in v4 sh(1) and nulldev in
sevan [Fri, 30 Aug 2019 21:49:00 +0000 (21:49 +0000)]
Earliest reference to /dev/null I can find is in v4 sh(1) and nulldev in
nsys/ken/subr.c
via TUHS archive
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V4

MFC after: 5 days

4 years agoqemu-system-aarch64 does list block device with very large block size
tsoome [Fri, 30 Aug 2019 20:54:30 +0000 (20:54 +0000)]
qemu-system-aarch64 does list block device with very large block size

Also insert Vendor device as "parent" disk (found in
qemu-system-aarch64 -cpu cortex-a57).

This does fix lsdev in loader.efi on this platform.

4 years agoWrap a vlan's parent's if_output in a separate function.
mjoras [Fri, 30 Aug 2019 20:19:43 +0000 (20:19 +0000)]
Wrap a vlan's parent's if_output in a separate function.

When a vlan interface is created, its if_output is set directly to the
parent interface's if_output. This is fine in the normal case but has an
unfortunate consequence if you end up with a certain combination of vlan
and lagg interfaces.

Consider you have a lagg interface with a single laggport member. When
an interface is added to a lagg its if_output is set to
lagg_port_output, which blackholes traffic from the normal networking
stack but not certain frames from BPF (pseudo_AF_HDRCMPLT). If you now
create a vlan with the laggport member (not the lagg interface) as its
parent, its if_output is set to lagg_port_output as well. While this is
confusing conceptually and likely represents a misconfigured system, it
is not itself a problem. The problem arises when you then remove the
lagg interface. Doing this resets the if_output of the laggport member
back to its original state, but the vlan's if_output is left pointing to
lagg_port_output. This gives rise to the possibility that the system
will panic when e.g. bpf is used to send any frames on the vlan
interface.

Fix this by creating a new function, vlan_output, which simply wraps the
parent's current if_output. That way when the parent's if_output is
restored there is no stale usage of lagg_port_output.

Reviewed by: rstone
Differential Revision: D21209

4 years agoUpdate and clean up the UMA man page.
markj [Fri, 30 Aug 2019 19:35:44 +0000 (19:35 +0000)]
Update and clean up the UMA man page.

- Fix warnings from igor and mandoc.
- Provide a brief description of the separation between zones and their
  backend slab allocators.
- Document cache zones and secondary zones.
- Document the kernel config options added in r350659.
- Document the uma_zalloc_pcpu() and uma_zfree_pcpu() wrappers.
- Document uma_zone_reserve(), uma_zone_reserve_kva() and
  uma_zone_prealloc().
- Document uma_zone_alloc() and uma_zone_freef().
- Add some missing MLINKs and Xrefs.

MFC after: 2 weeks

4 years agoavoid holding PCB mutex during copyin/copyout()
emax [Fri, 30 Aug 2019 16:35:31 +0000 (16:35 +0000)]
avoid holding PCB mutex during copyin/copyout()

Reported by: imp, mms dot vanbreukelingen at gmail dot com
Reviewed by: imp

4 years agoAdd entries for unmapped mbufs and KTLS.
jhb [Fri, 30 Aug 2019 16:30:09 +0000 (16:30 +0000)]
Add entries for unmapped mbufs and KTLS.

4 years agoProperly check for an interrupted cv_wait_sig().
markj [Fri, 30 Aug 2019 15:40:31 +0000 (15:40 +0000)]
Properly check for an interrupted cv_wait_sig().

The returned error number may be EINTR or ERESTART depending on
whether or not the signal is supposed to interrupt the system call.

Reported and tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

4 years agoRemove unneeded blank line. No functional change.
delphij [Fri, 30 Aug 2019 06:06:12 +0000 (06:06 +0000)]
Remove unneeded blank line.  No functional change.

MFC after: 2 weeks

4 years agovfs: tidy up assertions in vfs_subr
mjg [Fri, 30 Aug 2019 00:45:53 +0000 (00:45 +0000)]
vfs: tidy up assertions in vfs_subr

- assert unlocked vnode interlock in vref
- assert right counts in vputx
- print debug info for panic in vdrop

Sponsored by: The FreeBSD Foundation

4 years agoxdma: avoid NULL deref in error case
emaste [Fri, 30 Aug 2019 00:40:08 +0000 (00:40 +0000)]
xdma: avoid NULL deref in error case

Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoqlxgbe: avoid NULL deref in error case
emaste [Fri, 30 Aug 2019 00:38:16 +0000 (00:38 +0000)]
qlxgbe: avoid NULL deref in error case

Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoexynos5: avoid NULL deref in error case
emaste [Fri, 30 Aug 2019 00:36:17 +0000 (00:36 +0000)]
exynos5: avoid NULL deref in error case

Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
MFC with: r351618
Sponsored by: The FreeBSD Foundation

4 years agoexynos5: avoid NULL deref in error case
emaste [Fri, 30 Aug 2019 00:34:27 +0000 (00:34 +0000)]
exynos5: avoid NULL deref in error case

Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agonullfs: use VOP_NEED_INACTIVE
mjg [Fri, 30 Aug 2019 00:30:03 +0000 (00:30 +0000)]
nullfs: use VOP_NEED_INACTIVE

Reviewed by: kib
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation

4 years agoUse mbuf queue instead of ifqueue in USB network drivers.
glebius [Fri, 30 Aug 2019 00:05:04 +0000 (00:05 +0000)]
Use mbuf queue instead of ifqueue in USB network drivers.

Reviewed by: stevek

4 years agoAllow mbuf queues to be unlimited.
glebius [Fri, 30 Aug 2019 00:03:41 +0000 (00:03 +0000)]
Allow mbuf queues to be unlimited.

There is number of legacy code that uses ifqueue without setting
a limit on it first. Easier to allow for that rather than improve
legacy drivers.

4 years ago- address missing whitespace for indent
jgh [Thu, 29 Aug 2019 23:23:12 +0000 (23:23 +0000)]
- address missing whitespace for indent

PR: 239727
Submitted by: gbergling@gmail.com
Reviewed by: 0mp@
MFC after: 1 week

4 years agoRemove unused VM page locking macros.
markj [Thu, 29 Aug 2019 22:13:15 +0000 (22:13 +0000)]
Remove unused VM page locking macros.

They were orphaned by r292373.

Reviewed by: asomers
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21469

4 years agoSimplify bhyve vlapic ESR logic.
jhb [Thu, 29 Aug 2019 18:23:38 +0000 (18:23 +0000)]
Simplify bhyve vlapic ESR logic.

The bhyve virtual local APIC uses an instance-global flag to indicate
when an error LVT is being delivered to prevent infinite recursion.
Use a function argument instead to reduce the amount of instance-global
state.

This was inspired by reviewing the bhyve save/restore work, which
saves a copy of the instance-global state for each vlapic.

Smart OS bug: https://smartos.org/bugview/OS-7777
Submitted by: Patrick Mooney
Reviewed by: markj, rgrimes
Obtained from: SmartOS / Joyent
Differential Revision: https://reviews.freebsd.org/D20365

4 years agoUse relative paths in ObsoleteFiles.inc
zeising [Thu, 29 Aug 2019 17:25:50 +0000 (17:25 +0000)]
Use relative paths in ObsoleteFiles.inc

Approved by: imp
Differential Revision: https://reviews.freebsd.org/D21467

4 years agopwm.9 symlink shouldn't be removed
zeising [Thu, 29 Aug 2019 17:17:39 +0000 (17:17 +0000)]
pwm.9 symlink shouldn't be removed

When the pwm.9 manual was removed, a symlink between pwmbus.9 and pwm.9 was
created, but there's an entry in ObsoleteFiles.inc to remove pwn.9, meaning
that on every installation pwm.9 is created, and make delete-old deletes it.

Remove the entry from ObsoleteFiles.inc, the symlink is clearly intentional
and shouldn't be removed.

Reviewed by: imp, ian
Approved by: imp (implicit, review OK)
Differential Revision: https://reviews.freebsd.org/D21198

4 years agoTake proper lock in ses_setphyspath_callback().
mav [Thu, 29 Aug 2019 17:02:02 +0000 (17:02 +0000)]
Take proper lock in ses_setphyspath_callback().

XPT_DEV_ADVINFO call should be protected by the lock of the specific
device it is addressed to, not the lock of SES device.  In some weird
case, probably with hardware violating standards, it sometimes caused
NULL dereference due to race.

To protect from it further, add lock assertion to *_dev_advinfo().

MFC after: 1 week
Sponsored by: iXsystems, Inc.

4 years agoMan page for AMD Non-Transparent Bridge (ntb_hw_amd) driver.
mav [Thu, 29 Aug 2019 13:46:54 +0000 (13:46 +0000)]
Man page for AMD Non-Transparent Bridge (ntb_hw_amd) driver.

Submitted by: Rajesh Kumar <rajesh1.kumar@amd.com>
Reviewed by: bcr
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D21462

4 years agoichsmb: defer smbus attach until interrupts are available
yuripv [Thu, 29 Aug 2019 12:49:21 +0000 (12:49 +0000)]
ichsmb: defer smbus attach until interrupts are available

This fixes a "timed sleep before timers are working" panic seen
while attaching jedec_dimm(4) instances too early in the boot.

Submitted by: ian
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D21452

4 years agovnic: avoid NULL deref in error case
emaste [Thu, 29 Aug 2019 12:05:06 +0000 (12:05 +0000)]
vnic: avoid NULL deref in error case

Reported by: Dr Silvio Cesare of InfoSect
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agoscsi_cd: whitespace cleanup
avg [Thu, 29 Aug 2019 08:26:40 +0000 (08:26 +0000)]
scsi_cd: whitespace cleanup

Remove trailing whitespace and fix mixed indentation.

MFC after: 3 weeks

4 years agoscsi_cd: ifdef out cdsize()
avg [Thu, 29 Aug 2019 08:19:11 +0000 (08:19 +0000)]
scsi_cd: ifdef out cdsize()

It was used only by the old cdcheckmedia().

MFC after: 3 weeks

4 years agoscsi_cd: make the media check asynchronous
avg [Thu, 29 Aug 2019 07:51:11 +0000 (07:51 +0000)]
scsi_cd: make the media check asynchronous

This makes the media check process asynchronous, so we no longer block
in cdstrategy() to check for media.

PR: 219857
Obtained from: ken
MFC after: 3 weeks

4 years agoRework v_object lifecycle for vnodes.
kib [Thu, 29 Aug 2019 07:50:25 +0000 (07:50 +0000)]
Rework v_object lifecycle for vnodes.

Current implementation of vnode_create_vobject() and
vnode_destroy_vobject() is written so that it prepared to handle the
vm object destruction for live vnode.  Practically, no filesystems use
this, except for some remnants that were present in UFS till today.
One of the consequences of that model is that each filesystem must
call vnode_destroy_vobject() in VOP_RECLAIM() or earlier, as result
all of them get rid of the v_object in reclaim.

Move the call to vnode_destroy_vobject() to vgonel() before
VOP_RECLAIM().  This makes v_object stable: either the object is NULL,
or it is valid vm object till the vnode reclamation.  Remove code from
vnode_create_vobject() to handle races with the parallel destruction.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21412

4 years agoUFS: stop reusing the vnode for reallocated inode.
kib [Thu, 29 Aug 2019 07:45:23 +0000 (07:45 +0000)]
UFS: stop reusing the vnode for reallocated inode.

In ffs_valloc(), force reclaim existing vnode on inode reuse, instead
of trying to re-initialize the same vnode for new purposes.  This is
done in preparation of changes to the vp->v_object lifecycle handling.

A new FFSV_REPLACE flag to ffs_vgetf() directs the function to
vgone(9) the vnode if found in vfs hash, instead of returning it.

Reviewed by: markj, mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21412

4 years agoFix qmath(3) build problems with GCC 8.
trasz [Thu, 29 Aug 2019 07:39:31 +0000 (07:39 +0000)]
Fix qmath(3) build problems with GCC 8.

Discussed with: asomers
Sponsored by: Klara Systems
Differential Revision: https://reviews.freebsd.org/D21442

4 years agoRemove useless redefinition of NSFBUFS in i386/vm_machdep.c.
kib [Thu, 29 Aug 2019 07:34:14 +0000 (07:34 +0000)]
Remove useless redefinition of NSFBUFS in i386/vm_machdep.c.

Sponsored by: The FreeBSD Foundation

4 years agoCentralize __pcpu definitions.
kib [Thu, 29 Aug 2019 07:25:27 +0000 (07:25 +0000)]
Centralize __pcpu definitions.

Many extern struct pcpu <something>__pcpu declarations were
copied/pasted in sources.  The issue is that the definition is MD, but
it cannot be provided by machine/pcpu.h due to actual struct pcpu
defined in sys/pcpu.h later than the inclusion of machine/pcpu.h.
This forced the copying when other code needed direct access to
__pcpu.  There is no way around it, due to machine/pcpu.h supplying
part of struct pcpu fields.

To work around the problem, add a new machine/pcpu_aux.h header, which
should fill any needed MD definitions after struct pcpu definition is
completed. This allows to remove copies of __pcpu spread around the
source.  Also on x86 it makes it possible to remove work arounds like
OFFSETOF_CURTHREAD or clang specific warnings supressions.

Reported and tested by: lwhsu, bcran
Reviewed by: imp, markj (previous version)
Discussed with: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21418

4 years agozfs_ioc_snapshot: check user-prop permissions on snapshotted datasets
avg [Thu, 29 Aug 2019 07:19:06 +0000 (07:19 +0000)]
zfs_ioc_snapshot: check user-prop permissions on snapshotted datasets

Previously, the permissions were checked on the pool which was obviously
incorrect.

After this change, zfs_check_userprops() only validates the properties
without any permission checks.  The permissions are checked individually
for each snapshotted dataset.

This was also committed to ZoL: zfsonlinux/zfs@e6203d2

Reported by: CyberSecure
MFC after: 1 week
Sponsored by: CyberSecure

4 years agoFix address annotation in xml output from w
karels [Thu, 29 Aug 2019 02:44:18 +0000 (02:44 +0000)]
Fix address annotation in xml output from w

The libxo xml feature of adding an annotation with the "original"
address from the utmpx file if it is different than the final "from"
field was broken by r351379. This was pointed out by the gcc error
that save_p might be used uninitialized. Save the original address
as needed in each entry, don't just use the last one from the previous
loop.

Reviewed by: marcel@
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21390