DragonFlyBSD/src 0984e94include assert.h

<assert.h>: Sync comments a bit with FreeBSD.
DeltaFile
+12-1include/assert.h
+12-11 files

DragonFlyBSD/src 8ef931ainclude assert.h

<assert.h>: add missing __dead2 to __assert().

__assert() is called when an assertion fails. After printing an error
message, it will call abort(). abort() never returns, hence it has the
__dead2 attribute. Also add this attribute to __assert().

Taken-from: FreeBSD (r217207)
Submitted-by: Jan Beich
DeltaFile
+1-1include/assert.h
+1-11 files

DragonFlyBSD/src 097ba28lib/libpam/modules/pam_ftpusers pam_ftpusers.8

pam_ftpusers.8: Remove reference to ftpusers.5.

DragonFlyBSD/src a5db5bfsbin/reboot boot_pc64.8, sys/boot/common loader.8

sys/boot: Clean up btxld's manual page.

It is a host tool only and not installed to base.

DragonFlyBSD/src 7961249share/man/man4 ifmib.4 miibus.4, share/man/man5 rc.conf.5

i386 removal, part 72/x: Remove i386 specific ed.4 manpage references.

This was missing from 09ab7e4ea7d3a5476ab60148ed6fa1b8a0e61b0c.

DragonFlyBSD/src 4a69e56share/misc bsd-family-tree

bsd-family-tree: Sync with FreeBSD (add OpenBSD 6.5).

DragonFlyBSD/src 96c5ef2sys/dev/drm drm_ioctl.c

drm: Do not report PRIME as supported

This fixes kernel panics with the Ravenports graphics stack

DragonFlyBSD/src 161b332sys/kern vfs_syscalls.c

kernel - Remove improper direct user-space access

* chroot_kernel() (a privileged system call) was improperly
  callin kprintf() with a direct user address.  Just remove
  the kprintf().

Reported-by: tdfbsd

DragonFlyBSD/src 2a7bd4dsys/kern sys_vmm.c, sys/platform/pc64/x86_64 machdep.c db_trace.c

kernel: Don't include <sys/user.h> in kernel code.

There is really no point in doing that because its main purpose is to
expose kernel structures to userland. The majority of cases wasn't
needed at all and the rest required only a couple of other includes.

DragonFlyBSD/src 8bfc56acontrib/mdocml README.DELETED, usr.bin/mandoc config.h Makefile

mandoc(1): Use base recallocarray().

DragonFlyBSD/src aaea11ccontrib/mdocml compat_recallocarray.c

Merge branch 'vendor/MDOCML'

DragonFlyBSD/src 7c2b5adcontrib/mdocml compat_recallocarray.c

Remove the compat recallocarray() on the vendor branch.

DragonFlyBSD/src 68ea669bin/sh Makefile, share/man Makefile

Fix building release on master.

* <histedit.h> was moved to /usr/include/priv on master, so add that
  to the include search path when building sh(1) as a bootstrap tool.

* Fix the apropos(1) database generation (used for 'make distribution').
  If the system doesn't have the makewhatis(8) for a compatible
  database, just build no database.

DragonFlyBSD/src 3269e75share/man Makefile

makedb: Fix apropos database generation better across release/master.

The apropos database format used by our new man(1) is different and
incompatible to that used by our old man(1). The files are also named
differently, mandoc.db (new) and whatis (old).

So it makes no sense to use the old makewhatis on new systems or the
new makewhatis on old systems. If the desired makewhatis does not
exist, then we just don't generate the db, because the building system
doesn't have the makewhatis needed to generate it.

Once installed, the database will be updated regularly as per weekly
periodic.
DeltaFile
+4-6share/man/Makefile
+4-61 files

DragonFlyBSD/src 3cc72d3sys/platform/pc64/x86_64 exception.S

Revert "kernel - Clean up direction flag on syscall entry"

Actually not needed, the D flag is cleared via the mask
set in MSR_SF_MASK.  Revert.

This reverts commit cea0e49dc0b2e5aea1b929d02f12d00df66528e2.

DragonFlyBSD/src cd9c487sys/cpu/x86_64/include asmacros.h, sys/platform/pc64/x86_64 machdep.c

kernel - Implement support for SMAP and SMEP security (3)

* Issue clac after the push on all traps, interrupts, and
  exceptions.

* Improve code documentation.

DragonFlyBSD/src cea0e49sys/platform/pc64/x86_64 exception.S

kernel - Clean up direction flag on syscall entry

* Make sure the direction flag is clear on syscall entry.  Don't
  trust userland.

DragonFlyBSD/src 2f6148asys/platform/pc64/x86_64 pmap.c

kernel - Implement support for SMAP and SMEP security (2)

* Oops.  Do the CR4 initialization in the correct place, so it is
  applied to all CPUs.

DragonFlyBSD/src 48c77f2sys/cpu/x86_64/include asmacros.h specialreg.h, sys/platform/pc64/x86_64 support.s machdep.c

kernel - Implement support for SMAP and SMEP security

* Implement support for SMAP security.  This prevents accidental
  accesses to user address space from the kernel.  When available,
  we wrap intentional user-space accesses from the kernel with
  the 'stac' and 'clac' instructions.

  We use a NOP replacement policy to implement the feature.  The wrapper
  is initially a 'nop %eax' (3-byte NOP), and is replaced by 'stac' and
  'clac' via a .section iteration when the feature is supported.

* Implement support for SMEP security.  This prevents accidental
  execution of user code from the kernel and simply requires
  turning the bit on in CR4.

* Reports support in dmesg via the 'CPU Special Features Installed:'
  line.

DragonFlyBSD/src d4e0b0csys/platform/pc64/conf kern.mk, sys/platform/vkernel64/conf kern.mk

kernel - Implement retpoline for kernel

* Now that we have gcc-8 operational, we can turn on retpoline (software
  spectre protection against the return stack buffer).  Turn it on via
  -mindirect-branch=thunk-inline

* No discernable performance loss with a generic buildkernel test:

                             Xeon e5-2620v4 x 2
                        time make -j 32 nativekernel (all tmpfs)
BEFORE 1717.427u 323.662s 2:28.49 1374.5%      9582+721k 200842+0io 4870pf+0w
BEFORE 1720.130u 338.635s 2:30.21 1370.5%      9555+720k 199720+0io 4804pf+0w
BEFORE 1722.395u 341.508s 2:30.71 1369.4%      9559+720k 199720+0io 4804pf+0w

AFTER  1720.271u 329.492s 2:28.27 1382.4%      9578+721k 200842+0io 4870pf+0w
AFTER  1736.268u 344.874s 2:30.90 1379.1%      9555+720k 199720+0io 4804pf+0w
AFTER  1726.056u 348.324s 2:31.14 1372.4%      9543+719k 199720+0io 4804pf+0w

DragonFlyBSD/src 1cf78b6lib/libtelnet genget.c, sys/dev/drm linux_vmalloc.c

Don't include "internal" headers outside of regular headers.

Include files like <sys/_timespec.h> and so on contain small parts
such as struct timespec that are supposed to be provided by multiple
regular headers. They should only be included by other headers, not
by *.c files.

None of these was actually needed except for the libtelnet one
(replaced with <stddef.h>).

DragonFlyBSD/src 154145ashare/misc pci_vendors

Update the pciconf(8) database.

May 14, 2019 snapshot from https://pci-ids.ucw.cz
DeltaFile
+57-14share/misc/pci_vendors
+57-141 files

DragonFlyBSD/src 67e7cb8sys/platform/pc64/x86_64 pmap.c, sys/vm vm_map.c vm_fault.c

kernel - VM rework part 8 - Precursor work for terminal pv_entry removal

* Adjust structures so the pmap code can iterate backing_ba's with
  just the vm_object spinlock.

  Add a ba.pmap back-pointer.

  Move entry->start and entry->end into the ba (ba.start, ba.end).
  This is replicative of the base entry->ba.start and entry->ba.end,
  but local modifications are locked by individual objects to allow
  pmap ops to just look at backing ba's iterated via the object.

  Remove the entry->map back-pointer.

  Remove the ba.entry_base back-pointer.

* ba.offset is now an absolute offset and not additive.  Adjust all code
  that calculates and uses ba.offset (fortunately it is all concentrated
  in vm_map.c and vm_fault.c).

* Refactor ba.start/offset/end modificatons to be atomic with
  the necessary spin-locks to allow the pmap code to safely iterate
  the vm_map_backing list for a vm_object.

* Test VM system with full synth run.

DragonFlyBSD/src cd89a7csys/cpu/x86_64/include asmacros.h specialreg.h, sys/dev/misc/cpuctl cpuctl.c

kernel - Add MDS mitigation support for Intel side-channel attack

* Add MDS (Microarchitectural Data Sampling) attack mitigation to
  the kernel.  This is an attack against Intel CPUs made from 2011
  to date.  The attack is not currently known to work against AMD CPUs.

  With an intel microcode update the mitigation can be enabled with

  sysctl machdep.mds_mitigation=MD_CLEAR

* Without the intel microcode update, only disabling hyper-threading
  gives you any protection.  Older architectures might not get
  support.  If sysctl machdep.mds_support does not show support,
  then the currently loaded microcode does not have support for the
  feature.

* DragonFlyBSD only supports the MD_CLEAR mode, and it will only
  be available with a microcode update from Intel.

  Updating the microcode alone does not protect against the attack.
  The microcode must be updated AND the mode must be turned on in
  DragonFlyBSD to protect against the attack.

  This mitigation burns around 250nS of additional latency on kernel->user
  transitions (system calls and interrupts primarily).  The additional

    [10 lines not shown]

DragonFlyBSD/src d29a243sys/dev/misc/evdev input.h input-event-codes.h

kernel/evdev: Synchronize event codes with Linux 4.16

Taken-from: FreeBSD, Linux

DragonFlyBSD/src b089704lib/libc/gen dlfcn.c

rtld-elf - Notify thread state to optimize relocations (2)

* Remove write() prototype in dlfcn.c that was only used for
  debugging.

Reminded-by: swildner

DragonFlyBSD/src 0d06b0alib/libc/gen sysconf.3, lib/libc/sys pathconf.2

pathconf.2/sysconf.3: Add some related references to SEE ALSO.

DragonFlyBSD/src 7f62b37lib/libc/gen _pthread_stubs.c

libc: Implement properly pthread_equal() stub.

Functional stub is needed to avoid forcing thread library on librecrypto.

DragonFlyBSD/src 5b329e6sys/vm vm_map.c vm_swapcache.c

kernel - VM rework part 7 - Initial vm_map_backing index

* Implement a TAILQ and hang vm_map_backing structures off
  of the related object.  This feature is still in progress
  and will eventually be used to allow pmaps to manipulate
  vm_page's without pv_entry's.

  At the same time, remove all sharing of vm_map_backing.
  For example, clips no longer share the vm_map_backing.  We
  can't share the structures if they are being used to
  itemize areas for pmap management.

  TODO - reoptimize this at some point.

  TODO - not yet quite deterministic enough for pmap
         searches (due to clips).

* Refactor vm_object_reference_quick() to again allow
  operation on any vm_object whos ref_count is already
  at least 1, or which belongs to a vnode.  The ref_count
  is no longer being used for complex vm_object collapse,
  shadowing, or migration code.

  This allows us to avoid a number of unnecessary token
  grabs on objects during clips, shadowing, and forks.

    [7 lines not shown]

DragonFlyBSD/src 175f5a8sys/vm vm_map.c

kernel - VM rework part 6 - Stabilize

* Fix a case and situations where VPAGETABLE won't work.
DeltaFile
+10-2sys/vm/vm_map.c
+10-21 files

DragonFlyBSD/src 50caca1lib/libc/gen dlfcn.c Symbol.map, lib/libthread_xu/thread thr_private.h thr_kern.c

rtld-elf - Notify thread state to optimize relocations

* Add shims to allow libthread_xu to notify rtld when threading
  is being used.

* Requires weak symbols in libc which are overriden by rtld-elf.

* Implement the feature in rtld-elf and use it to avoid making calls
  to lwp_gettid().  When threaded, use tls_get_tcb() (which does not
  require a system call) instead of lwp_gettid().  When not threaded,
  just use a constant.

  NOTE: We cannot use tls_get_tcb() unconditionally because the tcb
        is not setup during early relocations.  So do this whack-a-mole
        to make it work.

* This leaves just the sigprocmask wrappers around rtld-elf (which
  are needed to prevent stacked relocations from signal handlers).

Poked-by: mjg

DragonFlyBSD/src 8492a2fsys/kern sysv_shm.c kern_kinfo.c, sys/vfs/nfs nfs_node.c

kernel - VM rework part 5 - Cleanup

* Cleanup vm_map_entry_shadow()

* Remove (unused) vmspace_president_count()
  Remove (barely used) struct lwkt_token typedef.

* Cleanup the vm_map_aux, vm_map_entry, vm_map, and vm_object
  structures

* Adjfustments to in-code documentation

DragonFlyBSD/src 2ee9073sys/bus/cam/scsi scsi_da.c

kernel - Restore kern.cam.da.X.trim_enabled sysctl

* This sysctl was not always being properly installed due to an
  ordering and timing issue.

* The code was not setting the trim flag in the correct structure.

DragonFlyBSD/src 747e296lib/i18n_module Makefile.inc, lib/libnetgraph7 Makefile

Clean up some Makefiles.

* WARNS?=6 is usually not needed because upper-level Makefile.inc's
  already have it (such as usr.bin/Makefile.inc).

* Remove an unneded SRCS in ndis_events(8).

DragonFlyBSD/src ae70e58lib/libutil Makefile

libutil: Raise WARNS to 6.

DragonFlyBSD/src 6e316fcusr.bin/kcollect gnuplot.c

kcollect - Adjust Mops right hand on graph

* Adjust the Mops cap based on ncpus.

DragonFlyBSD/src f2187f0sys/bus/cam/scsi scsi_da.c

kernel - Restore kern.cam.da.X.trim_enabled sysctl

* This sysctl was not always being properly installed due to an
  ordering and timing issue.

* The code was not setting the trim flag in the correct structure.

DragonFlyBSD/src 1dcf1bcsys/vm vm_object.c

kernel - VM rework (fix introduced bug)

* Fix a null-pointer dereferencing bug in vm_object_madvise() introduced
  in recent commits.
DeltaFile
+1-4sys/vm/vm_object.c
+1-41 files

DragonFlyBSD/src 1c024bcsys/vm vm_fault.c vm_map.c

kernel - VM rework part 4 - Implement vm_fault_collapse()

* Add the function vm_fault_collapse().  This function simulates
  faults to copy all pages from backing objects into the front
  object, allowing the backing objects to be disconnected
  from the map entry.

  This function is called under certain conditions from the
  vmspace_fork*() code prior to a fork to potentially collapse
  the entry's backing objects into the front object.  The
  caller then disconnects the backing objects, truncating the
  list to a single object (the front object).

  This optimization is necessary to prevent the backing_ba list
  from growing in an unbounded fashion.  In addition, being able
  to disconnect the graph allows redundant backing store to
  be freed more quickly, reducing memory use.

* Add sysctl vm.map_backing_shadow_test (default enabled).
  The vmspace_fork*() code now does a quick all-shadowed test on
  the first backing object and calls vm_fault_collapse()
  if it comes back true, regardless of the chain length.

* Add sysctl vm.map_backing_limit (default 5).
  The vmspace_fork*() code calls vm_fault_collapse() when the

    [4 lines not shown]

DragonFlyBSD/src 44293a8sys/kern sys_process.c, sys/vm vm_map.c vm_extern.h

kernel - VM rework part 3 - Cleanup pass

* Cleanup various structures and code

DragonFlyBSD/src 9de48easys/vfs/procfs procfs_map.c, sys/vm vm_object.c vm_map.c

kernel - VM rework part 2 - Replace backing_object with backing_ba

* Remove the vm_object based backing_object chains and all related
  chaining code.

  This removes an enormous number of locks from the VM system and
  also removes object-to-object dependencies which requires careful
  traversal code.  A great deal of complex code has been removed
  and replaced with far simpler code.

  Ultimately the intention will be to support removal of pv_entry
  tracking from vm_pages to gain lockless shared faults, but that
  is far in the future.  It will require hanging vm_map_backing
  structures off of a list based in the object.

* Implement the vm_map_backing structure which is embedded in the
  vm_map_entry and then links to additional dynamically allocated
  vm_map_backing structures via entry->ba.backing_ba.  This structure
  contains the object and offset and essentially takes over the
  functionality that object->backing_object used to have.

  backing objects are now handled via vm_map_backing.  In this
  commit, fork operations create a fan-in tree to shared subsets
  of backings via vm_map_backing.  In this particular commit,
  these subsets are not collapsed in any way.

    [18 lines not shown]

DragonFlyBSD/src 6f76a56sys/vfs/procfs procfs_map.c, sys/vm vm_object.c vm_fault.c

kernel - VM rework part 1 - Remove shadow_list

* Remove shadow_head, shadow_list, shadow_count.

* This leaves the kernel operational but without collapse optimizations
  on 'other' processes when a prorgam exits.

DragonFlyBSD/src 835079asys/contrib/dev/acpica changes.txt, sys/contrib/dev/acpica/source/compiler aslwalks.c aslxref.c

Sync ACPICA with Intel's version 20190509.

* Revert some changes that were causing issues in the kernel subsystem
  and in iasl(8).

* Additional improvements in iasl(8).

For detailed list, please see sys/contrib/dev/acpica/changes.txt.

DragonFlyBSD/src aac423asys/vm vm_fault.c

kernel - __read_mostly pass on vm_fault

* Qualify a number of variables with __read_mostly
DeltaFile
+7-7sys/vm/vm_fault.c
+7-71 files

DragonFlyBSD/src 1bfa608sys/kern vfs_subr.c

kernel - __read_mostly pass on vfs_subr

* Qualify a number of variables with __read_mostly

DragonFlyBSD/src 44376fcsys/kern vfs_cache.c

kernel - __read_mostly pass on vfs_cache

* Qualify a number of variables with __read_mostly

* Move the numdefered global to the pcpu structure and adjust the
  heuristic for it.
DeltaFile
+31-23sys/kern/vfs_cache.c
+31-231 files

DragonFlyBSD/src 4b2467bsys/kern lwkt_thread.c

kernel - __read_mostly pass on lwkt_thread

* Qualify a number of globals as __read_mostly

* Conditionalize-out (effectively remove) a number of other
  globals that were being used for debugging.

DragonFlyBSD/src 288f331sys/kern kern_spinlock.c kern_lock.c

kernel - Quick pass add __read_frequently

* Do a quick pass to add __read_frequently to certain specific
  globals.

DragonFlyBSD/src 23951dasys/dev/drm/include/linux compiler.h, sys/platform/pc64/conf ldscript.x86_64

kernel - Bring in __read_mostly etc

* Bring __read_mostly, __read_frequently, and __exclusive_cache_line
  in from FreeBSD.

* Remove linux compat __read_mostly now that we have a real one.

Taken-From: FreeBSD/mjg_

DragonFlyBSD/src f1a1816. Makefile_upgrade.inc, include err.h

Remove any remaining traces of varargs.h.

This is a follow-up of b3a17fb68c15a4c57da6867f1b2119587b7a68a8.