]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoAdd new USB quirk.
Hans Petter Selasky [Tue, 13 Feb 2018 08:13:20 +0000 (08:13 +0000)]
Add new USB quirk.

PR: 225844
MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoAdd missing semicolon to not break devd during system startup.
Hans Petter Selasky [Tue, 13 Feb 2018 08:10:17 +0000 (08:10 +0000)]
Add missing semicolon to not break devd during system startup.

6 years ago- I'm not using nis(8) and ypldap(8) anymore, so I'm removing myself
Marcelo Araujo [Tue, 13 Feb 2018 06:36:27 +0000 (06:36 +0000)]
- I'm not using nis(8) and ypldap(8) anymore, so I'm removing myself
  from MAINTAINERS list.

6 years agoUnify metadata load files for arm, mips, powerpc, sparc64
Justin Hibbits [Tue, 13 Feb 2018 03:44:50 +0000 (03:44 +0000)]
Unify metadata load files for arm, mips, powerpc, sparc64

Summary:
All metadata.c files are very similar, with only trivial changes.  Unify them
into a single common file, with minor special-casing where needed.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D13978

6 years agoUse tabs in io.d, fix alignment issues, remove extraneous newlines
Devin Teske [Mon, 12 Feb 2018 23:53:38 +0000 (23:53 +0000)]
Use tabs in io.d, fix alignment issues, remove extraneous newlines

6 years agoMake v_wire_count a per-cpu counter(9) counter. This eliminates a
Jeff Roberson [Mon, 12 Feb 2018 22:53:00 +0000 (22:53 +0000)]
Make v_wire_count a per-cpu counter(9) counter.  This eliminates a
significant source of cache line contention from vm_page_alloc().  Use
accessors and vm_page_unwire_noq() so that the mechanism can be easily
changed in the future.

Reviewed by: markj
Discussed with: kib, glebius
Tested by: pho (earlier version)
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14273

6 years agodevmatch.8: Link to MODULE_PNP_INFO(9)
Conrad Meyer [Mon, 12 Feb 2018 22:43:47 +0000 (22:43 +0000)]
devmatch.8: Link to MODULE_PNP_INFO(9)

Sponsored by: Dell EMC Isilon

6 years agoTake a first stab at documenting use of MODULE_PNP_INFO
Conrad Meyer [Mon, 12 Feb 2018 22:42:06 +0000 (22:42 +0000)]
Take a first stab at documenting use of MODULE_PNP_INFO

Sponsored by: Dell EMC Isilon

6 years agobwn(4): Fix outstanding bug in PHY-G tssi2dbm table generation caught by
Landon J. Fuller [Mon, 12 Feb 2018 22:21:11 +0000 (22:21 +0000)]
bwn(4): Fix outstanding bug in PHY-G tssi2dbm table generation caught by
-Wconstant-conversion, and remove now unnecessary warning suppression
flags.

6 years agoUpdate the MTU in affected routes when IPv6 RA changes the MTU
Eric van Gyzen [Mon, 12 Feb 2018 19:49:20 +0000 (19:49 +0000)]
Update the MTU in affected routes when IPv6 RA changes the MTU

ip6_calcmtu() only looks at the interface MTU if neither the TCP hostcache
nor the route provides an MTU.  Update the routes so they do not provide
stale MTUs.

This fixes UNH IPv6 conformance test cases v6LC_4_1_08 and v6LC_4_1_09,
which use a RA to reduce the link MTU from 1500 to 1280.

Reported and tested by: Farrell Woods <Farrell_Woods@Dell.com>
Reviewed by: dab, melifaro
Discussed with: ae
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14257

6 years agosiba(4): Ignore disabled per-core address match entries.
Landon J. Fuller [Mon, 12 Feb 2018 19:36:26 +0000 (19:36 +0000)]
siba(4): Ignore disabled per-core address match entries.

Previously, the address regions described by disabled admatch entries would
be treated as being mapped to the given core; while incorrect, this was
essentially harmless given that the entries describe unused address space
on the few affected devices.

We now perform parsing of per-core admatch registers and interrupt flags in
siba_erom, correctly skip any disabled admatch entries, and use the
siba_erom API in siba_add_children() to perform enumeration of attached
cores.

6 years agoFix a comment. No functional change.
Alan Somers [Mon, 12 Feb 2018 17:42:28 +0000 (17:42 +0000)]
Fix a comment.  No functional change.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAdd a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot
Ian Lepore [Mon, 12 Feb 2018 17:41:11 +0000 (17:41 +0000)]
Add a new sysctl, debug.clock_do_io, to allow manully triggering a one-shot
read or write of all registered realtime clocks.  In the read case, the
values read are simply discarded.  For writes, there's no alternative but
to actually write the current system time to the device.

6 years agoAdd a set of convenience routines for RTC drivers to use for debug output,
Ian Lepore [Mon, 12 Feb 2018 17:33:14 +0000 (17:33 +0000)]
Add a set of convenience routines for RTC drivers to use for debug output,
and a debug.clock_show_io sysctl to control debugging output.

6 years agoMark the pages used for the initial page-table entries as wired. This
Jonathan T. Looney [Mon, 12 Feb 2018 17:27:50 +0000 (17:27 +0000)]
Mark the pages used for the initial page-table entries as wired. This
makes them consistent with the way other page-table pages are allocated.
It also provides the rest of the VM system a good clue that these pages
are used.

Reviewed by: alc, kib, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14269

6 years agoReplace the existing print_ct() private debugging function with a set of
Ian Lepore [Mon, 12 Feb 2018 16:25:56 +0000 (16:25 +0000)]
Replace the existing print_ct() private debugging function with a set of
three public functions to format and print the three major data structures
used by realtime clock drivers (clocktime, bcd_clocktime, and timespec).

6 years agoAdd lua to build script
Warner Losh [Mon, 12 Feb 2018 15:32:05 +0000 (15:32 +0000)]
Add lua to build script

6 years agoAdd the lua scripts from the lua-bootloader SoC
Warner Losh [Mon, 12 Feb 2018 15:32:00 +0000 (15:32 +0000)]
Add the lua scripts from the lua-bootloader SoC

These are the .lua files from from Pedro Souza's 2014 Summer of Code
project. Rui Paulo, Pedro Arthur and Wojciech A. Koszek also
contributed.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code

Improve the SoC lua menu code to bring it in line with forth
menu functionality

Submitted by: Zakary Nafziger
Sponsored by: FreeBSD Foundation

Use loader.setenv and loader.unsetenv instead of loader.perform

Convert from include("/boot/foo.lua") to foo = require("foo");
to bring in line with latest lua module conventions.

Enforce a uniform style for the new .lua files:
o hard tab indenation for 8 spaces
o don't have if foo then bar; else bas; end on one line

MFC After: 1 month
Relnotes: yes
Differential Review: https://reviews.freebsd.org/D14295

6 years agoAdd Lua as a scripting langauge to /boot/loader
Warner Losh [Mon, 12 Feb 2018 15:31:53 +0000 (15:31 +0000)]
Add Lua as a scripting langauge to /boot/loader

liblua glues the lua run time into the boot loader. It implements all
the runtime routines that lua expects. In addition, it has a few
standard 'C' headers that nueter various aspects of the LUA build that
are too specific to lua to be in libsa. Many refinements from the
original code to improve implementation and the number of included lua
libraries. Use int64_t for lua_Number. Have "/boot/lua" be the default
module path. Numerous cleanups from the original GSoC project,
including hacking libsa to allow lua to be built with only one change
outside luaconf.h.

Add the final bit of lua glue to bring in liblua and plug into the
multiple interpreter framework, previously committed.

Add LOADER_LUA option, currently off by default.

Presently, this is an experimental option. One must opt-in to using
this by defining WITH_LOADER_LUA and WITHOUT_FORTH. It's been
lightly tested, so keep a backup copy of your old loader handy.
The menu code, coming in the next commit, hasn't been exhaustively
tested. A LUA boot loader is 60k larger than a FORTH one, which is
80k larger than a no-interpreter one. Subtle changes in size
may tip things past some subtle limit (the binary is ~430k now
when built with LUA). A future version may offer coexistance.

Bump FreeBSD version to 1200058 to mark the milestone.

Pedro Souza's 2014 Summer of Code project. Rui Paulo, Pedro Arthur,
Zakary Nafziger and Wojciech A. Koszek also contributed. Warner Losh
reworked it extensively into its current form.

Obtained from: https://wiki.freebsd.org/SummerOfCode2014/LuaLoader
Sponsored by: Google Summer of Code
Relnotes: Yes
MFC After: 1 month
Differential Review: https://reviews.freebsd.org/D14295

6 years agoMove __va_list and related defines to sys/sys/_types.h
Warner Losh [Mon, 12 Feb 2018 14:48:20 +0000 (14:48 +0000)]
Move __va_list and related defines to sys/sys/_types.h

__va_list and related defines are identical in all the
ARCH/include/_types.h files. Move them to sys/sys/_types.h

Sponsored by: Netflix

6 years agoWe don't support gcc < 4.2.1, so varargs.h now is just #error
Warner Losh [Mon, 12 Feb 2018 14:48:14 +0000 (14:48 +0000)]
We don't support gcc < 4.2.1, so varargs.h now is just #error
always. Unifdef for versions prior to 4.2.1 and remove now-unused
header files.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14323

6 years agoUse standard pattern for stdargs.h
Warner Losh [Mon, 12 Feb 2018 14:48:05 +0000 (14:48 +0000)]
Use standard pattern for stdargs.h

We don't support older compilers. Most of the code in these files is
for pre-3.0 gcc, which is at least 15 years obsolete. Move to using
phk's sys/_stdargs.h for all these platforms.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D14323

6 years agoProvide further mitigation against CVE-2017-5715 by flushing the
Tycho Nightingale [Mon, 12 Feb 2018 14:45:27 +0000 (14:45 +0000)]
Provide further mitigation against CVE-2017-5715 by flushing the
return stack buffer (RSB) upon returning from the guest.

This was inspired by this linux commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/x86/kvm?id=117cc7a908c83697b0b737d15ae1eb5943afe35b

Reviewed by: grehan
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14272

6 years agoMove devmatch to sbin from usr/sbin.
Warner Losh [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
Warner Losh [Mon, 12 Feb 2018 06:52:49 +0000 (06:52 +0000)]
Fix typo

6 years agoTurn devmatch on by default.
Warner Losh [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.
Warner Losh [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
Warner Losh [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.
Warner Losh [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
Warner Losh [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
Warner Losh [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)
Conrad Meyer [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
Scott Long [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 Davis [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
Warner Losh [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 Lepore [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 Lepore [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
Mark Felder [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,
Edward Tomasz Napierala [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
Conrad Meyer [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)
Devin Teske [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)
Conrad Meyer [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
Alan Somers [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
Conrad Meyer [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
Justin Hibbits [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
Eugene Grosbein [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
Emmanuel Vadot [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.
Pedro F. Giffuni [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
Andrey V. Elsukov [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 Davis [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.
Alexander Motin [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
Ed Maste [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
Ed Maste [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 Davis [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.
Alexander Motin [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.
Kirk 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
Jung-uk Kim [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
Nathan Whitehorn [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
Conrad Meyer [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
Kirk 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
Conrad Meyer [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
Kirk 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.
Warner Losh [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.
Jung-uk Kim [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
Jonathan T. Looney [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
Alan Somers [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
Warner Losh [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
Kyle Evans [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
Roger Pau Monné [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
Gleb Smirnoff [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
Warner Losh [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
Eric van Gyzen [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.
Kirk 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
Kirk 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
Warner Losh [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):
Dimitry Andric [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 Davis [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.
Jung-uk Kim [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.
Mark Johnston [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
Jung-uk Kim [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).
Warner Losh [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.
Pedro F. Giffuni [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
Andriy Gapon [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
Justin Hibbits [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
Conrad Meyer [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 Davis [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 Cramer [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
Ed Maste [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
Ed Maste [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 Davis [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
Warner Losh [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
Warner Losh [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
Andriy Gapon [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.
Mark Johnston [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.
Navdeep Parhar [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.
Hans Petter Selasky [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>.
Andrey V. Elsukov [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.
Andrey V. Elsukov [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.
Hans Petter Selasky [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.
Hans Petter Selasky [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