dragonfly.git
2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 17 Apr 2022 10:08:37 +0000 (12:08 +0200)]
Update the pciconf(8) database.

April 16, 2022 snapshot from https://pci-ids.ucw.cz

2 years agolibkern: Import timingsafe_bcmp() from FreeBSD
Aaron LI [Fri, 15 Apr 2022 14:35:27 +0000 (22:35 +0800)]
libkern: Import timingsafe_bcmp() from FreeBSD

Will be used by WireGuard.

Obtained-from: FreeBSD

2 years agocallout.9: Multiple minor fixes
Aaron LI [Fri, 15 Apr 2022 13:52:09 +0000 (21:52 +0800)]
callout.9: Multiple minor fixes

* Fix prototype of callout_init(); it has only one argument.
  (reported-by: dczheng)
* Fix '.Dt' to 'CALLOUT'
* Use 'function' instead of 'macro'; those are really functions and the
  'function' reads more generic.
* Mention callout_cancel() in 'RETURN VALUES' section.
* Other styles and words adjustments.

2 years agobsd-family-tree: Sync with FreeBSD.
Sascha Wildner [Tue, 5 Apr 2022 12:13:18 +0000 (14:13 +0200)]
bsd-family-tree: Sync with FreeBSD.

2 years agosys/conf/files: Remove duplicate line.
Sascha Wildner [Fri, 1 Apr 2022 21:14:41 +0000 (23:14 +0200)]
sys/conf/files: Remove duplicate line.

2 years agoMark up defined values better in some manual pages.
Sascha Wildner [Mon, 28 Mar 2022 14:18:44 +0000 (16:18 +0200)]
Mark up defined values better in some manual pages.

2 years agokvm_open.3: Improve markup a bit.
Sascha Wildner [Mon, 28 Mar 2022 14:12:04 +0000 (16:12 +0200)]
kvm_open.3: Improve markup a bit.

2 years agolibc: Adjust comment in Versions.def.
Sascha Wildner [Wed, 23 Mar 2022 17:21:19 +0000 (18:21 +0100)]
libc: Adjust comment in Versions.def.

2 years agoprintf(3)/scanf(3): Make ll and L length modifiers equivalent.
Sascha Wildner [Mon, 21 Mar 2022 08:29:17 +0000 (09:29 +0100)]
printf(3)/scanf(3): Make ll and L length modifiers equivalent.

POSIX defines L only for floating point numbers (long double) and ll only
for integer numbers (long long), leaving for example %Ld or %llg
undefined. GCC allows these non-portable combinations as an extension,
i.e. -Wformat will not warn about them unless -pedantic is passed.

To avoid surprises with Linux code, go with glibc and make ll and L
equivalent. For base code, we still prefer going with the standard, of
course.

Interestingly, the alternate printf(3) implementation in libc (enabled
by defining USE_XPRINTF in the environment) already treats them equally.

In-discussion-with: zrj

2 years agolibc_rtld: Reduce the amount of libc code that we compile into it.
Sascha Wildner [Sun, 20 Mar 2022 00:46:52 +0000 (01:46 +0100)]
libc_rtld: Reduce the amount of libc code that we compile into it.

2 years agoFix some 'any more' vs. 'anymore' confusion in manpages and messages.
Sascha Wildner [Sat, 19 Mar 2022 08:58:42 +0000 (09:58 +0100)]
Fix some 'any more' vs. 'anymore' confusion in manpages and messages.

2 years agohammer2 - Fix panic related to usb stick pull on mounted H2 filesystem
Matthew Dillon [Fri, 18 Mar 2022 18:34:40 +0000 (11:34 -0700)]
hammer2 - Fix panic related to usb stick pull on mounted H2 filesystem

* Fixes at least one panic related to unexpected USB stick pulls.
  There may be others.

Reported-by: Donald Allen
2 years agoSync zoneinfo database with tzdata2022a from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Fri, 18 Mar 2022 17:56:26 +0000 (18:56 +0100)]
Sync zoneinfo database with tzdata2022a from ftp://ftp.iana.org/tz/releases

* Palestine will spring forward on 2022-03-27, not 2022-03-26.

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

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Wed, 16 Mar 2022 19:24:14 +0000 (20:24 +0100)]
Update the pciconf(8) database.

March 14, 2022 snapshot from https://pci-ids.ucw.cz

2 years agoLocal changes for file-5.41.
Sascha Wildner [Sun, 13 Mar 2022 10:36:54 +0000 (11:36 +0100)]
Local changes for file-5.41.

2 years agoMerge branch 'vendor/FILE'
Sascha Wildner [Sun, 13 Mar 2022 10:33:13 +0000 (11:33 +0100)]
Merge branch 'vendor/FILE'

2 years agovendor/file: upgrade from 5.40 to 5.41
Sascha Wildner [Sun, 13 Mar 2022 10:32:44 +0000 (11:32 +0100)]
vendor/file: upgrade from 5.40 to 5.41

For details, see ChangeLog.

2 years agohammer2 - Fix excess chain structure allocations during bulkfree (3)
Matthew Dillon [Sat, 12 Mar 2022 01:18:38 +0000 (17:18 -0800)]
hammer2 - Fix excess chain structure allocations during bulkfree (3)

* Fix excess chain structure allocations during bulkfree, AGAIN.
  This time for real.  The algorithmic change I made was not sufficient,
  because I was not backing-out the recursion all the way after hitting
  a deferral.  Instead, the code was re-recursing down another branch
  while still really deep into the tree.

  The problem was mostly triggered on the inode radix tree for filesystems
  containing many inodes (like a hundred million inodes), and would lead
  to a kmalloc panic due to memory exhaustion.

* Fixed for real this time.  When we hit the recursion limit, the code
  fully backs out of the traversal (recording its placemarkers on the way
  back up), then starts again at the deepest placemarker rather than
  the shallowest placemarker.

2 years agokernel - provide more information on crital section count mismatch panics
Matthew Dillon [Sat, 12 Mar 2022 01:17:06 +0000 (17:17 -0800)]
kernel - provide more information on crital section count mismatch panics

* Provide more information on crital section count mismatch panics.
  Include which system call number was involved, as this data might
  be lost in crash dumps due to compiler optimizations.

2 years agoipfw - Fix broken mixed network and host IP specifications in ip tables
Matthew Dillon [Sat, 12 Mar 2022 01:09:48 +0000 (17:09 -0800)]
ipfw - Fix broken mixed network and host IP specifications in ip tables

* ipfw improperly assumes that the netmask sin_len is pre-zero'd, but
  prior table entries on the same command line which specify a network
  mask will leave the field non-zero for later host entries also specified
  on the command line:

        ipfw table 1 add 10.0.0.0/8 192.0.2.1     # 2^24 + 1 addresses

# ipfw table 1 print
10.0.0.0/8
192.0.0.0/8 <--- wrong

* Fix the issue by properly initializing netmask.sin_len to 0 when a
  host IP is specified.

Submitted-by: Martin Neitzel <neitzel@marshlabs.gaertner.de>
2 years agoedk2: Sync our TianoCore EDK II headers with the edk2-stable202202 tag.
Sascha Wildner [Wed, 2 Mar 2022 16:30:59 +0000 (17:30 +0100)]
edk2: Sync our TianoCore EDK II headers with the edk2-stable202202 tag.

2 years agomount_msdos - Add /dev prefix if necessasry
Matthew Dillon [Wed, 23 Feb 2022 21:50:12 +0000 (13:50 -0800)]
mount_msdos - Add /dev prefix if necessasry

* Automatically add the /dev prefix if a relative device path is
  specified.  For example 'vn0' turns into '/dev/vn0'.

* Fixes gpt init sequences that short-hand the device.

Reported-by: ferz
2 years agosys/vfs/hammer2: Mostly trailing whitespace cleanups
Tomohiro Kusumi [Mon, 21 Feb 2022 16:10:05 +0000 (01:10 +0900)]
sys/vfs/hammer2: Mostly trailing whitespace cleanups

2 years agolpr.1: Tweak a bit about '-i' option
Aaron LI [Sat, 19 Feb 2022 09:53:05 +0000 (17:53 +0800)]
lpr.1: Tweak a bit about '-i' option

I made a mistake so that I lost this change in a rebase...

Reviewed-by: swildner
2 years agolpr(1): Fix '-i' option with optional argument
Aaron LI [Sat, 19 Feb 2022 09:53:05 +0000 (17:53 +0800)]
lpr(1): Fix '-i' option with optional argument

lpr(1)'s '-i' option accepts an optional argument, but the
implementation was incomplete.  For example, 'lpr -i -#3' errors with:
'Bad argument to -i, number expected'.

However, because the argument to '-i' option can have a leading white
space (i.e., '-i 4'), we can't use getopt(3)'s new 'option::' feature
here.  Fix the code in another way inspired by dma(8) (see
'libexec/dma/dma.c').

In addition, update the usage text as well as the man page.

2 years agogetopt.3: Clarify option string syntax
Aaron LI [Sat, 19 Feb 2022 09:36:13 +0000 (17:36 +0800)]
getopt.3: Clarify option string syntax

The recently added 'option::' syntax requires the following argument
(if present) *must* be in the same word as the option name itself
(e.g., "-x<arg>").  This is different than the normal 'option:' syntax,
for which the argument may have a leading white space (e.g., "-x <arg>").
Update the man page to explicitly describe the syntax.

Update to use a list to describe the 3 types of option string syntaxes
with examples.

2 years agosys/vfs/hammer2: Fix hammer2_chain_allocs calculation
Tomohiro Kusumi [Fri, 18 Feb 2022 17:12:38 +0000 (02:12 +0900)]
sys/vfs/hammer2: Fix hammer2_chain_allocs calculation

This counter should be decremented on freeing chains.
Currently it gets incremented on chain allocation,
but only decremented via bulkfree path.

2 years agosys/vfs/msdosfs: Fix mounting when the device sector size is >512B
Tomohiro Kusumi [Fri, 18 Feb 2022 17:10:06 +0000 (02:10 +0900)]
sys/vfs/msdosfs: Fix mounting when the device sector size is >512B

HugeSectors * BytesPerSec should be computed before converting
HugeSectors to a DEV_BSIZE-based count.

taken-from FreeBSD c7cd607a4e28233ab6679ee330c0a4836414bb0a

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 17 Feb 2022 20:38:39 +0000 (21:38 +0100)]
Update the pciconf(8) database.

February 13, 2022 snapshot from https://pci-ids.ucw.cz

2 years agogetopt.3: Fix date
Aaron LI [Wed, 16 Feb 2022 23:02:54 +0000 (07:02 +0800)]
getopt.3: Fix date

Reported-by: swildner
2 years agodate(1): Add '-I' flag to output in ISO 8601 format
Aaron LI [Wed, 16 Feb 2022 10:42:30 +0000 (18:42 +0800)]
date(1): Add '-I' flag to output in ISO 8601 format

The '-I' flag accepts arguments of 'date', 'hours', 'minutes', and
'seconds', and makes date(1) output the date in ISO 8601 format.

This change is derived from FreeBSD (revision 337332).

2 years agogetopt(3): Recognize 'option::' for optional argument
Aaron LI [Wed, 16 Feb 2022 06:31:36 +0000 (14:31 +0800)]
getopt(3): Recognize 'option::' for optional argument

If the option is followed by two colons, then the option argument is
optional.  This is a GNU extension.

Obtained from NetBSD via FreeBSD (revision 267745).

2 years ago<sys/queue.h>: Actually add the LIST_FOREACH_FROM() macro.
Sascha Wildner [Wed, 16 Feb 2022 07:20:23 +0000 (08:20 +0100)]
<sys/queue.h>: Actually add the LIST_FOREACH_FROM() macro.

In 126d17a8153d7bf91b9378b6d8b431448c527303, I had accidentally copied
over the definition of LIST_FOREACH() again.

2 years agoFix AUTHORS sections without .An in various manual pages.
Sascha Wildner [Tue, 15 Feb 2022 20:27:51 +0000 (21:27 +0100)]
Fix AUTHORS sections without .An in various manual pages.

2 years agosys/vfs/hammer2: Whitespace fixes
Tomohiro Kusumi [Tue, 15 Feb 2022 15:32:33 +0000 (00:32 +0900)]
sys/vfs/hammer2: Whitespace fixes

Also fix hammer2_unmount_helper() comment "Mount helper" -> "Unmount helper".

2 years agoRemove unneeded .Ns macros in various manual pages.
Sascha Wildner [Mon, 14 Feb 2022 20:58:14 +0000 (21:58 +0100)]
Remove unneeded .Ns macros in various manual pages.

2 years agopthread_{attr_,}setaffinity_np.3: Fix section number in .Dt
Sascha Wildner [Mon, 14 Feb 2022 19:20:56 +0000 (20:20 +0100)]
pthread_{attr_,}setaffinity_np.3: Fix section number in .Dt

2 years agosh.1: Remove unneeded .Pp
Sascha Wildner [Mon, 14 Feb 2022 19:20:05 +0000 (20:20 +0100)]
sh.1: Remove unneeded .Pp

2 years agoFix "macro neither callable nor escaped" mandoc warnings in the manpages.
Sascha Wildner [Mon, 14 Feb 2022 19:07:18 +0000 (20:07 +0100)]
Fix "macro neither callable nor escaped" mandoc warnings in the manpages.

Some of these were affecting the output.

2 years ago<sys/queue.h>: Add _FOREACH_FROM and _FOREACH_FROM_MUTABLE macros.
Sascha Wildner [Wed, 9 Feb 2022 21:36:27 +0000 (22:36 +0100)]
<sys/queue.h>: Add _FOREACH_FROM and _FOREACH_FROM_MUTABLE macros.

Useful for dports.

Taken-from:  FreeBSD
Reported-by: zrj
2 years agosys.mk: Use an absolute path for sysctl(8).
Sascha Wildner [Wed, 9 Feb 2022 21:35:45 +0000 (22:35 +0100)]
sys.mk: Use an absolute path for sysctl(8).

At least graphics/rayshade uses it in an environment where /sbin is
not in the $PATH.

Reported-by: zrj
2 years agosys/vfs/ext2fs: Improve extents verification logic (partial)
Tomohiro Kusumi [Wed, 9 Feb 2022 15:45:06 +0000 (00:45 +0900)]
sys/vfs/ext2fs: Improve extents verification logic (partial)

Sync with ext2fs/ext2_inode_cnv.c part of diff.
Other diff hunks are for ext4 extents which isn't supported yet.

taken from FreeBSD f1d5e2c862ef599efd1705b04d505d5415b77f82

2 years ago<machine/endian.h>: Provide __FLOAT_WORD_ORDER too
zrj [Wed, 9 Feb 2022 04:52:22 +0000 (04:52 +0000)]
<machine/endian.h>: Provide __FLOAT_WORD_ORDER too

 Allows some ports to make use of internal representations.

2 years agosys/vfs/ext2fs: Add more accurate check for root inode
Tomohiro Kusumi [Tue, 8 Feb 2022 15:46:33 +0000 (00:46 +0900)]
sys/vfs/ext2fs: Add more accurate check for root inode

Check that root inode has links and is directory.

taken from FreeBSD ced21728223016429242d1f7cd5e8a160c8a88cb

2 years agosys/vfs/ext2fs: Add more accurate directory entries check
Tomohiro Kusumi [Tue, 8 Feb 2022 15:20:08 +0000 (00:20 +0900)]
sys/vfs/ext2fs: Add more accurate directory entries check

Rename ext2_dirbadentry() to ext2_check_direntry(). Add directory
entry inode value check, and call ext2_check_direntry() in all cases.
The dirchk sysctl is removed.

taken from FreeBSD bb9f1ba4b55c1f566d59cc7c7d1d28dd37715984

2 years agosys/vfs/ext2fs: Remove unnecessary e2fs_first_dblock value check
Tomohiro Kusumi [Tue, 8 Feb 2022 15:32:14 +0000 (00:32 +0900)]
sys/vfs/ext2fs: Remove unnecessary e2fs_first_dblock value check

taken from FreeBSD 5034b44574c44d50bcb5fadec1d6aae152855bc0

2 years agosys/vfs/ext2fs: Fix a few common typos in source code comments
Tomohiro Kusumi [Mon, 7 Feb 2022 16:01:22 +0000 (01:01 +0900)]
sys/vfs/ext2fs: Fix a few common typos in source code comments

- s/quadradically/quadratically/

taken-from FreeBSD 8ea3ceda7644b7b93532d0c31b50ac5fa61e51a3

2 years agousr.sbin/makefs: Fix a few typos in source code comments
Tomohiro Kusumi [Mon, 7 Feb 2022 15:36:15 +0000 (00:36 +0900)]
usr.sbin/makefs: Fix a few typos in source code comments

- s/concearned/concerned/
- s/quadradically/quadratically/

taken-from FreeBSD 164fa411b9244ce3f4ae0d6f17a7f64f6b9ee941

2 years agosys/vfs/msdosfs: Plug the rest of undef behavior places
Tomohiro Kusumi [Fri, 4 Feb 2022 16:12:08 +0000 (01:12 +0900)]
sys/vfs/msdosfs: Plug the rest of undef behavior places

There are three more places in msdosfs_fat.c which might shift one
into the sign bit.  While there, fix formatting of KASSERTs.

taken-from FreeBSD 53fcc6c96090f03c35d5e3dd4c6d0e6652c4404c

2 years agosys/vfs/msdosfs: denode some style
Tomohiro Kusumi [Thu, 3 Feb 2022 15:34:16 +0000 (00:34 +0900)]
sys/vfs/msdosfs: denode some style

taken-from FreeBSD d51b0786a2f60c3d188cae812cc0a3e0ab1a9893

2 years agosys/vfs/msdosfs: Sanity check sector count from BPB
Tomohiro Kusumi [Wed, 2 Feb 2022 15:59:42 +0000 (00:59 +0900)]
sys/vfs/msdosfs: Sanity check sector count from BPB

taken-from FreeBSD ba2c98389b78b548aedac0be53121df909c3fe2f

2 years agosys/vfs/msdosfs: Do no allow lookup to return vdp except for dot lookups
Tomohiro Kusumi [Wed, 2 Feb 2022 15:10:09 +0000 (00:10 +0900)]
sys/vfs/msdosfs: Do no allow lookup to return vdp except for dot lookups

taken-from FreeBSD aec97963cd03f10e04083537ed449a84a5e42f87

2 years agosys/vfs/msdosfs: Handle a case when non-dot lookup returned dvp
Tomohiro Kusumi [Tue, 1 Feb 2022 16:49:57 +0000 (01:49 +0900)]
sys/vfs/msdosfs: Handle a case when non-dot lookup returned dvp

This means that filesystem is corrupted, there is a loop.

taken-from FreeBSD 1319c433f4e5d67f8ea6fd2369c604069f733c94

2 years agosys/vfs/msdosfs: Take inusemap inconsistency as an error, not invariants violation
Tomohiro Kusumi [Tue, 1 Feb 2022 16:23:17 +0000 (01:23 +0900)]
sys/vfs/msdosfs: Take inusemap inconsistency as an error, not invariants violation

In other words, stop silently accepting freeing free cluster in
non-debug kernels, but return the error to the caller.  Modify callers
to handle errors from usemap_free().

taken-from FreeBSD 2c9a1c22c323b069d1f4883170349545c94b7b8d

2 years agosys/vfs/msdosfs: mountmsdosfs() some style
Tomohiro Kusumi [Mon, 31 Jan 2022 15:23:08 +0000 (00:23 +0900)]
sys/vfs/msdosfs: mountmsdosfs() some style

taken-from FreeBSD 04fd468da0d0baea535da418b92df74101a9659d

2 years agokernel - Fix namecache issue that can slow systems down over time
Matthew Dillon [Sun, 30 Jan 2022 18:42:11 +0000 (10:42 -0800)]
kernel - Fix namecache issue that can slow systems down over time

* Fix a serious dead-record issue with the namecache.

  It is very common to create a blah.new file and then rename it over
  an existing file, say, blah.jpg, in order to atomically replace the
  existing file.  Such rename-over operations can cause up to
  (2 * maxvnodes) dead dead namecache records to build up on a
  single hash slot's list.

* Over time, this could result in over a million records on a single
  hash slot's list which is often scanned during namecache lookups,
  causing the kernel to turn into a sludge-pile.

  This was not a memory leak per-say, the kernel still cleans excess
  structures (above 2 * maxvnodes) up, but that just maintains the
  status-quo and leaves the system in a slow, poorly-responsive state.

* Fixed by proactively deleting matching dead entries during namecache
  lookups.  The 'live' record is typically at the beginning of the list.
  So to fix, the namecache lookup now scans the list for the hash slot
  backwards and attempts to dispose of dead records.

2 years agousr.sbin/makefs: Remove set but not used variables
Tomohiro Kusumi [Sun, 30 Jan 2022 15:07:01 +0000 (00:07 +0900)]
usr.sbin/makefs: Remove set but not used variables

These were leftovers from the port from NetBSD (where they are used).

taken-from FreeBSD 093cf790569775b80662926efea6d9d3464bde94

2 years agomsdosfs: clusterfree() is used only in error handling cases
Tomohiro Kusumi [Sun, 30 Jan 2022 14:30:07 +0000 (23:30 +0900)]
msdosfs: clusterfree() is used only in error handling cases

Change its return type to void, because its result is ignored in both
call sites.  Remove oldcnp argument as well, it is NULL always.

taken-from FreeBSD 65990b68a2cd89a08f0350e187df1968b16f4255

2 years agolibc: Add strerror_l() (taken from FreeBSD).
Sascha Wildner [Sun, 30 Jan 2022 01:18:39 +0000 (02:18 +0100)]
libc: Add strerror_l() (taken from FreeBSD).

Reported-by: zrj
2 years ago<sys/param.h>: Add missing whitespace.
Sascha Wildner [Sun, 30 Jan 2022 00:36:28 +0000 (01:36 +0100)]
<sys/param.h>: Add missing whitespace.

2 years agolibc: Fix building without YP.
Sascha Wildner [Sat, 29 Jan 2022 23:26:52 +0000 (00:26 +0100)]
libc: Fix building without YP.

2 years agolibc: Remove libc checks around manual pages from the Makefile.inc's.
Sascha Wildner [Sat, 29 Jan 2022 23:15:08 +0000 (00:15 +0100)]
libc: Remove libc checks around manual pages from the Makefile.inc's.

Handle this better by setting NOMAN for libc_rtld.

2 years agosys/vfs/hammer2: Add hammer2_ prefixed spin_[un]lock_update()
Tomohiro Kusumi [Thu, 27 Jan 2022 16:03:32 +0000 (01:03 +0900)]
sys/vfs/hammer2: Add hammer2_ prefixed spin_[un]lock_update()

like any other spin lock variants.

2 years agosys/vfs/hammer2: Use hammer2_ prefixed spin_init() for portability
Tomohiro Kusumi [Thu, 27 Jan 2022 16:02:36 +0000 (01:02 +0900)]
sys/vfs/hammer2: Use hammer2_ prefixed spin_init() for portability

2 years ago<sys/elf_common.h>: Use standard types, like the rest of the elf headers.
Sascha Wildner [Wed, 26 Jan 2022 10:48:17 +0000 (11:48 +0100)]
<sys/elf_common.h>: Use standard types, like the rest of the elf headers.

2 years agokernel - Fix sysv semaphore panic
Matthew Dillon [Tue, 25 Jan 2022 22:33:55 +0000 (14:33 -0800)]
kernel - Fix sysv semaphore panic

* Fix an exit race related to lingering sysv semaphores which can sometimes
  cause a kernel panic.

Reported-by: zrj
2 years agosys/vfs/hammer2: Add missing hammer2_spin_init() for chain core
Tomohiro Kusumi [Mon, 24 Jan 2022 16:10:10 +0000 (01:10 +0900)]
sys/vfs/hammer2: Add missing hammer2_spin_init() for chain core

This happened to be harmless, as all it does is zero initialize
some fields that are already zero.
Other spinlocks are explicitly initialized.

2 years agosys/vfs/hammer2: Remove wrong comments in hammer2_chain_core_init()
Tomohiro Kusumi [Sun, 23 Jan 2022 17:00:18 +0000 (02:00 +0900)]
sys/vfs/hammer2: Remove wrong comments in hammer2_chain_core_init()

No such arguments *trans, *nchain, *ochain since
da6f36f44bb9c76612e31b56cdfe4d787e53d61f in 2014 and
23c7c7dd4e59da5bdb6ffa7fe2074c5b7ffe5e4f in 2015.

2 years agokernel - Fix ktrace's handling of system call return values
Matthew Dillon [Mon, 24 Jan 2022 06:02:56 +0000 (22:02 -0800)]
kernel - Fix ktrace's handling of system call return values

* Distinguish between int and long returns, properly recording
  long returns (e.g. lseek(), mmap(), read(), write(), etc).
  kdump will then display the correct return value instead of a truncated
  return value for the affected system calls.

* Involves including a return value type width in the sysent and adjusting
  the generator to calculate it.

2 years agolibc - Increase opendir/readdir buffer size
Matthew Dillon [Mon, 24 Jan 2022 06:01:50 +0000 (22:01 -0800)]
libc - Increase opendir/readdir buffer size

* Increase the directory scan buffer size from 4096 bytes to 16384
  bytes, significantly reducing the number of discrete system calls
  which must be made when scanning very large directories.

2 years agotmpfs - Fix readdir() races
Matthew Dillon [Mon, 24 Jan 2022 05:55:44 +0000 (21:55 -0800)]
tmpfs - Fix readdir() races

* Fix multi-threaded deletion races against readdir().  These races
  can cause a directory scan in one thread to return EINVAL if the
  file representing the chaining cookie is deleted by another thread.

  Fix the issue by allowing tmpfs_dir_lookupbycookie() to return the
  nearest directory entry with a cookie >= the requested cookie.

* Use a better cookie value for EOF

* Allow readdir() to fail on "." or "..".  Instead just iterate to
  the next entry.  This can occur when a directory is deleted out
  from under a scan that has chdir()'d into it.

* tmpfs was previously rescanning all entries to locate a cookie,
  which is rather dumb given that we have a RB tree.  Do a proper
  iterative recursive search instead.

Reported-by: zrj, others
2 years agohammer2 - Fix excess chain structure allocations during bulkfree (2)
Matthew Dillon [Fri, 14 Jan 2022 20:55:36 +0000 (12:55 -0800)]
hammer2 - Fix excess chain structure allocations during bulkfree (2)

Try to fix this again.  The last attempt failed.  Basically the
problem is that when the depth-first traversal gets too deep, it
has to defer the node at that point by adding it to a list.

* Change the order to insert deferrals on the head instead of the
  tail in order to exhaust the most recently deferred sub-tree as
  quickly as possible (LIFO order).  We previously exhausted deferred
  sub-trees in FIFO order but this often resulted in multiple levels
  of the radix tree building up on the list, which could blow-up
  memory use.

* Once the list limit is reached (well, really 1/4 of the list limit),
  we previously continued to accumulate deferral as long as the
  relative depth was less then 3.  Unfortunately, the maximum radix
  tree table size of roughly 512 elements could cause the number
  of deferrals even after the limit was reached to be up to
  134 million chains (512 * 512 * 512).

  This is fixed by removing any depth test when the list limit is
  exhausted.

* This combination of fixes should prevent the number of deferrals
  from blowing out hammer2's kmalloc pool.  Theoretically the
  worst-case possible deferrals should now be 512 chains x max depth
  of radix tree.  A very reasonable number.

2 years agosysctl.3: Adjust for pageout daemon algo changes from last year.
Sascha Wildner [Thu, 20 Jan 2022 21:43:54 +0000 (22:43 +0100)]
sysctl.3: Adjust for pageout daemon algo changes from last year.

Taken-from: dillon's commit message

2 years agoUpdate the pciconf(8) database.
Sascha Wildner [Wed, 19 Jan 2022 15:13:12 +0000 (16:13 +0100)]
Update the pciconf(8) database.

January 13, 2022 snapshot from https://pci-ids.ucw.cz

2 years agovnconfig.8: Mention comment lines in the configuration file.
Sascha Wildner [Wed, 19 Jan 2022 05:51:20 +0000 (06:51 +0100)]
vnconfig.8: Mention comment lines in the configuration file.

2 years agobuild - Update pkg-static to version 04
Antonio Huete Jimenez [Mon, 17 Jan 2022 22:09:55 +0000 (23:09 +0100)]
build - Update pkg-static to version 04

  - Should fix a problem with the metadata versioning.

    pkg-static: repository meta has wrong version 2
    pkg-static: Repository Avalon load error: meta cannot be loaded
    Undefined error: 0

2 years agoAdd the auto-bound IPv6 address to the wildcard hash
YONETANI Tomokazu [Fri, 5 Nov 2021 00:37:39 +0000 (09:37 +0900)]
Add the auto-bound IPv6 address to the wildcard hash

Dragonfly-bug: https://bugs.dragonflybsd.org/issues/3294

2 years agohammer2 - Fix excess chain structure allocations during bulkfree
Matthew Dillon [Sat, 8 Jan 2022 00:41:35 +0000 (16:41 -0800)]
hammer2 - Fix excess chain structure allocations during bulkfree

* On H2 filesystems with a very large number of inodes, such as
  those used for backups or which contain many snapshots (e.g.
  tens of millions of inodes), the bulkfree process may attempt
  to track more hammer2_chain structures than the kmalloc subsystem
  allows.

* This issue might also have contributed to reported lockups during
  bulkfree (if the bulkfree wound up eating too much non-pagable kernel
  memory), though the more typical outcome is a kernel panic when
  the kmalloc limit is exceeded for the pool.

* During bulkfree, H2 must control recursion depth during the scan.
  It does this by deferring deep nodes in the topology by recording
  a pointer to a referenced hammer2_chain structure on a list.
  Once the recursion backs out, H2 then processes these saved chains.
  Topologies greater than 32 nodes deep can wind up being deferred
  more than once to cover the entire depth.

  It is possible for an excessive number of chains to accumulate on the
  deferral list during the scan, each structure burning up kernel memory.

* Emplace a limit on the number of chains which can be deferred,
  vfs.hammer2.limit_saved_chains, with a reasonable default.  When
  the limit is reached, the bulkfree simply records a chain higher-up
  in the recursion instead of going deeper, thus limiting the number
  of chains that will be deferred.

  This has the effect is capping memory use during the bulkfree scan.
  The cost is slightly less scan efficiency, but it should mostly be in
  the noise.

2 years agolibc/isc: Stop using self assignment for unused variables.
Sascha Wildner [Thu, 6 Jan 2022 19:48:42 +0000 (20:48 +0100)]
libc/isc: Stop using self assignment for unused variables.

Some checkers complain about this.

Taken-from: FreeBSD

2 years agodsynth - Add config var for Meta_version and make the default 2
Matthew Dillon [Mon, 3 Jan 2022 20:13:18 +0000 (12:13 -0800)]
dsynth - Add config var for Meta_version and make the default 2

* Add the 'Meta_version' configuration variable.

* Make the default 2 (it was previously 1), to remain compatible
  with future pkg versions.

Requested-by: zrj
2 years agostand: Fix a typo in comment
Aaron LI [Mon, 3 Jan 2022 09:21:34 +0000 (17:21 +0800)]
stand: Fix a typo in comment

While there, adjust header inclusion a bit.

2 years agolibc: Fix environment passing in posix_spawnp(3)
zrj [Mon, 3 Jan 2022 06:18:15 +0000 (06:18 +0000)]
libc: Fix environment passing in posix_spawnp(3)

 The execvPe() was always passing the parent process environment to
 children (a long standing bug).

 While there, replace the deprecated index(3) with strchr(3).

Reported-by: falsifian (breakage in hs-git-annex)
2 years ago6.3 version changes. v6.3.0
Justin C. Sherrill [Mon, 3 Jan 2022 03:13:40 +0000 (22:13 -0500)]
6.3 version changes.

2 years agohammer2 - (when used for booting @BOOT) (2)
Matthew Dillon [Mon, 3 Jan 2022 00:51:22 +0000 (16:51 -0800)]
hammer2 - (when used for booting @BOOT) (2)

* Adjust the range to use HAMMER2_DIRHASH_LOMASK

Reported-by: aly
2 years agohammer2 - (when used for booting @BOOT)
Matthew Dillon [Sun, 2 Jan 2022 20:21:44 +0000 (12:21 -0800)]
hammer2 - (when used for booting @BOOT)

* Fix the @BOOT lookup to allow the whole hash range for "BOOT".
  This can come up if you delete the BOOT pfs and re-create it.
  hammer2 incremental the name hash collision counter to ensure
  that new PFSs are unique.

Reported-by: aly, mneumann
2 years agoAdd a getentropy(3) manual page.
Sascha Wildner [Fri, 31 Dec 2021 18:29:14 +0000 (19:29 +0100)]
Add a getentropy(3) manual page.

Taken-from: FreeBSD

2 years agoBump copyrights. Happy new year!!
Sascha Wildner [Fri, 31 Dec 2021 17:54:49 +0000 (18:54 +0100)]
Bump copyrights. Happy new year!!

2 years agokernel - Fix if_sn, if_sbsh issue (not in kernel by default)
Matthew Dillon [Fri, 31 Dec 2021 00:43:25 +0000 (16:43 -0800)]
kernel - Fix if_sn, if_sbsh issue (not in kernel by default)

* Fix a security problem with a data field.  Note that these drivers
  are not loaded into the kernel by default.

2 years agokernel - Add SIOCGHWADDR, fix SIOCGIFADDR
Matthew Dillon [Fri, 31 Dec 2021 00:40:59 +0000 (16:40 -0800)]
kernel - Add SIOCGHWADDR, fix SIOCGIFADDR

* Add SIOCGHWADDR, this is more commonly used to obtain the
  ether mac address of an interface these days.

* Fix SIOCGIFADDR which had a security problem with a data field.

2 years agopsm - Do not freeze mouse for 2 seconds upon encountering a single sync error
Michael Neumann [Thu, 30 Dec 2021 23:26:05 +0000 (00:26 +0100)]
psm - Do not freeze mouse for 2 seconds upon encountering a single sync error

The original code would drop all PS/2 packets for the next 2 seconds
upon missing a *single* sync byte. Instead, just discard the byte and in
case we cannot find the sync byte within the next few bytes, fall back
to the old behaviour.

Fixes bug: #3309

2 years agokernel - Add DIOCGMEDIASIZE and DIOCGSECTORSIZE
Matthew Dillon [Thu, 30 Dec 2021 21:15:44 +0000 (13:15 -0800)]
kernel - Add DIOCGMEDIASIZE and DIOCGSECTORSIZE

* Add DIOCGMEDIASIZE and DIOCGSECTORSIZE for 'go' and other dports.
  At the moment this requires #include <sys/diskslice.h>.

Requested-by: zrj (for dports)
2 years agolibc - Add getentropy()
Matthew Dillon [Thu, 30 Dec 2021 21:13:55 +0000 (13:13 -0800)]
libc - Add getentropy()

* Add getentropy().  This function uses getrandom() internally.

Requested-by: zrj, for dports
2 years agoRemove the old <sys/dir.h> compat header. Nothing needs it anymore.
Sascha Wildner [Thu, 30 Dec 2021 14:38:51 +0000 (15:38 +0100)]
Remove the old <sys/dir.h> compat header. Nothing needs it anymore.

The world has since switched over to <dirent.h>. Thanks to zrj for
confirming that with a full dports bulk build.

The libssh and RPC examples adjustments are just cosmetics. libssh
includes it only on NeXTSTEP and the RPC examples don't build.

2 years agosys/vfs/hammer2: Use HAMMER2_METH_DEFAULT
Tomohiro Kusumi [Tue, 28 Dec 2021 16:14:03 +0000 (01:14 +0900)]
sys/vfs/hammer2: Use HAMMER2_METH_DEFAULT

hammer2_chain_create() callers use HAMMER2_METH_DEFAULT, not '-1'.

2 years agodrm/i915: Enable WhiskeyLake GPUs
Michael Neumann [Sun, 26 Dec 2021 15:38:25 +0000 (16:38 +0100)]
drm/i915: Enable WhiskeyLake GPUs

* The PCI ids were added in commit a8138aa83 but the ids were never
  added to `pciidlist` so that the i915 driver did not recognize
  WhiskeyLake GPUs.

* Successfully tested with WhiskeyLake-U GT2 [UHD Graphics 620]
  (device=0x3ea0).

* As in Linux 5.8, they use the same configuration as CoffeeLake GPUs.

2 years agoAdd a small ksscanf(9) manual page.
Sascha Wildner [Sat, 25 Dec 2021 22:41:21 +0000 (23:41 +0100)]
Add a small ksscanf(9) manual page.

2 years agokprintf.9: Fix function argument name.
Sascha Wildner [Sat, 25 Dec 2021 22:40:10 +0000 (23:40 +0100)]
kprintf.9: Fix function argument name.

2 years agonvme - Back-off if driver lies about reported queue limits
Matthew Dillon [Sat, 25 Dec 2021 20:30:52 +0000 (12:30 -0800)]
nvme - Back-off if driver lies about reported queue limits

* Apparently some low-rent nvme controllers lie about how many
  queues they support.

* If the nvme driver lies about queue support and a queue
  create command fails, attempt to back-off to fewer queues
  first, rather than giving up immediately.  Complain mightily
  on the console.

2 years agohammer2 - Do not panic on freemap block I/O error
Matthew Dillon [Sat, 25 Dec 2021 06:45:17 +0000 (22:45 -0800)]
hammer2 - Do not panic on freemap block I/O error

* During bulkfree, do not panic if a freemap block has an I/O error.

Reported-by: aly
2 years agoAdd some more printf(1) tests.
Sascha Wildner [Sat, 25 Dec 2021 10:09:32 +0000 (11:09 +0100)]
Add some more printf(1) tests.

Taken-from: FreeBSD