]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMove devmatch to sbin from usr/sbin.
imp [Mon, 12 Feb 2018 14:44:21 +0000 (14:44 +0000)]
Move devmatch to sbin from usr/sbin.

Since we want to use devmatch in context before a split /,/usr system
has mounted /usr, move devmatch to /sbin.

Sponsored by: Netflix

6 years agoFix typo
imp [Mon, 12 Feb 2018 06:52:49 +0000 (06:52 +0000)]
Fix typo

6 years agoTurn devmatch on by default.
imp [Mon, 12 Feb 2018 06:51:20 +0000 (06:51 +0000)]
Turn devmatch on by default.

Turn devmatch on by default. However, use 'start' instead of
'onestart' in the devmatch.conf file so the setting of
'devmatch_enable' is honored. Give an example of what to put in
devd.conf if you want to disable just the run-time part of devmatch.

Relnotes: yes

6 years agoAdd usb.conf to ObsoleteFiles.
imp [Mon, 12 Feb 2018 06:42:38 +0000 (06:42 +0000)]
Add usb.conf to ObsoleteFiles.
Add a note to UPDATING.
Fix a missing tab.

Relnotes: Yes

6 years agoInstall devmatch.conf, don't install usb.conf
imp [Mon, 12 Feb 2018 04:54:51 +0000 (04:54 +0000)]
Install devmatch.conf, don't install usb.conf

6 years agoInstall devmatch int /etc/rc.d and echo modules being installed.
imp [Mon, 12 Feb 2018 04:52:25 +0000 (04:52 +0000)]
Install devmatch int /etc/rc.d and echo modules being installed.

6 years agoSwitch to using devmatch to autoload drivers. Remove usb.conf
imp [Mon, 12 Feb 2018 04:45:26 +0000 (04:45 +0000)]
Switch to using devmatch to autoload drivers. Remove usb.conf
as obsolete because devmatch gets its information from the same
place as the genration scripts.

6 years agoAdd devmatch rc.d integration
imp [Mon, 12 Feb 2018 04:45:17 +0000 (04:45 +0000)]
Add devmatch rc.d integration

Create simple script to load modules on demand based on the device
identifying information.

Sponsored by: Netflix

6 years agodevice_add_child.9: reference logical opposite, device_delete_child(9)
cem [Sun, 11 Feb 2018 22:09:07 +0000 (22:09 +0000)]
device_add_child.9: reference logical opposite, device_delete_child(9)

6 years agoPrint out the shared memory queues during initialization
scottl [Sun, 11 Feb 2018 20:15:47 +0000 (20:15 +0000)]
Print out the shared memory queues during initialization

Sponsored by: Netflix

6 years agoUse syscall_helper_register(9) rather than syscall_register().
brooks [Sun, 11 Feb 2018 18:37:08 +0000 (18:37 +0000)]
Use syscall_helper_register(9) rather than syscall_register().

The usage is simpler, documented, and more common.

Reviewed by: cem
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14227

6 years agoConsistent macro indentation is the hobgoblin of small minds
imp [Sun, 11 Feb 2018 17:45:38 +0000 (17:45 +0000)]
Consistent macro indentation is the hobgoblin of small minds

Line up the macro definitions and names here like the machine/stdarg.h
files that this replaced. This is easier to read and also makes it
easier to match up with other includes. Also two space indent va_end
to match the rest of the surrounding if block.

6 years agoRegenerate devd/usb.conf after the recent addition of several new device IDs.
ian [Sun, 11 Feb 2018 16:35:56 +0000 (16:35 +0000)]
Regenerate devd/usb.conf after the recent addition of several new device IDs.

6 years agoAdd a device ID to uftdi for TIAO USB Multi Protocol Adapter (TUMPA).
ian [Sun, 11 Feb 2018 16:35:23 +0000 (16:35 +0000)]
Add a device ID to uftdi for TIAO USB Multi Protocol Adapter (TUMPA).

PR: 225810

6 years agoAdd Thomas Zander to ports-secteam
feld [Sun, 11 Feb 2018 16:12:55 +0000 (16:12 +0000)]
Add Thomas Zander to ports-secteam

6 years agoMake lock(1) use PAM. This makes the -p option work again. (Well, kind of,
trasz [Sun, 11 Feb 2018 13:35:31 +0000 (13:35 +0000)]
Make lock(1) use PAM.  This makes the -p option work again.  (Well, kind of,
because the whole idea of this utility is rather broken.)

This originally come from NetBSD, and was later reworked a bit.

Reviewed by: des@ (earlier version)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D4981

6 years agoAdd GUID and alias for Apple APFS partition
cem [Sun, 11 Feb 2018 06:57:20 +0000 (06:57 +0000)]
Add GUID and alias for Apple APFS partition

PR: 225813
Submitted by: James Wright <james.wright AT jigsawdezign.com>

6 years agoFix typo in dtrace_tcp(4)
dteske [Sun, 11 Feb 2018 03:02:29 +0000 (03:02 +0000)]
Fix typo in dtrace_tcp(4)

Using args[2]->tcps_state as-documented results in error:
operator -> cannot be applied to pointer to type "void"

This error is accurate as the synopsis for tcp:::state-change is:
tcp:::state-change(void *, csinfo_t *, void *, tcpsinfo_t *, void *,
    tcplsinfo_t *);

args[2] refers to the third argument which is always NULL (as-
documented). The to-state for the TCP connection state transition is
actually in the fourth argument, args[3]->tcps_state.

6 years agoDocument syscall_helper_register(9), syscall_helper_unregister(9)
cem [Sat, 10 Feb 2018 20:34:09 +0000 (20:34 +0000)]
Document syscall_helper_register(9), syscall_helper_unregister(9)

6 years agoConvert tools/regression/sockets/socketpair to ATF
asomers [Sat, 10 Feb 2018 19:43:52 +0000 (19:43 +0000)]
Convert tools/regression/sockets/socketpair to ATF

Reviewed by: cem
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14305

6 years agosocketpair.2: Reference relevant POSIX standards
cem [Sat, 10 Feb 2018 19:41:32 +0000 (19:41 +0000)]
socketpair.2: Reference relevant POSIX standards

Sponsored by: Dell EMC Isilon

6 years agoFix uninitialized warning, and work around a bug in gcc over clobbering
jhibbits [Sat, 10 Feb 2018 17:17:15 +0000 (17:17 +0000)]
Fix uninitialized warning, and work around a bug in gcc over clobbering

Summary:
r329077 caused gcc to emit uninitialized use warnings.  Attempting to
fix those warnings yielded the following warnings:

usr.bin/tftp/main.c: In function 'main':
usr.bin/tftp/main.c:181: warning: variable 'el' might be clobbered by
'longjmp' or 'vfork'
usr.bin/tftp/main.c:182: warning: variable 'hist' might be clobbered by
'longjmp' or 'vfork'

This is a known bug in gcc, found at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24239

Work around that by simply marking hist and el as static.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14302

6 years agoppp(8): fix code producing debugging logs
eugen [Sat, 10 Feb 2018 17:09:51 +0000 (17:09 +0000)]
ppp(8): fix code producing debugging logs

Fix several cases when long buffer is copied to shorter one
using snprintf that results in contents truncation and
clobbering unsaved errno value and creation of misleading logs.

PR: 218517
Approved by: avg (mentor)
MFC after: 1 month

6 years agodts: Update our device tree sources files from Linux 4.15
manu [Sat, 10 Feb 2018 15:29:46 +0000 (15:29 +0000)]
dts: Update our device tree sources files from Linux 4.15

6 years agolibcompat: Use %hu for unsigned shorts.
pfg [Sat, 10 Feb 2018 14:45:29 +0000 (14:45 +0000)]
libcompat: Use %hu for unsigned shorts.

Obtained from: DragonFlyBSD (git  82e1476a)

6 years agoReinitialize IP header length after checksum calculation. It is used
ae [Sat, 10 Feb 2018 10:13:17 +0000 (10:13 +0000)]
Reinitialize IP header length after checksum calculation. It is used
later by TCP-MD5 code.

This fixes the problem with broken TCP-MD5 over IPv4 when NIC has
disabled TCP checksum offloading.

PR: 223835
MFC after: 1 week

6 years agoUse syscall_helper_register() to register syscalls and initialize though
brooks [Sat, 10 Feb 2018 01:09:22 +0000 (01:09 +0000)]
Use syscall_helper_register() to register syscalls and initialize though
the module interface.

This is the more common approach and the syscall_helper interface is
easier to understand.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14251

6 years agoTeach mps(4) and mpr(4) drivers to autotune chain frames.
mav [Sat, 10 Feb 2018 00:55:46 +0000 (00:55 +0000)]
Teach mps(4) and mpr(4) drivers to autotune chain frames.

This is a first part of the change.  It makes the drivers to calculate
the required number of chain frames to satisfy worst case scenarios, but
it does not change existing overly strict limits on them.  The next step
will be to rewrite the allocator to not require megabytes of physically
contiguous address space, that may be problematic if done after boot,
after doing which the limits can be removed.  Until that this code can
just correct user set limits, if they are set too high.

Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D14261

6 years agoRegen src.conf.5 after r329093, WITH_/WITHOUT_LLVM_COV
emaste [Sat, 10 Feb 2018 00:27:29 +0000 (00:27 +0000)]
Regen src.conf.5 after r329093, WITH_/WITHOUT_LLVM_COV

6 years agoPromote llvm-cov to a standalone option
emaste [Sat, 10 Feb 2018 00:22:35 +0000 (00:22 +0000)]
Promote llvm-cov to a standalone option

Introduce WITH_/WITHOUT_LLVM_COV to match GCC's WITH_/WITHOUT_GCOV.
It is intended to provide a superset of the interface and functionality
of gcov.

It is enabled by default when building Clang, similarly to gcov and GCC.

This change moves one file in libllvm to be compiled unconditionally.
Previously it was included only when WITH_CLANG_EXTRAS was set, but the
complexity of a new special case for (CLANG_EXTRAS | LLVM_COV) is not
worth avoiding a tiny increase in build time.

Reviewed by: dim, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D142645

6 years agoAdd a deprecation warning when using the feature which mounts devices
brooks [Sat, 10 Feb 2018 00:22:25 +0000 (00:22 +0000)]
Add a deprecation warning when using the feature which mounts devices
to see how much space it on them.

Adjust MOUNT_CHAR_DEVS to allow the free space of already mounted
devices to be displayed and report an appropriate error if the
device isn't mounted.

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

6 years agoAdd sysctls for dnode block and indirect block shifts.
mav [Fri, 9 Feb 2018 23:29:50 +0000 (23:29 +0000)]
Add sysctls for dnode block and indirect block shifts.

MFC after: 2 weeks

6 years agoAdd an explanation of the block size units output by prtblknos.
mckusick [Fri, 9 Feb 2018 22:23:10 +0000 (22:23 +0000)]
Add an explanation of the block size units output by prtblknos.

Suggested by: Ravi Pokala (rpokala@)

6 years agoMFV: r329072
jkim [Fri, 9 Feb 2018 21:49:38 +0000 (21:49 +0000)]
MFV: r329072

Merge ACPICA 20180209.

6 years agoFix PowerMac G5 thermal management, plus likely other bugs, introduced in
nwhitehorn [Fri, 9 Feb 2018 20:09:32 +0000 (20:09 +0000)]
Fix PowerMac G5 thermal management, plus likely other bugs, introduced in
r328113 and affecting SMP systems.

The way the time is set on PowerMacs is racy and relies on all the
CPUs in the system setting a register simultaneously in a rendezvous. A
few-cycle delay can result in out-of-sync times, which can break the
scheduler and result in calls like mtx_sleep() and pause() never timing out
if the thread is migrated while sleeping. r328113 added a call to a no-op
function between the beginning of the rendezvous and setting the time that
was only called on APs and added enough cycles to cause a problematic offset.
For some reason, the fan-management code was the first place this appeared.

Clue from: andreast
Reported by: many

6 years agotftp(1): Clean up leading and trailing whitespace
cem [Fri, 9 Feb 2018 20:00:51 +0000 (20:00 +0000)]
tftp(1): Clean up leading and trailing whitespace

Whitespace-only change.

Sponsored by: Dell EMC Isilon

6 years agoMerge biodone_finish() back into biodone(). The primary purpose is
mckusick [Fri, 9 Feb 2018 19:50:47 +0000 (19:50 +0000)]
Merge biodone_finish() back into biodone(). The primary purpose is
to make the order of operations clearer to avoid the race condition
that was fixed in r328914. In particular, this commit corrects a
similar race that existed in the soft updates callback.

Doing some sleuthing through the SVN repository, it appears that
bufdone_finish() was added to support XFS:

------------------------------------------------------------------------
r153192 | rodrigc | 2005-12-06 19:39:08 -0800 (Tue, 06 Dec 2005) | 13 lines

Changes imported from XFS for FreeBSD project:
- add fields to struct buf (needed by XFS)
    - 3 private fields: b_fsprivate1, b_fsprivate2, b_fsprivate3
    - b_pin_count, count of pinned buffer

- add new B_MANAGED flag
- add breada() function to initiate asynchronous I/O on read-ahead blocks.
- add bufdone_finish(), bpin(), bunpin_wait() functions

Patches provided by:    kan
Reviewed by:            phk
Silence on:             arch@

------------------------------------------------------------------------

It does not appear to ever have been used for anything else.  XFS was
disconnected in r241607:

------------------------------------------------------------------------
r241607 | attilio | 2012-10-16 03:04:00 -0700 (Tue, 16 Oct 2012) | 5 lines

Disconnect non-MPSAFE XFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.

------------------------------------------------------------------------

and removed entirely in r247631:

------------------------------------------------------------------------
r247631 | attilio | 2013-03-02 07:33:54 -0800 (Sat, 02 Mar 2013) | 5 lines

Garbage collect XFS bits which are now already completely disconnected
from the tree since few months.

This is not targeted for MFC.

------------------------------------------------------------------------

Since XFS support is gone, there is no reason to retain biodone_finish().

Suggested by: Warner Losh (imp)
Discussed with: cem, kib
Tested by: Peter Holm (pho)

6 years agotftp(1): Fix libedit state corruption involving signals
cem [Fri, 9 Feb 2018 19:46:51 +0000 (19:46 +0000)]
tftp(1): Fix libedit state corruption involving signals

This bug was first reported 14 years ago.  The problem was understood 8.5
years ago.  A patch that is functionally identical to this one was proposed
almost 8 years ago and languished in the PR system / Bugzilla.

PR: 63197
Submitted by: lxv AT omut.org, fernando.apesteguia AT gmail.com
Reported by: freebsd AT nbritton.org

6 years agoThis is a little C-program that can be used to print out the list
mckusick [Fri, 9 Feb 2018 19:10:46 +0000 (19:10 +0000)]
This is a little C-program that can be used to print out the list
of blocks used by a requested list of inodes.

For example, to list the blocks referenced by your kernel:

guest_12 % df /
Filesystem      1K-blocks     Used   Avail Capacity  Mounted on
/dev/gpt/rootfs  20307196 10707336 7975288    57%    /

guest_12 % ls -i /boot/kernel/kernel
160603 /boot/kernel/kernel

guest_12 % ./prtblknos /dev/gpt/rootfs 160603
160603: lbn 0-7 blkno 3217584-3217647
lbn 8-11 blkno 3217864-3217895 distance 216
First-level indirect, blkno 3217896-3217903 distance 0
lbn 12-19 blkno 3217904-3217967 distance 8
lbn 20-75 blkno 3251816-3252263 distance 33848
lbn 76-83 blkno 3252368-3252431 distance 104
lbn 84-91 blkno 3252464-3252527 distance 32
lbn 92-852 blkno 3252896-3258983 distance 368

Each contiguous range of blocks is printed on a line.
The distance metric is the size of the gap from the end of the
previous set of blocks to the beginning of the next set of blocks.
Short distances are desirable.

6 years agosort needs to be in ITOOLS since find -s was changed to find | sort.
imp [Fri, 9 Feb 2018 18:47:00 +0000 (18:47 +0000)]
sort needs to be in ITOOLS since find -s was changed to find | sort.

6 years agoImport ACPICA 20180209.
jkim [Fri, 9 Feb 2018 18:18:00 +0000 (18:18 +0000)]
Import ACPICA 20180209.

6 years agoOn bootup, the amd64 pmap initialization code creates page-table
jtl [Fri, 9 Feb 2018 17:46:33 +0000 (17:46 +0000)]
On bootup, the amd64 pmap initialization code creates page-table
mappings for the pages used for the kernel and some initial allocations
used for the page table. It maps the kernel and the blocks used for
these initial allocations using 2MB pages.

However, if the kernel does not end on a 2MB boundary, it still maps the
last portion using a 2MB page, but reports that the unused 4K blocks
within this 2MB allocation are free physical blocks. This means that
these same physical blocks could also be mapped elsewhere - for example,
into a user process. Given the proximity to the kernel text and data
area, it seems wise to avoid allowing someone to write data to physical
blocks also mapped into these virtual addresses.

(Note that this isn't a security vulnerability: the direct map makes
most/all memory on the system mapped into kernel space. And, nothing
in the kernel should be trying to access these pages, as the virtual
addresses are unused. It simply seems wise to avoid reusing these
physical blocks while they are mapped to virtual addresses so close
to the kernel text and data area.)

Consequently, let's reserve the physical blocks covered by the
page-table mappings for these initial allocations.

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

6 years agoFix "zpool add" crash when a replacing vdev has a spare child
asomers [Fri, 9 Feb 2018 16:08:57 +0000 (16:08 +0000)]
Fix "zpool add" crash when a replacing vdev has a spare child

Fix an assertion in zpool that causes a crash when running any "zpool add"
command on a spare that contains a replacing vdev with a spare child.

This likely affects Illumos, too.

PR: 225546
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D14138

6 years agoWe don't actually need env here, so drop it. All shells allow setting
imp [Fri, 9 Feb 2018 15:50:32 +0000 (15:50 +0000)]
We don't actually need env here, so drop it. All shells allow setting
of shell variables for the next command like this.

6 years agoTeach nanobsd about armv7, add -m to qemu invocations
kevans [Fri, 9 Feb 2018 14:31:11 +0000 (14:31 +0000)]
Teach nanobsd about armv7, add -m to qemu invocations

qemu defaults to 128 MiB of RAM, which has been found to not necessarily be
enough for booting the system, at least on amd64 and armv7

Add a sensible -m 512 to the examples so that they'll work out of the box
in the general case.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D14234

6 years agoloader: fix endianness conversion
royger [Fri, 9 Feb 2018 10:20:16 +0000 (10:20 +0000)]
loader: fix endianness conversion

r328536 broke symbol loading on amd64 at least (and probably other
arches). r328826 contained the problem to ppc only by adding
pre-processors guards.

Fix this properly by moving the endianness conversion to separate
helper functions, and make the conversion more robust by using sizeof
instead of having to manually code the size of each field.

Finally list the fields in each structure in a macro in order to avoid
code repetition.

Sponsored by: Citrix Systems R&D
Reviewed by: kib emaste wma
Differential revision: https://reviews.freebsd.org/D14267

6 years agoFix boot_pages exhaustion on machines with many domains and cores, where
glebius [Fri, 9 Feb 2018 04:45:39 +0000 (04:45 +0000)]
Fix boot_pages exhaustion on machines with many domains and cores, where
size of UMA zone allocation is greater than page size. In this case zone
of zones can not use UMA_MD_SMALL_ALLOC, and we  need to postpone switch
off of this zone from startup_alloc() until full launch of VM.

o Always supply number of VM zones to uma_startup_count(). On machines
  with UMA_MD_SMALL_ALLOC ignore it completely, unless zsize goes over
  a page. In the latter case account VM zones for number of allocations
  from the zone of zones.
o Rewrite startup_alloc() so that it will immediately switch off from
  itself any zone that is already capable of running real alloc.
  In worst case scenario we may leak a single page here. See comment
  in uma_startup_count().
o Hardcode call to uma_startup2() into vm_mem_init(). Otherwise some
  extra SYSINITs, e.g. vm_page_init() may sneak in before.
o While here, remove uma_boot_pages_mtx. With recent changes to boot
  pages calculation, we are guaranteed to use all of the boot_pages
  in the early single threaded stage.

Reported & tested by: mav

6 years agoSet script.lang in the environment to either 'forth' or 'simple' to
imp [Fri, 9 Feb 2018 00:36:55 +0000 (00:36 +0000)]
Set script.lang in the environment to either 'forth' or 'simple' to
reflect what scripting language was compiled into the loader. I
anticipate that being able to find this out quickly from the OK prompt
will be useful in troubleshooting in the future.

6 years agoFix ICMPv6 redirects
vangyzen [Fri, 9 Feb 2018 00:13:05 +0000 (00:13 +0000)]
Fix ICMPv6 redirects

icmp6_redirect_input() validates that a redirect packet came from the
current gateway for the respective destination.  To do this, it compares
the source address, which has an embedded scope zone id, to the next-hop
address, which does not.  If the address is link-local, which should be
the case, the comparison fails and the redirect is ignored.

Insert the scope zone id into the next-hop address so the comparison
is accurate.

Unsurprisingly, this fixes 35 UNH IPv6 conformance test cases.

Submitted by: Farrell Woods <Farrell_Woods@Dell.com> (initial revision)
Reviewed by: ae melifaro dab
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14254

6 years agoInclude files missed in 329051.
mckusick [Thu, 8 Feb 2018 23:14:24 +0000 (23:14 +0000)]
Include files missed in 329051.

6 years agoThe goal of this change is to prevent accidental foot shooting by
mckusick [Thu, 8 Feb 2018 23:06:58 +0000 (23:06 +0000)]
The goal of this change is to prevent accidental foot shooting by
folks running filesystems created on check-hash enabled kernels
(which I will call "new") on a non-check-hash enabled kernels (which
I will call "old). The idea here is to detect when a filesystem is
run on an old kernel and flag the filesystem so that when it gets
moved back to a new kernel, it will not start getting a slew of
check-hash errors.

Back when the UFS version 2 filesystem was created, it added a file
flag FS_INDEXDIRS that was to be set on any filesystem that kept
some sort of on-disk indexing for directories. The idea was precisely
to solve the issue we have today. Specifically that a newer kernel
that supported indexing would be able to tell that the filesystem
had been run on an older non-indexing kernel and that the indexes
should not be used until they had been rebuilt. Since we have never
implemented on-disk directory indicies, the FS_INDEXDIRS flag is
cleared every time any UFS version 2 filesystem ever created is
mounted for writing.

This commit repurposes the FS_INDEXDIRS flag as the FS_METACKHASH
flag. Thus, the FS_METACKHASH is definitively known to have always
been cleared. The FS_INDEXDIRS flag has been moved to a new block
of flags that will always be cleared starting with this commit
(until they get used to implement some future feature which needs
to detect that the filesystem was mounted on a kernel that predates
the new feature).

If a filesystem with check-hashes enabled is mounted on an old
kernel the FS_METACKHASH flag is cleared. When that filesystem is
mounted on a new kernel it will see that the FS_METACKHASH has been
cleared and clears all of the fs_metackhash flags. To get them
re-enabled the user must run fsck (in interactive mode without the
-y flag) which will ask for each supported check hash whether it
should be rebuilt and enabled. When fsck is run in its default preen
mode, it will just ignore the check hashes so they will remain
disabled.

The kernel has always disabled any check hash functions that it
does not support, so as more types of check hashes are added, we
will get a non-surprising result. Specifically if filesystems get
moved to kernels supporting fewer of the check hashes, those that
are not supported will be disabled. If the filesystem is moved back
to a kernel with more of the check-hashes available and fsck is run
interactively to rebuild them, then their checking will resume.
Otherwise just the smaller subset will be checked.

A side effect of this commit is that filesystems running with
cylinder-group check hashes will stop having them checked until
fsck is run to re-enable them (since none of them currently have
the FS_METACKHASH flag set). So, if you want check hashes enabled
on your filesystems after booting a kernel with these changes, you
need to run fsck to enable them. Any newly created filesystems will
have check hashes enabled. If in doubt as to whether you have check
hashes emabled, run dumpfs and look at the list of enabled flags
at the end of the superblock details.

6 years agoFix build of userboot.so
imp [Thu, 8 Feb 2018 22:59:51 +0000 (22:59 +0000)]
Fix build of userboot.so

Since it's not possible to unset a variable easily, create a new
variable 'PIC' to signal that we are creating a shared object that we
want to install. defs.mk refains from defining NO_PIC and ITNERALLIB
when PIC is defined. This unbreaks userboot.so building.

6 years agoPull in r324594 from upstream clang trunk (by Alexander Ivchenko):
dim [Thu, 8 Feb 2018 21:11:48 +0000 (21:11 +0000)]
Pull in r324594 from upstream clang trunk (by Alexander Ivchenko):

  Fix for #31362 - ms_abi is implemented incorrectly for values >=16
  bytes.

  Summary:
  This patch is a fix for following issue:
  https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by
  front end lowering C calling conventions without taking into account
  calling conventions enforced by attribute. In this case win64cc was
  no correctly lowered on targets other than Windows.

  Reviewed By: rnk (Reid Kleckner)

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

  Author: belickim <mateusz.belicki@intel.com>

This fixes clang 6.0.0 assertions when building the emulators/wine and
emulators/wine-devel ports, and should also make it use the correct
Windows calling conventions.  Bump __FreeBSD_version to make the fix
easy to detect.

PR: 224863
MFC after: 3 months
X-MFC-With: r327952

6 years agoModernize nfssvc(2) registartion.
brooks [Thu, 8 Feb 2018 20:09:42 +0000 (20:09 +0000)]
Modernize nfssvc(2) registartion.

Use syscall_helper_register() to register syscalls and do it through the
module interface rather than sysinit.

This pattern is more common and easier to understand.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14232

6 years agoRemove c_rehash(1) to not confuse users. We do not install the Perl script.
jkim [Thu, 8 Feb 2018 19:55:03 +0000 (19:55 +0000)]
Remove c_rehash(1) to not confuse users.  We do not install the Perl script.

MFC after: 3 days

6 years agoUse vm_page_unwire_noq() instead of directly modifying page wire counts.
markj [Thu, 8 Feb 2018 19:28:51 +0000 (19:28 +0000)]
Use vm_page_unwire_noq() instead of directly modifying page wire counts.

No functional change intended.

Reviewed by: alc, kib (previous revision)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14266

6 years agoMFV: r329021
jkim [Thu, 8 Feb 2018 19:26:52 +0000 (19:26 +0000)]
MFV: r329021

Belatedly remove an empty directory.

6 years agoMove to tabs for indentation and to 8-space notches, per style(9).
imp [Thu, 8 Feb 2018 17:07:27 +0000 (17:07 +0000)]
Move to tabs for indentation and to 8-space notches, per style(9).

4 space indentation with a mix of tabs and spaces is a hassle. Update
to project-standard hard-tabs with 8-space indentation in these files.
This matches the new code coming in better as well.

6 years agosu_data: correct macro expansion.
pfg [Thu, 8 Feb 2018 14:53:34 +0000 (14:53 +0000)]
su_data: correct macro expansion.

Protect su_data() users from strange macro expansion.

Obtained from: linux libtirpc

6 years agoremove a duplicate assignment
avg [Thu, 8 Feb 2018 13:22:40 +0000 (13:22 +0000)]
remove a duplicate assignment

There should be no functional change.

MFC after: 1 week

6 years agoTemporarily widen count for interrupt rate calculations on 32-bit archs
jhibbits [Thu, 8 Feb 2018 05:18:30 +0000 (05:18 +0000)]
Temporarily widen count for interrupt rate calculations on 32-bit archs

If the interrupt count is very high (greater than ~42M), notably on one-shot
execution on long running systems, the intermediate multiplication step in the
rate calculation will overflow the width of a 32-bit architecture long (32
bits), causing the rest of the calculation to calculate with a truncated value,
and report very low rates (sometimes 0).

MFC after: 2 weeks

6 years agomountd(8): Produce vaguely meaningful error messages
cem [Thu, 8 Feb 2018 01:34:35 +0000 (01:34 +0000)]
mountd(8): Produce vaguely meaningful error messages

Sponsored by: Dell EMC Isilon

6 years agostyle(9): use a type for each member in struct defintions.
brooks [Thu, 8 Feb 2018 00:42:28 +0000 (00:42 +0000)]
style(9): use a type for each member in struct defintions.

Shorten a comment to fit in 80 columns.

6 years agoAdd myself to committers-src.dot
jeb [Thu, 8 Feb 2018 00:14:20 +0000 (00:14 +0000)]
Add myself to committers-src.dot

Reviewed by: erj (mentor)
Approved by: erj (mentor)

6 years agold.lld.1: explain long options may use one or two dashes
emaste [Thu, 8 Feb 2018 00:09:17 +0000 (00:09 +0000)]
ld.lld.1: explain long options may use one or two dashes

6 years agoUpdate ld.lld.1 based on the version committed upstream
emaste [Wed, 7 Feb 2018 23:58:00 +0000 (23:58 +0000)]
Update ld.lld.1 based on the version committed upstream

6 years agoRemove part of a comment reverting to nonexistant struct members.
brooks [Wed, 7 Feb 2018 23:45:13 +0000 (23:45 +0000)]
Remove part of a comment reverting to nonexistant struct members.

6 years agoMove simple interpreter 'perform' into interp.c and call it
imp [Wed, 7 Feb 2018 23:27:38 +0000 (23:27 +0000)]
Move simple interpreter 'perform' into interp.c and call it
interp_builtin_cmd().

6 years agoFix indentation to FreeBSD standard for interp files
imp [Wed, 7 Feb 2018 23:27:25 +0000 (23:27 +0000)]
Fix indentation to FreeBSD standard for interp files

6 years agoexec_map_first_page: fix an inverse condition introduced in r254138
avg [Wed, 7 Feb 2018 21:51:59 +0000 (21:51 +0000)]
exec_map_first_page: fix an inverse condition introduced in r254138

While the bug itself was serious, as we could either pass a non-busied
page to vm_pager_get_pages() or leak a busy page, it could only be
triggered under a very rare condition where the page is already inserted
into the object, but it is not valid yet.

Reviewed by: kib
MFC after: 2 weeks

6 years agoFix the WITH_SORT_THREADS build.
markj [Wed, 7 Feb 2018 20:36:37 +0000 (20:36 +0000)]
Fix the WITH_SORT_THREADS build.

PR: 201664
MFC after: 1 week

6 years agoiw_cxgbe: Remove declaration of a function that no longer exists.
np [Wed, 7 Feb 2018 20:13:08 +0000 (20:13 +0000)]
iw_cxgbe: Remove declaration of a function that no longer exists.

6 years agoMove the stand/usb test loader into its own directory.
hselasky [Wed, 7 Feb 2018 19:20:59 +0000 (19:20 +0000)]
Move the stand/usb test loader into its own directory.
Fix its Makefile to build correctly.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRemove duplicate #include <netinet/ip_var.h>.
ae [Wed, 7 Feb 2018 19:12:05 +0000 (19:12 +0000)]
Remove duplicate #include <netinet/ip_var.h>.

6 years agoRework ipfw dynamic states implementation to be lockless on fast path.
ae [Wed, 7 Feb 2018 18:59:54 +0000 (18:59 +0000)]
Rework ipfw dynamic states implementation to be lockless on fast path.

o added struct ipfw_dyn_info that keeps all needed for ipfw_chk and
  for dynamic states implementation information;
o added DYN_LOOKUP_NEEDED() macro that can be used to determine the
  need of new lookup of dynamic states;
o ipfw_dyn_rule now becomes obsolete. Currently it used to pass
  information from kernel to userland only.
o IPv4 and IPv6 states now described by different structures
  dyn_ipv4_state and dyn_ipv6_state;
o IPv6 scope zones support is added;
o ipfw(4) now depends from Concurrency Kit;
o states are linked with "entry" field using CK_SLIST. This allows
  lockless lookup and protected by mutex modifications.
o the "expired" SLIST field is used for states expiring.
o struct dyn_data is used to keep generic information for both IPv4
  and IPv6;
o struct dyn_parent is used to keep O_LIMIT_PARENT information;
o IPv4 and IPv6 states are stored in different hash tables;
o O_LIMIT_PARENT states now are kept separately from O_LIMIT and
  O_KEEP_STATE states;
o per-cpu dyn_hp pointers are used to implement hazard pointers and they
  prevent freeing states that are locklessly used by lookup threads;
o mutexes to protect modification of lists in hash tables now kept in
  separate arrays. 65535 limit to maximum number of hash buckets now
  removed.
o Separate lookup and install functions added for IPv4 and IPv6 states
  and for parent states.
o By default now is used Jenkinks hash function.

Obtained from: Yandex LLC
MFC after: 42 days
Sponsored by: Yandex LLC
Differential Revision: https://reviews.freebsd.org/D12685

6 years agoA more definitions to kernel emulation shim in order to build stand/usb.
hselasky [Wed, 7 Feb 2018 18:50:36 +0000 (18:50 +0000)]
A more definitions to kernel emulation shim in order to build stand/usb.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoFix relative location of USB sources after recent move.
hselasky [Wed, 7 Feb 2018 18:49:06 +0000 (18:49 +0000)]
Fix relative location of USB sources after recent move.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoGive USB template SYSUNINIT()'s a uniq name to avoid symbol name collision
hselasky [Wed, 7 Feb 2018 18:46:08 +0000 (18:46 +0000)]
Give USB template SYSUNINIT()'s a uniq name to avoid symbol name collision
when building stand/usb. Regression after r328194.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoCull Atmel board configs no longer relevant.
imp [Wed, 7 Feb 2018 18:33:53 +0000 (18:33 +0000)]
Cull Atmel board configs no longer relevant.

Remove most of the Atmel at91 boards. Most of them are no longer
relevant or used by people. Kept ATMEL since it should work on all the
boards that still work (I've not confirmed this, since I don't have
all these boards). Also kept SAM9G20EK, since I have several boards
that it is used on. If I've deleted a kernel in error, please let me
know.

6 years agoFix cut and pasted comments to reflect differences in code from the
imp [Wed, 7 Feb 2018 18:33:46 +0000 (18:33 +0000)]
Fix cut and pasted comments to reflect differences in code from the
original source.

Sponsored by: Netflix

6 years agoFix three miscalculations in amount of boot pages:
glebius [Wed, 7 Feb 2018 18:32:51 +0000 (18:32 +0000)]
Fix three miscalculations in amount of boot pages:

o Most of startup zones have struct uma_slab embedded into the slab,
  so provide macro UMA_SLAB_SPACE and use it instead of UMA_SLAB_SIZE,
  when calculating how many pages would certain kind of allocations
  require. Some zones are offpage, so we might have a positive inaccuracy.
o The keg for the zone of zones is allocated "dynamically", so we
  need +1 when calculating amount of pages for kegs. [1]
o The zones of zones and zones of kegs have arbitrary alignment of 32,
  and this also needs to be accounted for. [2]

While here, spread more comments and improve diagnostic messages.

Reported by: pho [1], jtl [2]

6 years agoFix broken SPDX comment in usr.bin/lex/initparse.c
arichardson [Wed, 7 Feb 2018 17:09:12 +0000 (17:09 +0000)]
Fix broken SPDX comment in usr.bin/lex/initparse.c

Approved By: jhb (mentor)

6 years agoFix compilation of mips_postboot_fixup() with a C11 compiler
arichardson [Wed, 7 Feb 2018 16:58:01 +0000 (16:58 +0000)]
Fix compilation of mips_postboot_fixup() with a C11 compiler

The _Alignas specifier must come before the declaration and not after. It
works if _Alignas() expands to __attribute__(aligned(x)) which was the only
case I tested before.

Approved By: jhb (mentor)

6 years agoDequeue wired pages lazily.
markj [Wed, 7 Feb 2018 16:57:10 +0000 (16:57 +0000)]
Dequeue wired pages lazily.

Previously, wiring a page would cause it to be removed from its page
queue. In the common case, unwiring causes it to be enqueued at the tail
of that page queue. This change modifies vm_page_wire() to not dequeue
the page, thus avoiding the highly contended page queue locks. Instead,
vm_page_unwire() takes care of requeuing the page as a single operation,
and the page daemon dequeues wired pages as they are encountered during
a queue scan to avoid needlessly revisiting them later. For pages in
PQ_ACTIVE we do even better, since a requeue is unnecessary.

The change improves scalability for some common workloads. For instance,
threads wiring pages into the buffer cache no longer need to modify
global page queues, and unwiring is usually done by the bufspace thread,
so concurrency is not as much of an issue. As another example, many
sysctl handlers wire the output buffer to avoid faults on copyout, and
since the buffer is likely to be in PQ_ACTIVE, we now entirely avoid
modifying the page queue in this case.

The change also adds a block comment describing some properties of
struct vm_page's reference counters, and the busy lock.

Reviewed by: jeff
Discussed with: alc, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D11943

6 years agoAdd a note about why we have the conditional before including
imp [Wed, 7 Feb 2018 16:28:26 +0000 (16:28 +0000)]
Add a note about why we have the conditional before including
bsd.compiler.mk. It's so fmake from older 9.x systems still
works (still a supported build config, and having the note here
will let us know when we can cull it more easily).

Also pull in a related change from include to sinclude from
arichardson@'s cross building work, as well as it's companion in
Makefile.inc1 with a note about why we do the odd thing there.

Submitted by: archardson
Differential Revision: https://reviews.freebsd.org/D14241

6 years agoadd retpoline compiler and linker feature flags
emaste [Wed, 7 Feb 2018 14:50:06 +0000 (14:50 +0000)]
add retpoline compiler and linker feature flags

These features indicate that the compiler and linker support the
retpoline speculative execution vulnerability (CVE-2017-5715)
mitigation.

Reviewed by: dim, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14228

6 years agoFix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to
hselasky [Wed, 7 Feb 2018 12:12:06 +0000 (12:12 +0000)]
Fix implementation of ktime_add_ns() and ktime_sub_ns() in the LinuxKPI to
actually return the computed result instead of the input value.

This is a regression issue after r289572.

Found by: gcc6
MFC after: 3 days
Sponsored by: Mellanox Technologies

6 years ago[ath] Use the BSSID address logic for STA VAPs too.
adrian [Wed, 7 Feb 2018 09:37:22 +0000 (09:37 +0000)]
[ath] Use the BSSID address logic for STA VAPs too.

For DWDS VAPs on ath(4) we need to ensure that the STA vap and hostap VAP
have different MAC addresses.  If the STA code path doesn't utilise the
address assign / reclaim path then it doesn't update the bitmap with which
address was allocated.

This should fix a bunch of corner issues I've been seeing with DWDS STA + AP
VAPs that I was working around with manual MAC address assignment.

6 years ago[ar71xx] Fix the TL-wdr3600/tl-wdr4300 hints in the new world order.
adrian [Wed, 7 Feb 2018 09:35:47 +0000 (09:35 +0000)]
[ar71xx] Fix the TL-wdr3600/tl-wdr4300 hints in the new world order.

Tested:

* tl-wdr4300

6 years agoif_awg: Skip emac reset if configured for internal PHY
kevans [Wed, 7 Feb 2018 01:54:13 +0000 (01:54 +0000)]
if_awg: Skip emac reset if configured for internal PHY

On the OrangePi One at least, emac reset when an ethernet cable is not
plugged in seems to break ethernet. Soft reset will fail, even with
increasing the delay and retries to wait for up to 20 seconds. This can be
reproduced across at least two different OrangePi One's by simply leaving
ethernet cable unplugged when awg attaches. Whether it's plugged in or not
through u-boot process makes no difference.

Skipping the reset in this configuration doesn't seem to cause any problems,
tried across many many reboots with and without ethernet cable plugged in.

Tested on: OrangePi One
Tested on: Other boards (manu)
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D13974

6 years agoKeep a counter for number of requests completed with an error.
imp [Tue, 6 Feb 2018 23:21:08 +0000 (23:21 +0000)]
Keep a counter for number of requests completed with an error.

Sponsored by: Netflix

6 years agofsync.2: Cross-reference fsync(1)
cem [Tue, 6 Feb 2018 23:12:47 +0000 (23:12 +0000)]
fsync.2: Cross-reference fsync(1)

Reported by: rpokala
Sponsored by: Dell EMC Isilon

6 years agoAvoid find -s, use find | sort instead.
imp [Tue, 6 Feb 2018 23:12:16 +0000 (23:12 +0000)]
Avoid find -s, use find | sort instead.

find -s was introduced to make the metalog more
deterministic. However, find -s is not portable. find | sort is
portable and accomplishes the same goals, even if it isn't
pedantically the same. TZS is the same before / after the change so
any fussy differences between the two are moot and there won't be
METALOG churn across this change.

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

6 years ago{ext2|ufs}_readdir: Avoid setting negative ncookies.
pfg [Tue, 6 Feb 2018 22:38:19 +0000 (22:38 +0000)]
{ext2|ufs}_readdir: Avoid setting negative ncookies.

ncookies cannot be negative or the allocator will fail. This should only
happen if a caller is very broken but we can still try to survive the
event.

We should probably also verify for uio_resid > MAXPHYS but in that case
it is not clear that just clipping the ncookies value is an adequate
response.

MFC after: 2 weeks

6 years agoUse const pointers for input data not modified by clock utility functions.
ian [Tue, 6 Feb 2018 22:17:01 +0000 (22:17 +0000)]
Use const pointers for input data not modified by clock utility functions.

6 years agoUse correct arithmetic to calculate how many pages we need for kegs
glebius [Tue, 6 Feb 2018 22:13:40 +0000 (22:13 +0000)]
Use correct arithmetic to calculate how many pages we need for kegs
and hashes.  There is no functional change with current sizes.

6 years agoUse per-domain locks for vm page queue free. Move paging control from
jeff [Tue, 6 Feb 2018 22:10:07 +0000 (22:10 +0000)]
Use per-domain locks for vm page queue free.  Move paging control from
global to per-domain state.  Protect reservations with the free lock
from the domain that they belong to.  Refactor to make vm domains more
of a first class object.

Reviewed by:    markj, kib, gallatin
Tested by:      pho
Sponsored by:   Netflix, Dell/EMC Isilon
Differential Revision:  https://reviews.freebsd.org/D14000

6 years agoImprove DIAGNOSTIC printf. Report using a boot page every time regardless
glebius [Tue, 6 Feb 2018 22:08:43 +0000 (22:08 +0000)]
Improve DIAGNOSTIC printf.  Report using a boot page every time regardless
of booted status.

6 years agoFix boot_pages calculation for machines that don't have UMA_MD_SMALL_ALLOC.
glebius [Tue, 6 Feb 2018 22:06:59 +0000 (22:06 +0000)]
Fix boot_pages calculation for machines that don't have UMA_MD_SMALL_ALLOC.

o Call uma_startup1() after initializing kmem, vmem and domains.
o Include 8 eight VM startup pages into uma_startup_count() calculation.
o Account for vmem_startup() and vm_map_startup() preallocating pages.
o Account for extra two allocations done by kmem_init() and vmem_create().
o Hardcode the place of execution of vm_radix_reserve_kva(). Using SYSINIT
  allowed several other SYSINITs to sneak in before it, thus bumping
  requirement for amount of boot pages.

6 years agoRefactor cleanvar to remove shell expansion vulnerability
feld [Tue, 6 Feb 2018 21:35:41 +0000 (21:35 +0000)]
Refactor cleanvar to remove shell expansion vulnerability

If any process creates a directory named "-P" in /var/run or
/var/spool/lock it will cause the purgedir function to start to rm -r /.

Simplify a lot of complicated shell logic by leveraging find(1).

Reviewed by: allanjude
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D13778