9 months agoSync zoneinfo database with tzdata2018d from ftp://ftp.iana.org/tz/releases DragonFly_RELEASE_5_0
Sascha Wildner [Sun, 1 Apr 2018 12:24:15 +0000 (14:24 +0200)]
Sync zoneinfo database with tzdata2018d from ftp://ftp.iana.org/tz/releases

* Palestine started DST a week earlier, on March 24.

* Various changes to past time stamps and zone abbreviations.

For a detailed list of changes, see share/zoneinfo/NEWS.

9 months agokernel/devfs: Use 1UL << ... in bitmap bit operations.
Sascha Wildner [Fri, 23 Mar 2018 09:30:18 +0000 (10:30 +0100)]
kernel/devfs: Use 1UL << ... in bitmap bit operations.

9 months agokernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys (2)
Matthew Dillon [Thu, 22 Mar 2018 16:09:50 +0000 (09:09 -0700)]
kernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys (2)

* Also fix incorrect shift type in devfs_clone_bitmap_set().

Submitted-by: Aaron LI
10 months agokernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys
Matthew Dillon [Thu, 22 Mar 2018 01:11:10 +0000 (18:11 -0700)]
kernel - Fix tapN creation >= 32 units, fix pty issues >= 32 ptys

* Fix ifconfig tapN create for N >= 32.

* devfs_clone_bitmap_chk(), which only if_tap uses, was returning
  the wrong default value for unit numbers beyond the current
  dynamic size of the bitmap.

* Both devfs_clone_bitmap_chk() and devfs_clone_bitmap_put()
  were improperly using (1 << unit) instead of (1L << unit)
  when masking the 64-bit (long) bitmap elements, resulting in
  chaos for units >= 32.

* This also should fix pty issues >= 32 ptys.

Reported-by: Aaron Li
10 months agodm - synchronize disk info before returning
Matthew Dillon [Sun, 18 Mar 2018 19:26:17 +0000 (12:26 -0700)]
dm - synchronize disk info before returning

* DM now issues a disk_config(NULL) after setting up the disk info
  in order to wait for the probe to complete, otherwise callers
  may race trying to open() the disk device before it is actually

* Fixes cryptsetup luksOpen errors which occur due to probe races,
  typically when used in a VM or qemu.

Reported-by: Aaron LI
10 months agohammer - Partial MFC critical pfs/snapshot fix
Matthew Dillon [Sat, 17 Mar 2018 15:44:16 +0000 (08:44 -0700)]
hammer - Partial MFC critical pfs/snapshot fix

* Do not clear HAMMER2_BREF_FLAG_PFSROOT in the chain when the caller
  fails to specify HAMMER2_INSERT_PFSROOT to hammer2_chain_create().

  Ensures that the flag remains set when e.g. PFS root inodes get
  moved around due to indirect blocks.

11 months agokernel - Increase syscons history buffer size
Matthew Dillon [Sat, 2 Dec 2017 02:56:06 +0000 (18:56 -0800)]
kernel - Increase syscons history buffer size

* Increase syscons history from 4 screens to 10 screens
  (4*rows to 10*rows).

11 months agokernel - Fix syscons's visual bell
Matthew Dillon [Sat, 17 Feb 2018 19:29:49 +0000 (11:29 -0800)]
kernel - Fix syscons's visual bell

* The visual bell code was completely broken.

* Refactor the callout, and use the new callout_init_lk facility
  to deal with races.

Reported-by: snurg
11 months agoSync zoneinfo database with tzdata2018c from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Mon, 29 Jan 2018 19:13:14 +0000 (20:13 +0100)]
Sync zoneinfo database with tzdata2018c from ftp://ftp.iana.org/tz/releases

* Revert Irish changes that relied on negative DST offsets.

* Japanese DST transitions (1948-1951) were Sundays at 00:00, not
    Saturdays or Sundays at 02:00.

For a detailed list of changes, see share/zoneinfo/NEWS.

11 months agoflowers: correct spelling of lily, Camellia
Eitan Adler [Sun, 10 Dec 2017 05:09:54 +0000 (21:09 -0800)]
flowers: correct spelling of lily, Camellia

11 months agogettytab: Add 3wire and std as terminal types/classes.
Eitan Adler [Tue, 19 Dec 2017 06:03:02 +0000 (22:03 -0800)]
gettytab: Add 3wire and std as terminal types/classes.

These are similar to
the existing terminal types/classes that have the baudrate suffix,
but differ in that no baudrate is set/defined.

Obtained-from: FreeBSD (r262955)

11 months agoskel: Quote default alias for pager
Eitan Adler [Sun, 31 Dec 2017 07:03:29 +0000 (23:03 -0800)]
skel: Quote default alias for pager

11 months agomorse(6): correct email for original author
Eitan Adler [Fri, 5 Jan 2018 06:48:14 +0000 (22:48 -0800)]
morse(6): correct email for original author

Obtained-From: FreeBSD

11 months agoldconfig(8): clean up manual page
Eitan Adler [Sun, 7 Jan 2018 06:28:58 +0000 (22:28 -0800)]
ldconfig(8): clean up manual page

- describe "-s"
- add newlines to sentence ends
- clarify file usage

Reviewed-by: swildner

11 months agolimit(1): fix always true condition
Eitan Adler [Sun, 21 Jan 2018 09:01:26 +0000 (01:01 -0800)]
limit(1): fix always true condition

12 months agoSync zoneinfo database with tzdata2018b from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 21 Jan 2018 11:02:04 +0000 (12:02 +0100)]
Sync zoneinfo database with tzdata2018b from ftp://ftp.iana.org/tz/releases

* Sao Tome and Principe switched from +00 to +01.

* Brazil's DST will now start on November's first Sunday.

* A discrepancy of 4 s in timestamps before 1931 in South Sudan has
    been corrected.

* The abbreviation invented for Bolivia Summer Time (1931-2) is now
    BST instead of BOST.

* Various smaller adjustments.

For a detailed list of changes, see share/zoneinfo/NEWS.

12 months agolimits(1): Add missing 'break'.
Sascha Wildner [Sat, 20 Jan 2018 10:48:46 +0000 (11:48 +0100)]
limits(1): Add missing 'break'.

12 months agoktrdump(8): Fix wrongly placed 'break' for floating point unpacking.
Sascha Wildner [Sat, 20 Jan 2018 10:37:04 +0000 (11:37 +0100)]
ktrdump(8): Fix wrongly placed 'break' for floating point unpacking.

12 months agopfctl(8): Fix two wrong conditions.
Sascha Wildner [Fri, 19 Jan 2018 09:09:09 +0000 (10:09 +0100)]
pfctl(8): Fix two wrong conditions.

Caught by gcc80's -Wtautological-compare option.

12 months agoetc/remote: Fix ucom[234].
Sascha Wildner [Wed, 17 Jan 2018 12:30:12 +0000 (13:30 +0100)]
etc/remote: Fix ucom[234].

13 months agoRemove /boot/efiboot.img via 'make upgrade'.
Sascha Wildner [Sat, 16 Dec 2017 10:39:05 +0000 (11:39 +0100)]
Remove /boot/efiboot.img via 'make upgrade'.

This is needed in our ISOs only to allow booting in EFI mode from
CD-ROM. In the installed system it is not needed anymore, so it
can be removed.

13 months agohammer2 - Fix indefinite dirty chains due to rename v5.0.2
Matthew Dillon [Sat, 2 Dec 2017 19:06:30 +0000 (11:06 -0800)]
hammer2 - Fix indefinite dirty chains due to rename

* Do not call cache_setunresolved() on tnch before calling
  cache_rename().  Doing so prevents cache_rename() from properly
  setting VREF_FINALIZE on the vnode.  Since the deleted inode is
  no longer in the chain hierarchy the related chains can remain
  dirty indefinitely (until the vnode is reused or the filesystem
  is unmounted).

* This fixes inmem dirty chain accounting and 'chnmem' stalls.

13 months agohammer2 - optimize hammer2_pfs_memory_wakeup()
Matthew Dillon [Sat, 2 Dec 2017 19:05:58 +0000 (11:05 -0800)]
hammer2 - optimize hammer2_pfs_memory_wakeup()

* Optimize hammer2_pfs_memory_wakeup() to use fetchadd instead of
  cmpset, reducing contention.

13 months agohammer2 - Fix rename race
Matthew Dillon [Sat, 2 Dec 2017 09:02:59 +0000 (01:02 -0800)]
hammer2 - Fix rename race

* Fix a rename race in hammer2 which can result in unwanted namecache
  overloading.  When this occurs, a rename operation can wind up
  deleting the same inode more than once.

* This fixes a "hammer2_chain_getparent: no parent" panic in H2.

Reported-by: kerma
13 months agolibarchive: Revert commit that was not meant to be pushed.
Sascha Wildner [Tue, 28 Nov 2017 19:13:35 +0000 (20:13 +0100)]
libarchive: Revert commit that was not meant to be pushed.

13 months agolibc/nls: Use current locale (set by thread).
Sascha Wildner [Tue, 28 Nov 2017 18:34:23 +0000 (19:34 +0100)]
libc/nls: Use current locale (set by thread).

It was global locale always previously.

Taken-from:  FreeBSD (r304755)
Reported-by: xenu (also provided a test case)
14 months agomtree: Fix owner for several directories in /usr/share.
Sascha Wildner [Mon, 13 Nov 2017 08:51:29 +0000 (09:51 +0100)]
mtree: Fix owner for several directories in /usr/share.

Only /usr/share/man/cat* directories should have owner 'man'.

0ba28897abadbf broke this by removing needed '/set uname=root' lines
in BSD.usr.dist.

While here, remove some trailing whitespace.

In-discussion-with: zrj

14 months agolibc and pthreads - Fix atfork issues with nmalloc, update dmalloc
Matthew Dillon [Wed, 8 Nov 2017 18:56:06 +0000 (10:56 -0800)]
libc and pthreads - Fix atfork issues with nmalloc, update dmalloc

* Implement atfork handling for nmalloc.  As part of this, refactor
  some of nmalloc.

* Remove ZERO_LENGTH_PTR from nmalloc.  Instead, force 0-byte
  allocations to allocate 1 byte.  The standard requires unique
  pointers to be returned.

* For now go back to a single depot lock instead of a per-zone
  lock.  It is unclear whether multi-threaded performance will
  suffer or not, but its the only way to implement atfork handling.

* Implement proper atfork interlocks for nmalloc via pthreads to avoid
  corruption when heavily threaded programs call fork().

* Bring dmalloc up to date in various ways, including properly
  implementing a minimum 16-byte alignment for allocations >= 16 bytes,
  and atfork handling.  Also use a global depot lock for the same
  reason we use it in nmalloc, and implement a front-end magazine
  shortcut for any allocations <= 2MB.

Reported-by: mneumann
14 months agokernel - Update umtx documentation
Matthew Dillon [Tue, 7 Nov 2017 06:08:21 +0000 (22:08 -0800)]
kernel - Update umtx documentation

* Update the umtx(2) documentation with better examples and include
  fine detail and warnings on use.

* Update the fork(2) documentation to include warnings about using
  the function in threaded programs.

14 months agokernel - selective MFC of kernel umtx work from master
Matthew Dillon [Wed, 8 Nov 2017 19:08:35 +0000 (11:08 -0800)]
kernel - selective MFC of kernel umtx work from master

* MFC code to wakeup all waiting umtx_sleep()s for a process
  when one of its threads forks.

* Add a second wakeup sysctl to help debug umtx issues.

* Implement a 2-second failsafe for umtx_sleep().

14 months agohammer2 - Fix divide by 0 race
Matthew Dillon [Mon, 6 Nov 2017 19:21:43 +0000 (11:21 -0800)]
hammer2 - Fix divide by 0 race

* Fix a statfs/statvfs race which can cause a divide-by-0.

Reported-by: arcade@b1t.name
14 months agotelnetd: print system information (OS and architecture) before login prompt.
Christian Groessler [Fri, 3 Nov 2017 13:28:53 +0000 (14:28 +0100)]
telnetd: print system information (OS and architecture) before login prompt.

14 months agoSay 'hammer2' instead of 'hammer' in various places.
Sascha Wildner [Mon, 6 Nov 2017 00:42:17 +0000 (01:42 +0100)]
Say 'hammer2' instead of 'hammer' in various places.

14 months agohammer2.8: Fix typo.
Sascha Wildner [Sun, 5 Nov 2017 23:34:51 +0000 (00:34 +0100)]
hammer2.8: Fix typo.

14 months agopthreads - Fix rtld-elf and libthread_xu v5.0.1
Matthew Dillon [Thu, 2 Nov 2017 23:21:13 +0000 (16:21 -0700)]
pthreads - Fix rtld-elf and libthread_xu

* Fixes chrome, thunderbird, and multiple other issues with recent
  libpthreads work.

Testing-by: mneumann, dillon
14 months agokernel - Add atomic_fcmpset_*()
Matthew Dillon [Sun, 15 Oct 2017 21:20:56 +0000 (14:20 -0700)]
kernel - Add atomic_fcmpset_*()

* Add atomic_fcmpset_*().  GCC has gotten good enough that it no longer
  forces that &count onto the stack.

  These functions work like atomic_cmpset_*() but update the originating
  value on failure, allowing us to avoid reloading it from memory.

Suggested-by: mjg__
14 months agokernel - Refactor vm_fault and vm_map a bit (3)
Matthew Dillon [Thu, 2 Nov 2017 03:33:24 +0000 (20:33 -0700)]
kernel - Refactor vm_fault and vm_map a bit (3)

* Fix bug in vm_map_split() where boject was being released
  and dropped out of order on a certain condition, causing an
  assertion.  bobject is released properly later so we should
  be able to simply remove the offending code.

14 months agokernel - Refactor vm_fault and vm_map a bit (partial MFC)
Matthew Dillon [Thu, 2 Nov 2017 02:23:50 +0000 (19:23 -0700)]
kernel - Refactor vm_fault and vm_map a bit (partial MFC)

* Fix an incorrect assertion in vm_map_split().

* Make sure OBJ_ONEMAPPING is cleared for nobject in vm_map_split().

* Fix a bug in the virtual copy test.  Multiple elements were
  not being retested after reacquiring the map lock.

* NOTE: moving the chain acquisition out of vm_map_split() not MFCd.

14 months agolibc - Add rtld stubs for pthreads
Matthew Dillon [Thu, 2 Nov 2017 01:53:30 +0000 (18:53 -0700)]
libc - Add rtld stubs for pthreads

* Add needed rtld stubs for -static -pthreads links.

14 months agolibthread_xu - Fix rtld and refactor locks
Matthew Dillon [Thu, 2 Nov 2017 00:18:56 +0000 (17:18 -0700)]
libthread_xu - Fix rtld and refactor locks

* Add a separate atfork facility for internal pthread atfork entities
  (sem and rtld) which must execute after all user atfork entities
  pre-fork and before all user atfork entities post-fork.

* Install an atfork handler for rtld-elf (also requires rtld-elf to
  be updated).  The handler will ensure that RTLD locks are in a sane
  state prior to fork (by acquiring them), and will then release the
  locks post-fork.  This is the primary fix for lang/rust and cargo.

  Also do not issue _thr_rtld_fini() when threading drops to 0.
  Once threading has been set, rtld's pthread locks remain installed.

* Refactor thr_cond.c.  Refactor condition variables to perform
  according to the spec.  Use a TAILQ to make pthread_cond_signal()
  work exactly as described in the manual (that is, waking up only
  one waiter at a time).

* Refactor thr_mutex.c.  Primary instrument for debugging and
  clean up.  Also deal with improper EINTR handling.

* Refactor thr_fork.c.  Implement the new atfork facility for
  internal atfork handlers.

* Refactor thr_rwlock.c.  Add debugging, cleanup.

* thr_sem.c now uses the internal atfork handler to ensure proper

* thr_sig.c implements debugging features.

* Refactor thr_umtx.c... the low level mutex code.  Store the id
  for additonal verification and use an atomic lock to clear the
  lock instead of an assignment.  Properly ignore EINTR.

* Cleanup init_private() a bit.

  flags.  The first writes out a garbage file in /tmp for all
  locking operations as they occur.  The second is used for
  point debugging and writes out a file when signal 63 is sent
  to the program.

* Add cpu_ccfence() in various places that might need it (a hack
  for the moment, userland cannot currently #include

* Should fix lang/rust and 'cargo'

14 months agortld - Add fork hooks for libthread_xu to install
Matthew Dillon [Thu, 2 Nov 2017 00:15:26 +0000 (17:15 -0700)]
rtld - Add fork hooks for libthread_xu to install

* Add fork hooks for libthread_xu to install.  rtld must acquire its
  locks exclusively during a fork, and then release them after the
  fork is complete, to prevent the fork() from catching the locks in
  a bad state.  See libthread_xu.

14 months agoInstall hammer2 periodic script.
Sascha Wildner [Wed, 1 Nov 2017 11:02:38 +0000 (12:02 +0100)]
Install hammer2 periodic script.

Reported-by: ftigeot
14 months agokernel: Rename struct tmpfs_args to tmpfs_mount_info
Markus Pfeiffer [Sun, 29 Oct 2017 22:47:18 +0000 (22:47 +0000)]
kernel: Rename struct tmpfs_args to tmpfs_mount_info

This makes the names of vfs argument structures slightly more

Since they were not installed before this should not break
any userland software.

14 months agokernel: Rename tmpfs_args.h to tmpfs_mount.h
Markus Pfeiffer [Sun, 29 Oct 2017 21:36:47 +0000 (21:36 +0000)]
kernel: Rename tmpfs_args.h to tmpfs_mount.h

This is slightly more consistent with the other VFS.

14 months agoInstall vfs/tmpfs headers
Markus Pfeiffer [Sun, 29 Oct 2017 15:46:59 +0000 (15:46 +0000)]
Install vfs/tmpfs headers

14 months agox86_64: Add pauses in the TSC mpsync testing loop.
Sepherosa Ziehau [Sat, 28 Oct 2017 06:46:31 +0000 (14:46 +0800)]
x86_64: Add pauses in the TSC mpsync testing loop.

This fixes Intel N3450 deadlock in the tight rdtsc/IPI loop.

Suggested-by: dillon@
Tested-by: mneumann@
Dragonfly-bug: http://bugs.dragonflybsd.org/issues/3087

14 months agokernel - Fix boot issues with > 512GB of ram
Matthew Dillon [Sun, 29 Oct 2017 21:37:32 +0000 (14:37 -0700)]
kernel - Fix boot issues with > 512GB of ram

* Fix DMAP installation issues for kernels with > 512GB of ram.
  The page table was not being laid out properly for PML4e
  entries past the first one.

* Fix early panic reporting.  Conditionalize the lapic access as the
  lapic might not exist yet.

* Tested to 1TB of ram.  Theoretically DragonFlyBSD can support up
  to 32TB of ram (and slightly less than ~64TB with one #define

Reported-by: zrj
Testing-by: zrj
14 months agohammer2 - Fix "hammer2_chain_getparent: no parent" assertion
Matthew Dillon [Sun, 29 Oct 2017 17:48:15 +0000 (10:48 -0700)]
hammer2 - Fix "hammer2_chain_getparent: no parent" assertion

* Inodes are placed on the pmp->sideq when a flush action is required
  but no vnode association exists.  This is most typically done when
  a vnode is reclaimed.  The sideq code also handles destroying an
  unlinked inode on last-close.

* It is possible for an already-deleted inode (not just unlinked, but
  also deleted from the topology) to wind up on the sideq list, resulting
  in the above assertion.

* Fix the assertion by handling the case.  Just flush the inode normally
  instead of trying to re-delete it.  The related in-memory topology will
  be destroyed automatically.

14 months agokernel - Fix cluster_awrite() race
Matthew Dillon [Sat, 28 Oct 2017 22:14:02 +0000 (15:14 -0700)]
kernel - Fix cluster_awrite() race

* Fix a race between cluster_awrite() and vnode destruction.  We
  have to finish working the cluster pbuf before disposing of the
  component elements.  b_vp in the cluster pbuf is held only by
  the presence of the components.

* Fixes NULL pointer indirection panic associated with heavy
  paging during tmpfs operations.  This typically only occurs
  when maxvnodes is set to a relatively low value, but it can
  eventually occur in any modestly paging environment when
  tmpfs is used.

14 months agoSync zoneinfo database with tzdata2017c from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 29 Oct 2017 10:46:32 +0000 (11:46 +0100)]
Sync zoneinfo database with tzdata2017c from ftp://ftp.iana.org/tz/releases

* Northern Cyprus switches from +03 to +02/+03 on 2017-10-29.

* Fiji ends DST 2018-01-14, not 2018-01-21.

* Namibia switches from +01/+02 to +02 on 2018-04-01.

* Sudan switches from +03 to +02 on 2017-11-01.

* Tonga likely switches from +13/+14 to +13 on 2017-11-05.

* Turks & Caicos switches from -04 to -05/-04 on 2018-11-04.

For a detailed list of changes, see share/zoneinfo/NEWS.

15 months agoif_vtnet - Handle missing IFCAP_VLAN_* flags nicer. Comment IFCAP_LOR stuff.
Imre Vadász [Tue, 17 Oct 2017 20:06:23 +0000 (22:06 +0200)]
if_vtnet - Handle missing IFCAP_VLAN_* flags nicer. Comment IFCAP_LOR stuff.

* The if_vtnet driver used to define the IFCAP_LRO, IFCAP_VLAN_HWFILTER and
  IFCAP_VLAN_HWTSO flags itself, to make the code from FreeBSD build.
  Instead define IFCAP_VLAN_HWFILTER and IFCAP_VLAN_HWTSO to 0, when they
  are not defined already. This allows the code to build, but all checks
  for the flags fail. (Inspired by the vmxnet3 driver port).

* The IFCAP_LRO flag is unavailable in DragonFly, but the LRO offload seems
  to work somehow.

* According to the virtio specification, LRO support should be possible
  without rx checksum support as well.

15 months agoif_vtnet - Disable rx csum offload due to unsupported ipv6 rx csum offload.
Imre Vadász [Tue, 17 Oct 2017 20:11:08 +0000 (22:11 +0200)]
if_vtnet - Disable rx csum offload due to unsupported ipv6 rx csum offload.

* Ignoring the checksum offloading in the receive path of the driver isn't
  sufficient, since we might receive only partially checksummed packets
  from the host.

* Unfortunately there is only a single feature flag for both ipv4 and ipv6
  receive checksum offloading, so we need to disable both for now.

* At the moment we don't support a way to explicitly enable the rx csum
  feature at runtime, but this will be easily possible by adding support

* Mention this as a caveat in the manpage.

* Update correct default value of hw.vtnet.lro_disable tunable in the
  manpage, to match the code again.

15 months agokernel - Zero out syncache_percpu properly
Matthew Dillon [Sun, 22 Oct 2017 00:31:43 +0000 (17:31 -0700)]
kernel - Zero out syncache_percpu properly

* The kmalloc for the syncache_percpu was not using M_ZERO
  which I believe can cause cache_count to be some random
  value.  If this value is close to or larger than the syncache
  limit, the garbage collector may run with no entries to reuse,
  causing a NULL pointer dereference and panic.

Reported-by: pa3k #3088
15 months agoinitrd - Add 'fetch'
Matthew Dillon [Fri, 20 Oct 2017 23:42:42 +0000 (16:42 -0700)]
initrd - Add 'fetch'

* Add the 'fetch' program to the recovery shell.  This is just too
  useful a program to not have on the rescue ramdisk.

15 months agokernel - Increase ACPI_SEMAPHORES_MAX_PENDING
Matthew Dillon [Thu, 19 Oct 2017 04:43:27 +0000 (21:43 -0700)]

* Increase ACPI_SEMAPHORES_MAX_PENDING to a very large number.
  Some of the ACPI codes assumes that mutexes always succeed,
  but the mutex code uses the semaphore code and the semaphore
  code appears to have an arbitrary failure path based on the
  number of concurrent requests.

* This fixes kernel confusion and console spam from the ACPI
  subsystem when running sysctl -a concurrently on more than
  4 threads.

15 months agokernel - Remove 'Emergency Pager' debugging messages
Matthew Dillon [Tue, 17 Oct 2017 18:55:24 +0000 (11:55 -0700)]
kernel - Remove 'Emergency Pager' debugging messages

* Remove these messages.  They were for debugging only and, in fact,
  the activation of the anonymous-only pager is not really an

15 months agoAdd mount_hammer2 and newfs_hammer2 to initrd list.
Justin C. Sherrill [Tue, 17 Oct 2017 18:28:14 +0000 (14:28 -0400)]
Add mount_hammer2 and newfs_hammer2 to initrd list.

15 months agomkinitrd - Add missing /var/db (3)
Matthew Dillon [Mon, 16 Oct 2017 22:17:42 +0000 (15:17 -0700)]
mkinitrd - Add missing /var/db (3)

* When /var is mounted via tmpfs we have to mkdir the subdirs

* Add /var/db and /var/empty to the directories initrd creates
  in its rc.

Submitted-by: amonk
15 months agovirtio_blk - Fix capacity calculation, when host sets large disk block size.
Imre Vadász [Mon, 16 Oct 2017 22:00:32 +0000 (00:00 +0200)]
virtio_blk - Fix capacity calculation, when host sets large disk block size.

* The disk capacity in the virtio configuration space is always specified
  in 512 byte sectors, so info.d_media_blksize should be 512.

* Also check for VIRTIO_BLK_F_GEOMETRY feature before reading the disk
  geometry from configuration space.

* Add some device_printf calls to report the disk size and (if available)
  geometry during bootup.

15 months agoLINT64: Sort vmx a bit better. v5.0.0
Sascha Wildner [Sun, 15 Oct 2017 11:07:04 +0000 (13:07 +0200)]
LINT64: Sort vmx a bit better.

15 months agoRevert "libthread_xu - Wakeup all waiters"
Matthew Dillon [Sun, 15 Oct 2017 07:44:06 +0000 (00:44 -0700)]
Revert "libthread_xu - Wakeup all waiters"

This reverts commit 4e7c9dfbd0ad1f7bb5ec7c5f6eb6d6a1c44c404a.

* Didn't intend to push this.

15 months agolibthread_xu - Wakeup all waiters
Matthew Dillon [Sun, 15 Oct 2017 07:13:42 +0000 (00:13 -0700)]
libthread_xu - Wakeup all waiters

* For now punt on trying to wakeup an optimized numbers of waiters.
  Wake up all waiters and let them sort it out.

* This may fix specific count races in threaded programs using
  pthread mutexes.

15 months agohammer2 - Handle error on rename in media out of space case
Matthew Dillon [Sat, 14 Oct 2017 22:28:12 +0000 (15:28 -0700)]
hammer2 - Handle error on rename in media out of space case

* Process the error code from hammer2_chain_delete() in
  hammer2_xop_nrename() to ensure that we do not try to reattach
  the chain under another parent.

Reported-by: arcade (Bug #3055)
15 months agosshd - Disable tunneled clear text passwords by default
Matthew Dillon [Sat, 14 Oct 2017 21:18:39 +0000 (14:18 -0700)]
sshd - Disable tunneled clear text passwords by default

* Reapply 1cb3a32c13b and c866a462b3.  sshd on DragonFlyBSD defaults
  to disabling cleartext passwords by default.

Reminded-by: ivadasz
15 months agocpdup(1): Some improvements.
Sascha Wildner [Sat, 14 Oct 2017 19:06:14 +0000 (21:06 +0200)]
cpdup(1): Some improvements.

* Make cpdup retry failed rmdirs after chflags. It already does this
  for remove().

* When deciding whether to copy a file, cpdup should ignore the
  UF_ARCHIVE file flag. If that flag is supported by the destination
  file system but it's cleared on a source file, then multiple
  invocations of cpdup would all copy the source file because its
  flags wouldn't match. OTOH, if the destination filesystem doesn't
  support UF_ARCHIVE, then there's no point in cpdup setting it.

Submitted-by: Will Andrews <will@firepipe.net>
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/2987

15 months agohammer2 - Slightly reduce LZ4 output buffer limit
Matthew Dillon [Sat, 14 Oct 2017 17:59:30 +0000 (10:59 -0700)]
hammer2 - Slightly reduce LZ4 output buffer limit

* LZ4_compress_limitedOutput() appears to be able to overrun the
  supplied buffer.

* Slightly reduce the LZ4 output buffer limit from a 4-byte alignment
  to an 8-byte alignment to try to fix the problem.

15 months agoFix additional cases of seg-faults on crypt(3) failure
Lubos Boucek [Fri, 13 Oct 2017 21:33:01 +0000 (21:33 +0000)]
Fix additional cases of seg-faults on crypt(3) failure

* On failure, crypt(3) returns NULL, which is then used as a
  strcmp(3) argument

opieftpd.c and opiesu.c are not actually used anywhere.

15 months agosystat.1: Update man page: sync to current program & improve markup a bit
Thomas Nikolajsen [Wed, 11 Oct 2017 23:03:46 +0000 (01:03 +0200)]
systat.1: Update man page: sync to current program & improve markup a bit

    Substantial changes has happened, especially for vmstat display.

15 months agorc.8: Clarify foo.sh behavior.
Sascha Wildner [Sat, 14 Oct 2017 08:48:04 +0000 (10:48 +0200)]
rc.8: Clarify foo.sh behavior.

Improve wording a bit. See NetBSD's revision 1.38.

Reported-by: Aaron LI <aly@aaronly.me>
15 months agodisklabel64: Fix an error message
Aaron LI [Fri, 13 Oct 2017 04:26:29 +0000 (12:26 +0800)]
disklabel64: Fix an error message

15 months agoifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.
Sascha Wildner [Sat, 14 Oct 2017 08:38:45 +0000 (10:38 +0200)]
ifconfig(8): Add 'lscan'. Like 'scan', but displays long SSIDs.

Submitted-by: Max Herrgard <herrgard@gmail.com>
15 months agomkinitrd - Add missing /var/db
Matthew Dillon [Sat, 14 Oct 2017 06:14:31 +0000 (23:14 -0700)]
mkinitrd - Add missing /var/db

* dhclient also needs /var/db to exist, make sure it does.

Reported-by: amonk
15 months agomkinitrd - Add missing /var/empty
Matthew Dillon [Sat, 14 Oct 2017 05:39:31 +0000 (22:39 -0700)]
mkinitrd - Add missing /var/empty

* /var/empty is required by dhclient, which will SIGHUP itself
  without it.

Reported-by: amonk
15 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:33:48 +0000 (18:33 -0700)]
Import OpenSSH-7.6p1

* Adjust build to match import

15 months agoImport OpenSSH-7.6p1
Matthew Dillon [Fri, 13 Oct 2017 01:32:28 +0000 (18:32 -0700)]
Import OpenSSH-7.6p1

* Import OpeNSSH-7.6p1.  Couldn't really merge from the vendor branch
  so just brought it in.

* Adjustments for WARNS issues

15 months ago<netdb.h>: Adjust comment a bit.
Sascha Wildner [Thu, 12 Oct 2017 08:16:06 +0000 (10:16 +0200)]
<netdb.h>: Adjust comment a bit.

15 months agolibc/net: Add NI_NUMERICSCOPE flag for getnameinfo().
Sascha Wildner [Thu, 12 Oct 2017 08:13:31 +0000 (10:13 +0200)]
libc/net: Add NI_NUMERICSCOPE flag for getnameinfo().

Code to handle it is already present in getnameinfo() but we
were missing the flag so far.

See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netdb.h.html

15 months agokernel: Simplify various redundant conditions.
Sascha Wildner [Wed, 11 Oct 2017 14:55:23 +0000 (16:55 +0200)]
kernel: Simplify various redundant conditions.

Found-by: cppcheck
One was reported by dcb in <https://bugs.dragonflybsd.org/issues/3078>.

15 months agokernel/atkbdc: Fix a prototype.
Sascha Wildner [Wed, 11 Oct 2017 20:05:26 +0000 (22:05 +0200)]
kernel/atkbdc: Fix a prototype.

15 months agokernel/cam: Add some missing parameter names.
Sascha Wildner [Wed, 11 Oct 2017 20:04:43 +0000 (22:04 +0200)]
kernel/cam: Add some missing parameter names.

Just like the rest of the file.

15 months ago<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.
Sascha Wildner [Wed, 11 Oct 2017 17:31:25 +0000 (19:31 +0200)]
<vfs/hammer2/hammer2.h>: Fix parameter names in two prototypes.

Discussed-with: dillon

15 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD (2)
Matthew Dillon [Tue, 10 Oct 2017 22:38:08 +0000 (15:38 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD (2)

* Note, correction, v1.3 from OpenBSD, not v1.2

* Restore a cast that we need to compile with our higher WARNS level.

Reported-by: marino, xenu
15 months agokernel/mrsas: Simplify redundant conditions and remove never used variable
Lubos Boucek [Mon, 2 Oct 2017 02:16:10 +0000 (02:16 +0000)]
kernel/mrsas: Simplify redundant conditions and remove never used variable

Reported-by: dcb
15 months agolibc - Bring in s_ceill.c v1.2 from OpenBSD
Matthew Dillon [Tue, 10 Oct 2017 02:17:32 +0000 (19:17 -0700)]
libc - Bring in s_ceill.c v1.2 from OpenBSD

fix a case where ceill() returns 1.0L: in the x86 extended precision format
the fraction part has no implicit bit.

Reported-by: xenu
Taken-from: OpenBSD

15 months agohammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.
Sascha Wildner [Sun, 8 Oct 2017 07:47:58 +0000 (09:47 +0200)]
hammer2.8/pthread_attr_setaffinity_np.3: Fix mdoc issues.

15 months agodisklabel64.8: Add HAMMER2 fstype info.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:14:52 +0000 (16:14 +0200)]
disklabel64.8: Add HAMMER2 fstype info.

15 months agoperiodic.conf.5: Add hammer2 variables.
Thomas Nikolajsen [Sat, 7 Oct 2017 14:09:36 +0000 (16:09 +0200)]
periodic.conf.5: Add hammer2 variables.

    Add description for periodic HAMMER2 script variables: 161.clean_hammer2.
    While here add HAMMER man pages to SEE ALSO section.

15 months agoetc/periodic/daily/161.clean-hammer2: Fix typo
Thomas Nikolajsen [Sat, 7 Oct 2017 13:53:37 +0000 (15:53 +0200)]
etc/periodic/daily/161.clean-hammer2: Fix typo

    pfslist variable for HAMMER, not HAMMER2 was used.
    This will typically have no effect, as pfslist is typically empty.

15 months agoperiodic.conf: Fix typo in comment
Thomas Nikolajsen [Sat, 7 Oct 2017 13:19:41 +0000 (15:19 +0200)]
periodic.conf: Fix typo in comment

15 months agomount_hammer2(8): Add man page.
Thomas Nikolajsen [Sat, 7 Oct 2017 13:13:11 +0000 (15:13 +0200)]
mount_hammer2(8): Add man page.

15 months agoBring in vmx(4) (VMware virtual network driver, aka vmxnet3).
Sascha Wildner [Wed, 4 Oct 2017 17:01:17 +0000 (19:01 +0200)]
Bring in vmx(4) (VMware virtual network driver, aka vmxnet3).

Some features are still disabled, namely LRO, TSO, VLAN_HWFILTER,
and MSI-X support. That being said, it works and seems stable.

Tested-by: swildner (VMware Player 7.1.4 build-3848939)
            tuxillo (VMware ESXi 6.5.0 (Build 4887370))
Taken-from: FreeBSD (in turn based on OpenBSD's driver)

15 months agokernel - Refuse to swapoff under certain conditions
Matthew Dillon [Fri, 6 Oct 2017 05:59:40 +0000 (22:59 -0700)]
kernel - Refuse to swapoff under certain conditions

* Both tmpfs and vn can't handle swapoff's method of bringing pages
  back in from the swap partition being decomissioned.

* Fixing this properly is fairly involved. The normal swapoff procedure
  is to page swap into the related VM object, but tmpfs and vn use their
  VM objects ONLY to track swap blocks and not for vm_page manipulation,
  so that just won't work.  In addition, the swap code may associate
  a swap block with a VM object before issuing the write I/O to page
  out the data, and the swapoff code's asynchronous pagein might cause

  For now, just make sure that swapoff refuses to remove the partition
  under these conditions, so it doesn't blow up tmpfs or vn.

15 months agotmpfs - Fix bug in call to vinitvmio()
Matthew Dillon [Fri, 6 Oct 2017 01:57:33 +0000 (18:57 -0700)]
tmpfs - Fix bug in call to vinitvmio()

* TMPFS_BLKMASK was being passed to vinitvmio() instead of
  TMPFS_BLKSIZE.  It is unclear if this caused any particular
  issue other than an occasional console warning.  Fixed.

15 months agokernel - Change index fields from unsigned to signed
Matthew Dillon [Thu, 5 Oct 2017 20:46:54 +0000 (13:46 -0700)]
kernel - Change index fields from unsigned to signed

* We use a signed trick for (j), fix the code so it actually works.

* The chipset field used to index (i) cannot exceed 1024 anyway.

Reported-by: lubos Bug #3020
15 months agoFix seg-faults on crypt(3) failure
Lubos Boucek [Sat, 23 Sep 2017 07:12:28 +0000 (07:12 +0000)]
Fix seg-faults on crypt(3) failure

15 months agoImprove kdump.1 and ktrace.1
Lubos Boucek [Fri, 22 Sep 2017 22:27:18 +0000 (22:27 +0000)]
Improve kdump.1 and ktrace.1

15 months agonologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin
Aaron LI [Wed, 27 Sep 2017 10:24:05 +0000 (18:24 +0800)]
nologin(8): Sync with FreeBSD; Symlink as /usr/sbin/nologin

* Sync "nologin.c" with FreeBSD.  Login attempts are logged into syslog.
* Create symlink "/usr/sbin/nologin" to "/sbin/nologin".  FreeBSD
  (and Linux) installs "nologin" at  "/usr/sbin/nologin", and the users
  created by DPorts/packages also use "/usr/sbin/nologin" (see
* Statically link "nologin" as done by FreeBSD.

15 months agosocket: Limit the number of accepted sockets that kevent reports.
Sepherosa Ziehau [Thu, 5 Oct 2017 06:06:11 +0000 (14:06 +0800)]
socket: Limit the number of accepted sockets that kevent reports.

By default it is limited to 32.  It can be changed through:
sysctl kern.ipc.soavailconn=X

This change does _not_ affect userland using accept(2) in the following
    for (;;) {
        s = accept();
        if (s < 0 && errno == EAGAIN)
        /* Processing accepted socket. */

This change only affects optimized userland using kevent.data to avoid
extra accept(2) syscall:
    for (i = 0; i < kevent.data; ++i) {
        s = accept();
        /* Processing accepted socket. */

The above logic is applied by nginx.  However, due to the cost of the
"Processing accepted socket" parts, this kinda of loop can increase
latency and destablize latency.

The comparison w/ 30K concurrent connections, 1 request/connection.

 1K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
no limit | 210279.88tps |  59.19ms |    4.60ms |  69.02ms
32 limit | 217599.01tps |  32.00ms |    2.35ms |  35.59ms


 8K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
no limit | 180627.61tps |  70.53ms |    4.95ms |  80.61ms
32 limit | 186324.41tps |  37.41ms |    4.81ms |  48.69ms


16K web object
         |  performance |  lat-avg | lat-stdev |  lat-99%
no limit | 138667.84tps |  95.93ms |   14.90ms | 135.47ms
32 limit | 138778.11tps |  60.90ms |   11.80ms |  92.07ms

This change significantly reduces average latency and .99 latency,
and performance is improved slightly.

15 months agokernel - Fix GCC reordering problem with td_critcount
Matthew Dillon [Tue, 3 Oct 2017 01:42:34 +0000 (18:42 -0700)]
kernel - Fix GCC reordering problem with td_critcount

* Wrap all ++td->td_critcount and --td->td_critcount use cases
  with an inline which executes cpu_ccfence() before and after,
  to guarantee that GCC does not try to reorder the operation around
  critical memory changes.

* This fixes a race in lockmgr() and possibly a few other places

15 months agokernel - Fix rare lockmgr() state transition (2)
Matthew Dillon [Sun, 1 Oct 2017 18:18:49 +0000 (11:18 -0700)]
kernel - Fix rare lockmgr() state transition (2)

* Fix two lock timeout cases for LK_EXCLUPGRADE and LK_UPGRADE, and
  fix a bug in undo_upreq().

* A tsleep failure (such as the LK_TIMELOCK case via
  vm_map_lock_read_to()) was not properly backing-out a LKC_UPREQ,
  resulting in a situation where the lock becomes exclusively owned
  by nobody and deadlocks against all-comers.  Fix by properly
  calling undo_upreq().

* Fix a bug in undo_upreq() itself.  When undoing a granted UPREQ,
  the lockholder must be set prior to releasing the now-granted
  exclusive lock in order to avoid an assertion panic.

* While we are at it, replace a weird cmpset count,count with a
  fetchadd(count, 0).