2 years agolibressl: Fix validation errors in certificate chains with expired certificates
Antonio Huete Jimenez [Fri, 1 Oct 2021 07:33:55 +0000 (09:33 +0200)]
libressl: Fix validation errors in certificate chains with expired certificates

 - Local patch to LibreSSL, from OpenBSD 6.9 errata 018, September 30, 2021.
 - Tested with pkg, fetch.

Reported-by: zach, others
Taken-from: OpenBSD

2 years agoman.1: Add some examples (taken from FreeBSD).
Sascha Wildner [Fri, 24 Sep 2021 20:39:01 +0000 (22:39 +0200)]
man.1: Add some examples (taken from FreeBSD).

2 years agomandoc(1): Update local files for 1.14.6.
Sascha Wildner [Fri, 24 Sep 2021 20:27:08 +0000 (22:27 +0200)]
mandoc(1): Update local files for 1.14.6.

2 years agoMerge branch 'vendor/MDOCML'
Sascha Wildner [Fri, 24 Sep 2021 20:26:26 +0000 (22:26 +0200)]
Merge branch 'vendor/MDOCML'

2 years agoImport mandoc-1.14.6. vendor/MDOCML
Sascha Wildner [Fri, 24 Sep 2021 20:25:36 +0000 (22:25 +0200)]
Import mandoc-1.14.6.

See https://mandoc.bsd.lv/NEWS for a list of changes.

2 years agoFix a typo in a locale upgrade script.
Sascha Wildner [Fri, 24 Sep 2021 12:53:59 +0000 (14:53 +0200)]
Fix a typo in a locale upgrade script.

2 years agoFix .In abuse and a wrong include path in three manual pages.
Sascha Wildner [Thu, 16 Sep 2021 15:44:40 +0000 (17:44 +0200)]
Fix .In abuse and a wrong include path in three manual pages.

2 years agoFix some include file paths (.In) in two manual pages.
Sascha Wildner [Thu, 16 Sep 2021 07:38:47 +0000 (09:38 +0200)]
Fix some include file paths (.In) in two manual pages.

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Wed, 15 Sep 2021 15:02:55 +0000 (17:02 +0200)]
Update the pciconf(8) database.

September 14, 2021 snapshot from https://pci-ids.ucw.cz

2 years agoSome additions and fixes related to fdatasync(2) and posix_fallocate(2).
Sascha Wildner [Tue, 14 Sep 2021 20:14:14 +0000 (22:14 +0200)]
Some additions and fixes related to fdatasync(2) and posix_fallocate(2).

* Fix a small issue in VOP_FDATASYNC()'s definition in <sys/vfsops.h>.

* Mention fdatasync() in fsync.2 (this basically syncs that manual page
  with FreeBSD, with a few adjustments).

* Add a manual page for posix_fallocate() (from FreeBSD, with a few

* Mention fdatasync() in the list of reentrant functions in sigaction.2.

* In pthread_testcancel.3, mention fdatasync() in the list of functions
  for which a cancellation point will occur.

* Mention VOP_FDATASYNC() in VOP_FSYNC.9 (partly taken from FreeBSD).

* Remove a compatibility define in the fsstress tool.

Thanks to tkusumi for reviewing.

2 years agogencat(1): Bump WARNS to 6.
Sascha Wildner [Mon, 13 Sep 2021 15:25:11 +0000 (17:25 +0200)]
gencat(1): Bump WARNS to 6.

2 years agosys/kern: Add fdatasync(2)
Tomohiro Kusumi [Sat, 11 Sep 2021 16:57:53 +0000 (01:57 +0900)]
sys/kern: Add fdatasync(2)

Based on the following FreeBSD commits in 2016.

Add the syscall and also add it to pthread's cancellation point.
The default behavior is same as fsync(2), which is fine but inefficient.

2 years agolibc: Remove __NO_TLS checks inherited from FreeBSD.
Sascha Wildner [Sat, 11 Sep 2021 17:43:09 +0000 (19:43 +0200)]
libc: Remove __NO_TLS checks inherited from FreeBSD.

2 years agolibc: Move posix_fallocate() to the right place in Symbol.map.
Sascha Wildner [Sat, 11 Sep 2021 17:39:59 +0000 (19:39 +0200)]
libc: Move posix_fallocate() to the right place in Symbol.map.

2 years agosys/kern: Move vop_stdallocate() within vfs_default.c
Tomohiro Kusumi [Sat, 11 Sep 2021 15:40:04 +0000 (00:40 +0900)]
sys/kern: Move vop_stdallocate() within vfs_default.c

vop_allocate stuff are usually placed after vop_markatime,
but looking at vfs_default.c this std function should probably
be the last.

2 years ago<sys/kernel.h>: Remove unused SI_BOOT2_VMM definition.
Sascha Wildner [Thu, 9 Sep 2021 14:26:21 +0000 (16:26 +0200)]
<sys/kernel.h>: Remove unused SI_BOOT2_VMM definition.

2 years agosys/kern: Add posix_fallocate(2)
Tomohiro Kusumi [Wed, 8 Sep 2021 14:09:44 +0000 (23:09 +0900)]
sys/kern: Add posix_fallocate(2)

Based on the initial posix_fallocate(2) implementation in FreeBSD
from d91f88f7f38078ac6dd4b0f0e77470d605d1518e in 2011.

There is nothing special or efficient about the default behavior.
VFS has no knowledge of fs details.

2 years ago<sys/*.h>: Fix some include guard related comments.
Sascha Wildner [Tue, 7 Sep 2021 20:38:59 +0000 (22:38 +0200)]
<sys/*.h>: Fix some include guard related comments.

2 years ago<sys/*.h>: Fix some include guard names.
Sascha Wildner [Tue, 7 Sep 2021 20:34:29 +0000 (22:34 +0200)]
<sys/*.h>: Fix some include guard names.

2 years agokernel/libc: Remove the old vmm code.
Sascha Wildner [Tue, 7 Sep 2021 16:18:25 +0000 (18:18 +0200)]
kernel/libc: Remove the old vmm code.

Removes the kernel code and two system calls.

Bump __DragonFly_version too.

Reviewed-by: aly, dillon
2 years agoinstaller: Use <sys/diskmbr.h>'s define instead of a constant.
Sascha Wildner [Tue, 7 Sep 2021 02:34:42 +0000 (04:34 +0200)]
installer: Use <sys/diskmbr.h>'s define instead of a constant.

2 years agokernel: In some files, make it clearer that only 0 is returned.
Sascha Wildner [Sun, 5 Sep 2021 12:57:01 +0000 (14:57 +0200)]
kernel: In some files, make it clearer that only 0 is returned.

The error case has already been dealt with earlier in the function.

2 years agohammer2 - Fix panic when /tmp and /var/tmp are nullfs mounts
Matthew Dillon [Wed, 1 Sep 2021 23:07:22 +0000 (16:07 -0700)]
hammer2 - Fix panic when /tmp and /var/tmp are nullfs mounts

* Certain illegal rename operations can cause a panic() in hammer2
  when /tmp and/or /var/tmp are nullfs mounts into an H2 filesystem.

* Catch the situation, report it, and generate an error code instead
  of panicing.

Reported-by: tuxillo and at least one other person recently
2 years agousr.sbin/fstyp: Add BeFS support
Tomohiro Kusumi [Thu, 26 Aug 2021 15:04:26 +0000 (00:04 +0900)]
usr.sbin/fstyp: Add BeFS support

from FreeBSD 0e92585cde5101506720ca1b904372317b7d84b6

2 years agosys/vfs/ext2fs: Correct a typo in an error message
Tomohiro Kusumi [Thu, 26 Aug 2021 14:15:07 +0000 (23:15 +0900)]
sys/vfs/ext2fs: Correct a typo in an error message

from FreeBSD 47f880ebeb3092b1b7bbc6d75e82532e43bbf010

2 years agoMake a number of headers self-sufficient.
Sascha Wildner [Fri, 27 Aug 2021 14:06:00 +0000 (16:06 +0200)]
Make a number of headers self-sufficient.

Also, do not trust headers to bring in needed headers.

2 years ago<sys/mman.h>: Remove MAP_RENAME, MAP_NORESERVE and MAP_NOEXTEND defines.
Sascha Wildner [Fri, 27 Aug 2021 13:15:37 +0000 (15:15 +0200)]
<sys/mman.h>: Remove MAP_RENAME, MAP_NORESERVE and MAP_NOEXTEND defines.

They were all inherited from FreeBSD and never implemented nor used.
FreeBSD never implemented them either and has removed all of them by

Pointed-out-by: rtzoeller
2 years agoFix grammar issues in a few manual pages.
Sascha Wildner [Mon, 23 Aug 2021 21:36:56 +0000 (23:36 +0200)]
Fix grammar issues in a few manual pages.

2 years agolibnvmm.3: Fix some typos.
Sascha Wildner [Mon, 23 Aug 2021 20:07:35 +0000 (22:07 +0200)]
libnvmm.3: Fix some typos.

2 years agokernel/acpi: Remove the never used ACPI_NO_SEMAPHORES kernel option.
Sascha Wildner [Sun, 22 Aug 2021 11:00:44 +0000 (13:00 +0200)]
kernel/acpi: Remove the never used ACPI_NO_SEMAPHORES kernel option.

2 years agoSome trivial changes to better comply with strict aliasing. (2)
Sascha Wildner [Sat, 21 Aug 2021 21:40:36 +0000 (23:40 +0200)]
Some trivial changes to better comply with strict aliasing. (2)

Now that the warnings are fixed, do not pass -fno-strict-aliasing

2 years agogetconf(1): Add support for retrieving _SC_PHYS_PAGES.
Sascha Wildner [Sat, 21 Aug 2021 21:16:34 +0000 (23:16 +0200)]
getconf(1): Add support for retrieving _SC_PHYS_PAGES.

2 years agoboot0cfg(8): Use some constants from <sys/diskmbr.h>.
Sascha Wildner [Sat, 21 Aug 2021 19:27:50 +0000 (21:27 +0200)]
boot0cfg(8): Use some constants from <sys/diskmbr.h>.


2 years agoSome trivial changes to better comply with strict aliasing.
Gwenio [Thu, 7 Mar 2013 17:31:42 +0000 (12:31 -0500)]
Some trivial changes to better comply with strict aliasing.

2 years ago<sys/diskmbr.h>: Don't expose the partition type struct/array for boot code.
Sascha Wildner [Sat, 21 Aug 2021 20:35:50 +0000 (22:35 +0200)]
<sys/diskmbr.h>: Don't expose the partition type struct/array for boot code.

2 years agodefaults/compilers.conf: Add CCVER definitions for clang11.
Sascha Wildner [Sat, 21 Aug 2021 17:21:34 +0000 (19:21 +0200)]
defaults/compilers.conf: Add CCVER definitions for clang11.

2 years ago<sys/diskmbr.h>: Minor style fix (missed in last commit).
Sascha Wildner [Sat, 21 Aug 2021 14:56:10 +0000 (16:56 +0200)]
<sys/diskmbr.h>: Minor style fix (missed in last commit).

2 years agoinstaller(8): Move the contents of sysids.h into <sys/diskmbr.h>.
Sascha Wildner [Sat, 21 Aug 2021 14:42:36 +0000 (16:42 +0200)]
installer(8): Move the contents of sysids.h into <sys/diskmbr.h>.

It is needed by both fdisk(8) and the installer.

<sys/diskmbr.h> seems reasonable because it already has defines for
various partition types. Use them in the struct. Adjust the naming of
the structure and the array to match the rest of <sys/diskmbr.h>.

Based on a patch by Alexander Kuleshov <kuleshovmail@gmail.com>.

Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/2875>

2 years agosysconf.3: Document more constants.
Sascha Wildner [Fri, 20 Aug 2021 21:36:12 +0000 (23:36 +0200)]
sysconf.3: Document more constants.

2 years agofdisk(8): check the result of the write_s0()
Alexander Kuleshov [Mon, 28 Dec 2015 12:34:55 +0000 (18:34 +0600)]
fdisk(8): check the result of the write_s0()

This patch provides a check of the write_s0() function call
which can be -1 on failure.

2 years agofdisk(8): close boot_fd on failure
Alexander Kuleshov [Mon, 28 Dec 2015 12:22:50 +0000 (18:22 +0600)]
fdisk(8): close boot_fd on failure

The init_boot() function opens/reads the /boot/mbr file or
file which is given with the -b option. There are couple
failure cases can be occured there. So we need to close
file description of /boot/mbr.

2 years agofdisk(8): check the result of read_s0()
Alexander Kuleshov [Mon, 28 Dec 2015 12:12:31 +0000 (18:12 +0600)]
fdisk(8): check the result of read_s0()

The read_s0() function can return -1 on failure, so we need to
check its result.

2 years agofdisk(8): check result of the read_disk() function
Alexander Kuleshov [Mon, 28 Dec 2015 11:50:15 +0000 (17:50 +0600)]
fdisk(8): check result of the read_disk() function

During detection of the sector size, the read_disk function may
return '-1'. This patch provides check for this case.

2 years agofdisk(8): check result of the getdevpath(3)
Alexander Kuleshov [Mon, 28 Dec 2015 11:47:58 +0000 (17:47 +0600)]
fdisk(8): check result of the getdevpath(3)

We are using the getdevpath(3) function in the fdisk.c As described
in the manual:

getdevpath() returns a pointer to a malloc()'d path on success and NULL
on failure.  If a failure occurs errno will be set appropriately.

So, we need to check the result of the getdevapth() call.

2 years agofdisk: use macros from the <sys/diskmbr.h>
Alexander Kuleshov [Mon, 28 Dec 2015 11:45:34 +0000 (17:45 +0600)]
fdisk: use macros from the <sys/diskmbr.h>

The fdisk(8) contains definitions of the C:H:S related macros. In
the same time, the <sys/diskmbr.h> header provides the same set of
macros. Let's use it, instead of self written.

2 years agoperiodic/accounting: Fix a missing "Doing login accounting:" line.
Sascha Wildner [Sat, 21 Aug 2021 10:47:43 +0000 (12:47 +0200)]
periodic/accounting: Fix a missing "Doing login accounting:" line.

While here, sync monthly/200.accounting with FreeBSD, adjust the
periodic.conf.5 manual page for the changes in 980397133d362b559ec,
and also point out that daily's accounting is process accounting
(from FreeBSD).

Submitted-by: James Cook (falsifian)
Dragonfly-bug: <https://bugs.dragonflybsd.org/issues/3289>

2 years agodsynth.1: Document hooks
Antonio Huete Jimenez [Fri, 20 Aug 2021 22:41:13 +0000 (00:41 +0200)]
dsynth.1: Document hooks

Suggested-and-reviewed-by: swildner
2 years ago<errno.h>: Make ENOTRECOVERABLE and EOWNERDEAD visible unconditionally.
Sascha Wildner [Sun, 15 Aug 2021 10:40:20 +0000 (12:40 +0200)]
<errno.h>: Make ENOTRECOVERABLE and EOWNERDEAD visible unconditionally.

The problem here is that GCC will expect these errnos to be
visible unconditionally for its C++ headers - and errors in
<bits/error_constants> if they aren't - as soon as we set the
HAVE_E* for them in GCC's config.h.

On the other hand we have software such as www/qt5-webengine
that sets _POSIX_C_SOURCE and/or _XOPEN_SOURCE to older standards
that didn't specify those two errnos.

If anything, it is rather a "fault" of GCC's C++ header handling
than one of qt5-webengine.

Reported-by: tuxillo
2 years ago<signal.h>/<ucontext.h>: Split those two headers better.
Sascha Wildner [Sun, 15 Aug 2021 10:32:08 +0000 (12:32 +0200)]
<signal.h>/<ucontext.h>: Split those two headers better.

<signal.h> needs only ucontext_t and stack_t from <ucontext.h>. Split
those out to <sys/_ucontext.h> and stop including the full <ucontext.h>
from <signal.h> and vice versa, for userland.

In <ucontext.h>, continue defining siginfo_t for non-POSIX because
third party code expects us to.

This has been tested with a full dports bulk build.

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 15 Aug 2021 10:24:39 +0000 (12:24 +0200)]
Update the pciconf(8) database.

July 25, 2021 snapshot from https://pci-ids.ucw.cz

2 years ago<stdio.h>: Clean up the POSIX namespace better.
Sascha Wildner [Sat, 14 Aug 2021 00:51:31 +0000 (02:51 +0200)]
<stdio.h>: Clean up the POSIX namespace better.

* Include just <machine/stdint.h> for POSIX, but leave <sys/types.h>
  otherwise for the traditional expectations of third party code.

* POSIX did not require <stdio.h> to define off_t until Issue 7, even
  though ftello() and fseeko() were using it for a long time. This
  seems to be a "bug" in the specification, so adjust the visibility
  of off_t to match that of the functions. Actually use off_t for the
  ftello() and fseeko() prototypes.

Tested with a full bulk build.

2 years agoInclude <inttypes.h> instead of <cpu/inttypes.h> in world.
Sascha Wildner [Thu, 5 Aug 2021 07:20:01 +0000 (09:20 +0200)]
Include <inttypes.h> instead of <cpu/inttypes.h> in world.

Remove the unneeded inclusions otherwise.

2 years agolibc: Clean up the Symbol.maps a bit.
Sascha Wildner [Fri, 13 Aug 2021 23:49:08 +0000 (01:49 +0200)]
libc: Clean up the Symbol.maps a bit.

* Remove sysv_cond_wait and sysv_cond_signal because these functions
  were always static.

* Remove tre_have_approx because this function is only available with
  -DTRE_APPROX which we never used, nor build with right away.

* Remove pthread_init since there was never a pthread_init in libc.
  Seems to be just a typo.

* Remove mexitcount which was kernel only.

* Add a comment to a symbol that will only show up when libc is built
  with a debug option.

2 years agolibc: Clean up some kernel profiling bits.
Sascha Wildner [Sat, 14 Aug 2021 00:48:11 +0000 (02:48 +0200)]
libc: Clean up some kernel profiling bits.

2 years agohammer2 - bulkfree now validates bigmask
Matthew Dillon [Fri, 13 Aug 2021 01:41:54 +0000 (18:41 -0700)]
hammer2 - bulkfree now validates bigmask

* bulkfree now validates that the roll-up bigmask is reasonable
  and adjusts it if it is not.

* Add vfs.hammer2.aux_flags and implement a bigmask override with
  it that, if set, forces bigmask to -1 in the bulkfree.  Should
  not be needed now that bulkfree validates the field.

2 years agohammer2 - Only clear the bigmask hint in relaxed mode freemap scans
Matthew Dillon [Thu, 12 Aug 2021 22:52:25 +0000 (15:52 -0700)]
hammer2 - Only clear the bigmask hint in relaxed mode freemap scans

* When allocating blocks, the bigmask hint allows the allocator to
  skip sub-trees that are known to be fully allocated.  The bit for
  the appropriate radix (block size being allocated) is cleared when
  a full scan reveals no available blocks in the sub-tree.

* When the filesystem starts to fill up, there might not be any blocks
  in class-assigned sub-trees, but there could be blocks in the sub-trees
  for other classes.  Normally the allocator first tries to find a block
  in a matching class, and if that fails it tries to find a block in an
  unrelated class using a 'relaxed' freemap search.

  The bug is that the bigmask hint was being cleared for non-relaxed
  searches that failed, causing the later relaxed search to also fail
  even though blocks might be allocatable.

* Fixed by only clearing the bit when a full relaxed scan determines
  that no blocks are available.

2 years agoid(1): Fix buildworld.
Sascha Wildner [Thu, 12 Aug 2021 15:18:42 +0000 (17:18 +0200)]
id(1): Fix buildworld.

2 years agosbin/hammer2: Fix total_size inconsistency check
Tomohiro Kusumi [Tue, 10 Aug 2021 06:18:57 +0000 (15:18 +0900)]
sbin/hammer2: Fix total_size inconsistency check

This should be errx(). The ondisk total_size != sum of volumes
means total_size is corrupted or volume(s) missing, regardless of
<4 bad volume headers.

2 years agosbin/hammer2: Silence -Waddress-of-packed-member warnings
Tomohiro Kusumi [Mon, 9 Aug 2021 21:35:52 +0000 (06:35 +0900)]
sbin/hammer2: Silence -Waddress-of-packed-member warnings

Not a problem on x86_64, but silence warnings caused by callers
passing address of packed (possibly unaligned) struct fields.

2 years agoid: Add 'a' no-op option for compatibility with other implementations (Solaris)
Antonio Huete Jimenez [Tue, 10 Aug 2021 22:32:14 +0000 (00:32 +0200)]
id: Add 'a' no-op option for compatibility with other implementations (Solaris)

Taken-from: FreeBSD

2 years agotmpfs - Remove debugging kprintf()
Matthew Dillon [Mon, 9 Aug 2021 22:33:53 +0000 (15:33 -0700)]
tmpfs - Remove debugging kprintf()

* Remove the kprintf("tmpfs: vp %p sleepfail\n", vp), this
  case has been verified to occur in numerous situations and
  the code path is now considered to be tested.

2 years agokernel - Add a hold count to struct rman
Matthew Dillon [Mon, 9 Aug 2021 17:53:00 +0000 (10:53 -0700)]
kernel - Add a hold count to struct rman

* Add a hold count to protect against destruction, fixing a race
  between rman list iterations (the sysctl iteration) and device
  activity that adjusts the rman lists.

* Fixes a panic related to Firefox.

2 years agokernel - Workaround qemu bug w/ MSR_IA32_ARCH_CAPABILITIES
Matthew Dillon [Mon, 9 Aug 2021 17:45:53 +0000 (10:45 -0700)]
kernel - Workaround qemu bug w/ MSR_IA32_ARCH_CAPABILITIES

* qemu allows cpuid report that MSR_IA32_ARCH_CAPABILITIES exists, but
  then fails to implement the MSR.  This causes the kernel to panic
  in early boot.

* Use rdmsr_safe() and report the non-working msr instead of panicing.

* Fixes qemu + DFly on some recent Intel cpus.

refs #3292

2 years ago<errno.h>: Add ENOTRECOVERABLE and EOWNERDEAD.
Sascha Wildner [Sun, 8 Aug 2021 18:22:41 +0000 (20:22 +0200)]

These errno constants are really for robust mutexes which we do not
support. However, llvm seems to be abusing ENOTRECOVERABLE for other
purposes, so just add them both.

Reported-by: tuxillo
2 years agoAdd some necessary #include's in signal related headers.
Sascha Wildner [Sat, 7 Aug 2021 11:44:36 +0000 (13:44 +0200)]
Add some necessary #include's in signal related headers.

2 years agomkdep: Remove the old, never used mkdep.sh.
Sascha Wildner [Sun, 1 Aug 2021 19:06:49 +0000 (21:06 +0200)]
mkdep: Remove the old, never used mkdep.sh.

It was needed on some architectures supported by FreeBSD, which is how
we inherited it.

Rename the mkdep.gcc.sh to mkdep.sh and clean up the Makefile.

2 years agomount.8: Fix typo.
Sascha Wildner [Sat, 31 Jul 2021 18:22:58 +0000 (20:22 +0200)]
mount.8: Fix typo.

2 years agogdb.4/sysctl.9: Remove dead .Xr
Sascha Wildner [Sat, 31 Jul 2021 18:18:12 +0000 (20:18 +0200)]
gdb.4/sysctl.9: Remove dead .Xr

2 years agoSync ACPICA with Intel's version 20210730.
Sascha Wildner [Sat, 31 Jul 2021 08:43:23 +0000 (10:43 +0200)]
Sync ACPICA with Intel's version 20210730.

* Various fixes for iasl(8).

* Fixes and additions in table definitions.

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

2 years agondp(8): Use RT_ROUNDUP to correctly increase the position in the buffer.
Sascha Wildner [Fri, 30 Jul 2021 17:43:02 +0000 (19:43 +0200)]
ndp(8): Use RT_ROUNDUP to correctly increase the position in the buffer.

Submitted-by: James Cook (falsifian)
Dragonfly-bug: https://bugs.dragonflybsd.org/issues/3291

2 years agonvmm.4: Fix section order.
Sascha Wildner [Thu, 29 Jul 2021 15:36:09 +0000 (17:36 +0200)]
nvmm.4: Fix section order.

2 years agolibnvmm.3: Oops, forgot one .Cd correction.
Sascha Wildner [Thu, 29 Jul 2021 12:48:05 +0000 (14:48 +0200)]
libnvmm.3: Oops, forgot one .Cd correction.

2 years agolibnvmm.3: Fix .Cd misuse.
Sascha Wildner [Thu, 29 Jul 2021 12:46:30 +0000 (14:46 +0200)]
libnvmm.3: Fix .Cd misuse.

2 years agolibnvmm.3: Extend NAME section and add MLINKS for functions.
Sascha Wildner [Thu, 29 Jul 2021 08:06:34 +0000 (10:06 +0200)]
libnvmm.3: Extend NAME section and add MLINKS for functions.

2 years agonvmm: Some documentation adjustments.
Sascha Wildner [Thu, 29 Jul 2021 03:41:43 +0000 (05:41 +0200)]
nvmm: Some documentation adjustments.

* Fix '.Lb libnvmm' for mandoc(1).

* Use standard list in libnvmm.3's ERRORS section.

* Add a SYNOPSIS to nvmm.4.

* Use short form .Nm in nvmmctl.8.

2 years agoRevert "WIP"
Aaron LI [Wed, 28 Jul 2021 23:30:27 +0000 (07:30 +0800)]
Revert "WIP"

This reverts commit 5d4c71cc3f59393bac29819031ed5afcedda6359.

Oops, didn't intend to commit this...

2 years agoWIP
Aaron LI [Wed, 28 Jul 2021 11:08:35 +0000 (19:08 +0800)]

2 years agotest/nvmm/demo: Clean up header inclusions
Aaron LI [Wed, 28 Jul 2021 11:06:44 +0000 (19:06 +0800)]
test/nvmm/demo: Clean up header inclusions

* Remove unused header inclusions.
* Reorder header inclusions.
* Define MSR_APICBASE, APICBASE_BSP and APICBASE_EN locally to be more

2 years agotestcases/libnvmm: Remove unneeded header inclusions
Aaron LI [Wed, 28 Jul 2021 10:44:24 +0000 (18:44 +0800)]
testcases/libnvmm: Remove unneeded header inclusions

They are now provided by the <dev/virtual/nvmm/nvmm.h> header file.

2 years agolibnvmm: Remove unneeded header inclusions and defines
Aaron LI [Wed, 28 Jul 2021 10:41:18 +0000 (18:41 +0800)]
libnvmm: Remove unneeded header inclusions and defines

They are now provided by the <dev/virtual/nvmm/nvmm.h> header file.

2 years agonvmm: Adjust comments about TSC sync and gd_reqflags check
Aaron LI [Wed, 28 Jul 2021 10:37:22 +0000 (18:37 +0800)]
nvmm: Adjust comments about TSC sync and gd_reqflags check

Replace QEMU with a more generic "emulator", and adjust the comments
about TSC sync to be more consistent and concise.

2 years agonvmm: Move DragonFly-specific code to os_vmspace_create()
Aaron LI [Wed, 28 Jul 2021 10:30:22 +0000 (18:30 +0800)]
nvmm: Move DragonFly-specific code to os_vmspace_create()

Move the DragonFly-specific pmap code to os_vmspace_create() in
nvmm_dragonfly.c, making the nvmm.c code more OS-independent.

2 years agonvmmctl(8): Fix installing to a ${DESTDIR} on hosts without the nvmm group.
Sascha Wildner [Tue, 27 Jul 2021 13:55:52 +0000 (15:55 +0200)]
nvmmctl(8): Fix installing to a ${DESTDIR} on hosts without the nvmm group.

This affects building master ISO/IMGs on older hosts, or any other
such scenario involving a ${DESTDIR}. If the host's world is too old,
let install(1) use the databases (master.passwd, group) from the source

installworlds for the purpose of upgrading the machine without ${DESTDIR}
had the databases upgraded earlier in the install and are not affected.

2 years agoRevert "install(1): Disable -N option in btools."
Sascha Wildner [Tue, 27 Jul 2021 13:49:23 +0000 (15:49 +0200)]
Revert "install(1): Disable -N option in btools."

This reverts commit bf226617061340a3979d19957444da0997124229.

This is too useful to be missing.

2 years agosys/vfs/ext2fs: Fix incorrect VFS_VGET() argument in ext2_fhtovp()
Tomohiro Kusumi [Fri, 23 Jul 2021 16:34:50 +0000 (01:34 +0900)]
sys/vfs/ext2fs: Fix incorrect VFS_VGET() argument in ext2_fhtovp()

A bug introduced when porting from FreeBSD.

2 years agokernel/nvmm: Fix doing just 'make depend' in the module directory.
Sascha Wildner [Fri, 23 Jul 2021 14:49:41 +0000 (16:49 +0200)]
kernel/nvmm: Fix doing just 'make depend' in the module directory.

*_if.h and opt_*.h have to be generated before assym.s.

2 years agokernel - Rename vm_map_wire() and vm_map_unwire() (3)
Aaron LI [Fri, 23 Jul 2021 13:03:36 +0000 (21:03 +0800)]
kernel - Rename vm_map_wire() and vm_map_unwire() (3)

Remove a now obsolete comment.

2 years agokernel - Rename vm_map_wire() and vm_map_unwire() (2)
Matthew Dillon [Fri, 23 Jul 2021 05:18:07 +0000 (22:18 -0700)]
kernel - Rename vm_map_wire() and vm_map_unwire() (2)

* Deconfuse comment

2 years agokernel - Rename vm_map_wire() and vm_map_unwire()
Matthew Dillon [Fri, 23 Jul 2021 04:44:00 +0000 (21:44 -0700)]
kernel - Rename vm_map_wire() and vm_map_unwire()

* These names are mutant throwbacks to an earlier age and no
  longer mean what is implied.

* Rename vm_map_wire() to vm_map_kernel_wiring().  This function can
  wire and unwire VM ranges in a vm_map under kernel control.  Userland
  has no say.

* Rename vm_map_unwire() to vm_map_user_wiring().  This function can
  wire and unwire VM ranges in a vm_map under user control.  Userland
  can adjust the user wiring state for pages.

2 years agokernel - Correct flags argument to vm_map_wire() (no operational change)
Matthew Dillon [Fri, 23 Jul 2021 04:34:03 +0000 (21:34 -0700)]
kernel - Correct flags argument to vm_map_wire() (no operational change)

* vm/vm_unix.c was making two calls to vm_map_wire() passing FALSE for
  kmflags.  It needs to pass 0 here, not FALSE.  Same value, less

Reported-by: aly
2 years agosys/vfs/hammer2: Fix bulkfree message/comments on old ondisk format
Tomohiro Kusumi [Thu, 22 Jul 2021 17:09:34 +0000 (02:09 +0900)]
sys/vfs/hammer2: Fix bulkfree message/comments on old ondisk format

in addition to b0ac2d2999bc7ac111dbb5ffbc0f7ffbb4c92988.
The bulkfree descriptions written in 2015 or before were not uptodate
with the current ondisk spec.

freemap leaf block: 64KB -> 32KB (out of 64KB)
freemap level0: 2MB -> 4MB
freemap level1: 2GB -> 1GB

2 years agosys/vfs/hammer2: Fix "2MB segs cleaned" message to 4MB
Tomohiro Kusumi [Wed, 21 Jul 2021 17:54:33 +0000 (02:54 +0900)]
sys/vfs/hammer2: Fix "2MB segs cleaned" message to 4MB

HAMMER2_FREEMAP_LEVEL0_RADIX was 21 (now 22) when this message
first appeared in d0fcd3ec4a1cbbfa32581cf24ecd6f3509f1f57c in 2015.

2 years agosys/vfs/hammer2: Rename hammer2_bulk_scan() to hammer2_bulkfree_scan()
Tomohiro Kusumi [Wed, 21 Jul 2021 16:03:28 +0000 (01:03 +0900)]
sys/vfs/hammer2: Rename hammer2_bulk_scan() to hammer2_bulkfree_scan()

Sync with function name in kprintf messages.
This was also the only function without "free" prefix.

2 years agosys/vfs/hammer2: Remove unused hammer2_bulkfree_info::saved_mirror_tid
Tomohiro Kusumi [Wed, 21 Jul 2021 15:22:00 +0000 (00:22 +0900)]
sys/vfs/hammer2: Remove unused hammer2_bulkfree_info::saved_mirror_tid

No longer used since c8c0a18a66946d3ec5fd24de73f593da9c4af6ba in 2017.

2 years agosys/vfs/hammer2: Remove unused hammer2_chain_save::pri
Tomohiro Kusumi [Wed, 21 Jul 2021 15:04:10 +0000 (00:04 +0900)]
sys/vfs/hammer2: Remove unused hammer2_chain_save::pri

Never used since first appeared in 125966e80c1aba734d3d5f12a8fcfde2bbcdb018 in 2015.

2 years agonvmm: Fix building nvmm into kernel
Aaron LI [Wed, 21 Jul 2021 06:53:38 +0000 (14:53 +0800)]
nvmm: Fix building nvmm into kernel

* Remove 'DIAGNOSTIC' define from 'nvmm_os.h'.  First, 'DIAGNOSTIC' and
  'INVARIANTS' are different options.  Secondly, 'DIAGNOSTIC' should be
  defined in kernel configs, e.g., LINT64 defines it.
* Remove 'LOCORE' define from 'nvmm_x86_{svmfunc,vmxfunc}.S'.  It's
  already defined on the command line, when compiling ASM source files
  with the kernel (i.e., building the module into the kernel).
* Manually define 'LOCORE' for 'nvmm_x86_{svmfunc,vmxfunc}.o'
  compilation in the Makefile, fixing building as a standalone module.

This fixes building nvmm into kernel, like LINT64.

Thanks swildner for reporting the issue and helping with the fix.

2 years agosyslogd(8): Fix klog may be broken into multiple incomplete lines
Aaron LI [Mon, 19 Jul 2021 23:33:33 +0000 (07:33 +0800)]
syslogd(8): Fix klog may be broken into multiple incomplete lines

Fix readklog() to not emit partial lines by changing it to use a static
buffer for reading log lines from /dev/klog.  Thus we can make it
only emit the line for printing if there is a complete line.

This fixes the issue that a kernel log line may be broken into multiple
incomplete lines that are written into log file by syslogd(8),
especially when the system is under load.

Patch-by: Matt Dillon
2 years agonvmm: Fix comm page unmapping issue by doing it on userland side
Aaron LI [Tue, 20 Jul 2021 11:47:38 +0000 (19:47 +0800)]
nvmm: Fix comm page unmapping issue by doing it on userland side

Previously, we're mapping and unmapping the comm page for userland
process both on the kernel side.  The unmapping was called at the point
of closing the fd.

However, the kernel may destroy process' vmspace before or after closing
the fd, so there is no guarantee that kernel can get the correct address
space to unmap the comm page for the userland process.  Therefore, do
the comm page unmapping on the userland side in libnvmm to fix the above

In addition, add the 'comm_size' member to 'struct nvmm_capability' to
expose the comm page size to userland, which is required for the
unmapping operation.  This breaks ABI, so bump NVMM_KERN_VERSION.
Update nvmmctl(8) accordingly to print the comm page size.

This commit partially reverts:
"nvmm: Add missing comm page unmapping"

2 years agonvmm: Add back NetBSD bits
Aaron LI [Sun, 18 Jul 2021 12:03:57 +0000 (20:03 +0800)]
nvmm: Add back NetBSD bits

Bring back the NetBSD bits lost during the porting.  One minor change is
required: MODULE_CLASS_MISC -> MODULE_CLASS_DRIVER.  Otherwise, loading
nvmm.kmod would fail with error:

module error: incompatible module class 1 for `nvmm' (wanted 3)

Now the same code builds and works on NetBSD (of course, NetBSD requires
a different set of Makefiles).

2 years agonvmm: Move DragonFly module code in nvmm.c to nvmm_dragonfly.c
Aaron LI [Sun, 18 Jul 2021 10:58:01 +0000 (18:58 +0800)]
nvmm: Move DragonFly module code in nvmm.c to nvmm_dragonfly.c

Move the OS-specific DragonFly module code in nvmm.c to nvmm_dragonfly.c,
making nvmm.c source file more OS-independent.  Adjust several static
functions and variables for this purpose.