dragonfly.git
12 months agoMerge branch 'vendor/OPENBSD_LIBM'
Sascha Wildner [Mon, 10 Feb 2020 16:25:16 +0000 (17:25 +0100)]
Merge branch 'vendor/OPENBSD_LIBM'

12 months agoReally sync <math.h> with OpenBSD on the vendor branch. vendor/OPENBSD_LIBM
Sascha Wildner [Mon, 10 Feb 2020 16:22:59 +0000 (17:22 +0100)]
Really sync <math.h> with OpenBSD on the vendor branch.

12 months agolibm: Remove sincos() and friends from lib/libm.
Sascha Wildner [Mon, 10 Feb 2020 16:08:55 +0000 (17:08 +0100)]
libm: Remove sincos() and friends from lib/libm.

12 months agoMerge branch 'vendor/OPENBSD_LIBM'
Sascha Wildner [Mon, 10 Feb 2020 15:48:10 +0000 (16:48 +0100)]
Merge branch 'vendor/OPENBSD_LIBM'

12 months agoImport sincos() and friends directly to the vendor branch.
Sascha Wildner [Mon, 10 Feb 2020 15:47:40 +0000 (16:47 +0100)]
Import sincos() and friends directly to the vendor branch.

12 months agosincos.3: Add missing MLINKS.
Sascha Wildner [Mon, 10 Feb 2020 15:18:48 +0000 (16:18 +0100)]
sincos.3: Add missing MLINKS.

12 months agoinet6: report RTM_MISS when probing a known address fails
Roy Marples [Sun, 9 Feb 2020 22:03:19 +0000 (22:03 +0000)]
inet6: report RTM_MISS when probing a known address fails

This allows unreachable to hit userland faster.

12 months ago<sys/ttydefaults.h>: Sync up with FreeBSD, mainly for r179567.
Sascha Wildner [Sun, 9 Feb 2020 21:22:25 +0000 (22:22 +0100)]
<sys/ttydefaults.h>: Sync up with FreeBSD, mainly for r179567.

The rest of it was already brought in.

FreeBSD's commit msg:

r179567 | ed | 2008-06-05 19:44:18 +0200 (Thu, 05 Jun 2008) | 13 lines

Fix faulty character to control-character conversion for CTRL().

The CTRL() macro seems to perform character to control-character
conversion (i.e. 'A' to 0x01) to lowercase characters. This is actually
not valid. If we use lowercase characters, conversions such as
CTRL('\\') and CTRL('?') will result to invalid conversions.

Because we must still support old source code that uses CTRL() (bad!),
we make CTRL() accept both forms. When the character is a lowercase
character, we perform the old style conversion.

12 months ago<sys/ttydefaults.h>: Add some includes for self-sufficiency.
Sascha Wildner [Sun, 9 Feb 2020 19:55:01 +0000 (20:55 +0100)]
<sys/ttydefaults.h>: Add some includes for self-sufficiency.

12 months agoroute(4): Remove a leftover closing brace.
Sascha Wildner [Sun, 9 Feb 2020 18:26:15 +0000 (19:26 +0100)]
route(4): Remove a leftover closing brace.

Assuming the opening one was removed for style reasons.

12 months agoinstaller: Silence a kenv(1) warning.
Sascha Wildner [Sun, 9 Feb 2020 17:30:54 +0000 (18:30 +0100)]
installer: Silence a kenv(1) warning.

On non-comconsole systems, this is undefined, so silence any warnings
about it (that would show up briefly when logging in as installer).

12 months agoroute(4): add RO_MISSFILTER socket option.
Roy Marples [Sun, 9 Feb 2020 17:07:41 +0000 (17:07 +0000)]
route(4): add RO_MISSFILTER socket option.

This allows filtering of specific RTM_MISS destination sockaddrs.

12 months agoroute: make INET6 addrs human readable with sockaddr_print
Roy Marples [Sun, 9 Feb 2020 12:01:00 +0000 (12:01 +0000)]
route: make INET6 addrs human readable with sockaddr_print

12 months agoroute: constify sockaddr_print
Roy Marples [Sun, 9 Feb 2020 10:25:29 +0000 (10:25 +0000)]
route: constify sockaddr_print

12 months agokernel/apple_gmux: Add missing opt_ddb.h to the Makefile and sort.
Sascha Wildner [Sun, 9 Feb 2020 10:02:45 +0000 (11:02 +0100)]
kernel/apple_gmux: Add missing opt_ddb.h to the Makefile and sort.

12 months agokernel/vga_switcheroo: Add missing opt_ddb.h to the Makefile.
Sascha Wildner [Sat, 8 Feb 2020 08:48:06 +0000 (09:48 +0100)]
kernel/vga_switcheroo: Add missing opt_ddb.h to the Makefile.

12 months agokernel/drm: Add missing opt_ddb.h to the Makefiles.
Sascha Wildner [Fri, 7 Feb 2020 14:54:10 +0000 (15:54 +0100)]
kernel/drm: Add missing opt_ddb.h to the Makefiles.

While here, adjust some SRCS declaration style with the rest of the
Makefile.

12 months agokernel - Clean up memory leaks and a stack buffer disclosure bug
Matthew Dillon [Fri, 7 Feb 2020 07:43:31 +0000 (23:43 -0800)]
kernel - Clean up memory leaks and a stack buffer disclosure bug

* Clean up memory leaks, a stack buffer disclosure bug, and a
  missing priv check in if_oce (which probably never attaches these
  days).  All in the network subsystem.

Reported-by: Ilja van Sprundel
12 months agosbin/fsck_msdosfs: Diff reduction against FreeBSD against NetBSD
Tomohiro Kusumi [Thu, 6 Feb 2020 15:15:10 +0000 (00:15 +0900)]
sbin/fsck_msdosfs: Diff reduction against FreeBSD against NetBSD

from freebsd/freebsd@28bbeac80931cc14571ef4b6455d8da7466411a2

12 months agosbin/fsck_msdosfs: Tighten FAT checks and fix off-by-one error in corner case
Tomohiro Kusumi [Thu, 6 Feb 2020 15:12:08 +0000 (00:12 +0900)]
sbin/fsck_msdosfs: Tighten FAT checks and fix off-by-one error in corner case

See below for details.
https://reviews.freebsd.org/D23065

from freebsd/freebsd@b60894b10adb071a8dc2b6fea5f9867c24bc9c47

12 months agolibm: Bring in sincos, sincosf, and sincosl from OpenBSD
François Tigeot [Thu, 6 Feb 2020 12:15:57 +0000 (13:15 +0100)]
libm: Bring in sincos, sincosf, and sincosl from OpenBSD

12 months agodrm/linux: fix a bug in DEFINE_WAIT()
François Tigeot [Thu, 6 Feb 2020 06:16:13 +0000 (07:16 +0100)]
drm/linux: fix a bug in DEFINE_WAIT()

The wake-up function was not properly set up.

12 months agosbin/fsck_msdosfs: Document -M
Tomohiro Kusumi [Wed, 5 Feb 2020 16:29:45 +0000 (01:29 +0900)]
sbin/fsck_msdosfs: Document -M

from freebsd/freebsd@0371742d8ddb1c53201a1141a58076535e0b2f9c

12 months agosbin/fsck_msdosfs: Reduce memory footprint of fsck_msdosfs
Tomohiro Kusumi [Wed, 5 Feb 2020 16:20:08 +0000 (01:20 +0900)]
sbin/fsck_msdosfs: Reduce memory footprint of fsck_msdosfs

See below for details.
https://reviews.freebsd.org/D22965

from freebsd/freebsd@41655e1cf1451b788f6437c91ec74bcecd2192b7

12 months agodrm: Improve drm_can_sleep()
François Tigeot [Wed, 5 Feb 2020 10:28:43 +0000 (11:28 +0100)]
drm: Improve drm_can_sleep()

12 months agodrm - Remove some of the linux_sched debugging
Matthew Dillon [Wed, 5 Feb 2020 06:05:48 +0000 (22:05 -0800)]
drm - Remove some of the linux_sched debugging

* Remove some debugging that we no longer need.

12 months agohammer2.8: Fix typo.
Sascha Wildner [Wed, 5 Feb 2020 04:28:57 +0000 (05:28 +0100)]
hammer2.8: Fix typo.

12 months agodsynth - Add HTML support (2)
Matthew Dillon [Tue, 4 Feb 2020 01:44:57 +0000 (17:44 -0800)]
dsynth - Add HTML support (2)

* Fix 'ignored' and 'failed' reason format (the js expects a certain
  format and coughs pop-up errors up if it doesn't get it).

12 months agodsynth - Add HTML support
Matthew Dillon [Tue, 4 Feb 2020 01:05:00 +0000 (17:05 -0800)]
dsynth - Add HTML support

* Bring in progress.css, progress.html, progress.js, and icons from
  the synth project.  Add John's copyright to progress.js.

* dsynth now generates the logs/Report subdirectory, all necessary
  files, and dynamically generates the json.

  The summary.json database is updated every 10 seconds to reduce wear and
  tear.

* Split the history files in 50KB segments to reduce network traffic.

12 months agoetc/defaults/rc.conf: Remove some leftovers from the mrouted(8) removal.
Sascha Wildner [Mon, 3 Feb 2020 21:24:05 +0000 (22:24 +0100)]
etc/defaults/rc.conf: Remove some leftovers from the mrouted(8) removal.

12 months agokernel/iwm: Add back support for IWM_DEBUG (default is inactive).
Sascha Wildner [Mon, 3 Feb 2020 20:45:21 +0000 (21:45 +0100)]
kernel/iwm: Add back support for IWM_DEBUG (default is inactive).

Dunno why it got lost in the last upgrade.

Also, comment it out in the module Makefile.

12 months agogetrandom.2: Use .Dv for defines.
Sascha Wildner [Mon, 3 Feb 2020 20:13:48 +0000 (21:13 +0100)]
getrandom.2: Use .Dv for defines.

12 months agoiso639: Fix some descriptions (from upstream).
Sascha Wildner [Mon, 3 Feb 2020 20:35:57 +0000 (21:35 +0100)]
iso639: Fix some descriptions (from upstream).

12 months agokernel - Fix usb crash on detach
Matthew Dillon [Mon, 3 Feb 2020 19:15:03 +0000 (11:15 -0800)]
kernel - Fix usb crash on detach

* Sometimes a bad usb link can flicker off before the usb bus is able
  to finish attaching it, resulting in an attempt to kfree() a NULL
  pointer.  Check for NULL.

12 months agosysctl.9/sysctl_add_oid.9: Add missing BIT32 and BIT64 MLINKS.
Sascha Wildner [Mon, 3 Feb 2020 16:51:11 +0000 (17:51 +0100)]
sysctl.9/sysctl_add_oid.9: Add missing BIT32 and BIT64 MLINKS.

12 months agorman.9: Fix rman_make_alignment_flags() prototype.
Sascha Wildner [Mon, 3 Feb 2020 16:06:00 +0000 (17:06 +0100)]
rman.9: Fix rman_make_alignment_flags() prototype.

12 months agogetrandom.2: Comment out reference to getentropy.3 and fix date.
Sascha Wildner [Mon, 3 Feb 2020 15:55:51 +0000 (16:55 +0100)]
getrandom.2: Comment out reference to getentropy.3 and fix date.

12 months agovkernel: Include <sys/malloc.h> for malloc_reinit_ncpus() prototype.
Sascha Wildner [Mon, 3 Feb 2020 15:13:54 +0000 (16:13 +0100)]
vkernel: Include <sys/malloc.h> for malloc_reinit_ncpus() prototype.

Fixes the VKERNEL64 build.

12 months agogcc80: Hide NO_WERROR in tools better.
zrj [Sun, 2 Feb 2020 09:12:34 +0000 (11:12 +0200)]
gcc80: Hide NO_WERROR in tools better.

12 months agohostprog: Remove NO_WERROR from btools tic.
zrj [Sun, 2 Feb 2020 09:11:25 +0000 (11:11 +0200)]
hostprog: Remove NO_WERROR from btools tic.

Pointed-out-by: swildner
12 months ago<alloca.h>: Add comment for special handling case.
zrj [Sun, 2 Feb 2020 09:10:47 +0000 (11:10 +0200)]
<alloca.h>: Add comment for special handling case.

12 months agokernel - Make writing to /dev/urandom (to add entropy) faster
Matthew Dillon [Mon, 3 Feb 2020 03:29:30 +0000 (19:29 -0800)]
kernel - Make writing to /dev/urandom (to add entropy) faster

* Speed this up a bit by chunking up 256 byte blocks instead of
  64.  The SHA256 hash eats a lot of time, this should speed the
  boot-time entropy injection up by 4x.

Reported-by: zrj
12 months agolibc - Update manual page for realpath(3) and add page for __realpath(2)
Matthew Dillon [Sun, 2 Feb 2020 20:41:30 +0000 (12:41 -0800)]
libc - Update manual page for realpath(3) and add page for __realpath(2)

* Add a manual page for __realpath(2) which clarifies differences
  between realpath(3) and __realpath(2).

12 months agolibc - Update for realpath() system call support (2)
Matthew Dillon [Sun, 2 Feb 2020 20:21:59 +0000 (12:21 -0800)]
libc - Update for realpath() system call support (2)

* Fix bug last commit, on failure if a buffer is supplied we copy
  the source path to the target buffer before returning.

Reported-by: zrj
13 months agoboot/pxe: Fix some typos in comments and (unused, as it seems) type names.
Sascha Wildner [Sun, 2 Feb 2020 10:15:51 +0000 (11:15 +0100)]
boot/pxe: Fix some typos in comments and (unused, as it seems) type names.

While here, use our __packed.

13 months agokernel - Rejigger random number generator to be per-cpu 2/2
Matthew Dillon [Sun, 2 Feb 2020 07:45:16 +0000 (23:45 -0800)]
kernel - Rejigger random number generator to be per-cpu 2/2

* The initializer tries to diverge each cpu's csprng a bit more
  now.  These initial conditions are not intended to produce secure
  random numbers, but they should be reasonably secure by the time the
  kernel is finished booting.

* Once the csprng is operational, do not always inject the same
  entropy into both csprngs since that would make having two and
  XOR'ing the results together kinda worthless.

* If RDRAND is available the csprng will get new injections 25 times
  a second on each cpu.  Without it, however, entropy injection is
  relatively slow.

13 months agokernel - Rejigger random number generator to be per-cpu 1/2
Matthew Dillon [Sun, 2 Feb 2020 06:55:12 +0000 (22:55 -0800)]
kernel - Rejigger random number generator to be per-cpu 1/2

* Refactor all the kernel random number generation code to
  operate on a per-cpu basis.  The csprng, ibaa, and l15
  structures are now per-cpu.

* RDRAND now runs a periodic timer callback on all available cpus
  rather than just on cpu 0, allowing rdrand data to mix on
  each cpu's rng independently.

* The nrandom helper thread now chains state with an iteration
  between cpus, injecting a random data buffer generated from
  the previous cpu into the mix of the current.

13 months agokernel - Add __realpath() and getrandom() system calls (2)
Matthew Dillon [Sun, 2 Feb 2020 06:48:20 +0000 (22:48 -0800)]
kernel - Add __realpath() and getrandom() system calls (2)

* Move GRND_* defines to the right spot in sys/random.h

13 months agomake(1): Add OpenBSD support.
zrj [Sat, 1 Feb 2020 12:48:03 +0000 (14:48 +0200)]
make(1): Add OpenBSD support.

 OpenBSD does not have 'A' support in malloc_options.  Use supported 'S'
 to prevent a lot of warnings during every bmake invoke.

13 months agotic(1): Explicitly disable WERROR in hostprog tic.
zrj [Sat, 1 Feb 2020 12:43:08 +0000 (14:43 +0200)]
tic(1): Explicitly disable WERROR in hostprog tic.

 This special version is used during buildworld.
 Helps with bootstrapping on OpenBSD.

13 months agoworld: Explicitly disable WERROR for hostprog and hostlib.
zrj [Sat, 1 Feb 2020 12:36:25 +0000 (14:36 +0200)]
world: Explicitly disable WERROR for hostprog and hostlib.

 Explicit tracking of currently toolchain is too fragile for c++.
 Add CROSS_CFLAGS helper in NXFLAGS for bootstrapping on OpenBSD.

13 months agogcc80: Make bootstrapping more permissive.
zrj [Sat, 1 Feb 2020 12:32:40 +0000 (14:32 +0200)]
gcc80: Make bootstrapping more permissive.

 To allow boostrapping on OpenBSD/Linux hosts:
 * provide CROSS_LIBDL knob when needed;
 * disable use of iconv in support libs;
 * disable werror in hostlibs.

13 months agobinutils227: Explicitly include <stdint.h> and add CROSS_LIBDL.
zrj [Sat, 1 Feb 2020 12:22:46 +0000 (14:22 +0200)]
binutils227: Explicitly include <stdint.h> and add CROSS_LIBDL.

 On glibc based systems dlopen() functionality is not in libc.

13 months agogdb(1): Explicitly include <stdint.h>.
zrj [Sat, 1 Feb 2020 12:21:18 +0000 (14:21 +0200)]
gdb(1): Explicitly include <stdint.h>.

13 months agolibc - Update for realpath() system call support
Matthew Dillon [Sun, 2 Feb 2020 01:34:30 +0000 (17:34 -0800)]
libc - Update for realpath() system call support

* The realpath() implementation now checks to see if the system call
  is available and uses it.

* getosreldate() now caches the result to avoid multiple sysctl()
  calls.

* Add the new system calls (__realpath and getrandom()) to the symbol
  list.

13 months agokernel - Add __realpath() and getrandom() system calls
Matthew Dillon [Sun, 2 Feb 2020 01:30:28 +0000 (17:30 -0800)]
kernel - Add __realpath() and getrandom() system calls

* Add a kernel __realpath() system call.  libc must still implement
  the realpath() function to handle NULL buffers (malloc()d buffer
  returned).

  The libc implementation checks the osversion for backwards compatibility
  before attempting to use the new system call.

* Add a kernel getrandom() system call.

* Bump __DragonFly_version to 500710.

Suggested-by: tuxillo, mjg
13 months agoenv(1): Match glibc getopt() semantics.
zrj [Sat, 1 Feb 2020 11:52:57 +0000 (13:52 +0200)]
env(1): Match glibc getopt() semantics.

 Move '-' to the end of opstring since position within opstring is not
 meaningful.

Taken-from: OpenBSD

13 months agoxargs(1): Disable prompt support (-p) in btools.
zrj [Sat, 1 Feb 2020 11:49:48 +0000 (13:49 +0200)]
xargs(1): Disable prompt support (-p) in btools.

 Not needed and helps with bootstrapping on different OS.

13 months agoxargs(1): Add limit for args_max.
zrj [Sat, 1 Feb 2020 11:48:37 +0000 (13:48 +0200)]
xargs(1): Add limit for args_max.

 Current logic does not handle cases where args_max > int32_t limit.

13 months agotr(1): Fix compilation on Linux hosts.
zrj [Sat, 1 Feb 2020 11:46:01 +0000 (13:46 +0200)]
tr(1): Fix compilation on Linux hosts.

13 months agodd(1): Allow to bootstrap on OpenBSD and glibc based systems.
zrj [Sat, 1 Feb 2020 11:41:24 +0000 (13:41 +0200)]
dd(1): Allow to bootstrap on OpenBSD and glibc based systems.

 Disable tape detection support (reduces host requirements).
 Redirect siginfo to SIGUSR1 to match dd behavior on glibc systems.

13 months agotime(1): Disable -l support in btools.
zrj [Sat, 1 Feb 2020 11:36:03 +0000 (13:36 +0200)]
time(1): Disable -l support in btools.

 This removes kinfo(3) requirement to bootstrap time(1) on OpenBSD.

13 months agotime(1): Install signal handle only if SIGINFO is available.
zrj [Sat, 1 Feb 2020 11:30:14 +0000 (13:30 +0200)]
time(1): Install signal handle only if SIGINFO is available.

 While there, adjust needed headers and remove few trailing whitespaces.

13 months agowc(1): Install signal handler only if SIGINFO is available.
zrj [Sat, 1 Feb 2020 11:25:19 +0000 (13:25 +0200)]
wc(1): Install signal handler only if SIGINFO is available.

 Allows to bootstrap on glibc based systems.

13 months agotail(1): Disable -f and -F (follow) functionality in btools.
zrj [Sat, 1 Feb 2020 11:21:27 +0000 (13:21 +0200)]
tail(1): Disable -f and -F (follow) functionality in btools.

 Allows to bootstrap on OpenBSD (no kevent support).

13 months agopatch(1): Check for _DIRENT_HAVE_D_NAMLEN availability.
zrj [Sat, 1 Feb 2020 11:17:51 +0000 (13:17 +0200)]
patch(1): Check for _DIRENT_HAVE_D_NAMLEN availability.

13 months agosh(1): Check for _DIRENT_HAVE_D_NAMLEN availability.
zrj [Sat, 1 Feb 2020 11:16:43 +0000 (13:16 +0200)]
sh(1): Check for _DIRENT_HAVE_D_NAMLEN availability.

 To allow bootstrapping on OpenBSD.

13 months agostrfile(8): Include <stdint.h> explicitly.
zrj [Sat, 1 Feb 2020 11:15:11 +0000 (13:15 +0200)]
strfile(8): Include <stdint.h> explicitly.

13 months agolibc/citrus: Include <stdint.h> explicitly.
zrj [Sat, 1 Feb 2020 11:13:45 +0000 (13:13 +0200)]
libc/citrus: Include <stdint.h> explicitly.

13 months agolocaledef(1): Allow easier bootstrapping.
zrj [Sat, 1 Feb 2020 11:11:26 +0000 (13:11 +0200)]
localedef(1): Allow easier bootstrapping.

 Solves issue when bootstrapping on OpenBSD.

13 months agolorder(1): Use POSIX defined flags for sort(1).
zrj [Sat, 1 Feb 2020 11:07:44 +0000 (13:07 +0200)]
lorder(1): Use POSIX defined flags for sort(1).

 While there, add -s to ensure stable sort (commonly available).

 No functional change.

13 months agoworld: Pass relative location of sys/ to newvers.sh as argument.
zrj [Sat, 1 Feb 2020 11:05:03 +0000 (13:05 +0200)]
world: Pass relative location of sys/ to newvers.sh as argument.

 Location is known at invoke time and avoids issue where <osreldate.h>
 might not be properly populated when building on OpenBSD host.

13 months agotaskqueue: Fix the order of TASKQUEUE_DEFINE_THREAD
Sepherosa Ziehau [Fri, 31 Jan 2020 11:57:05 +0000 (19:57 +0800)]
taskqueue: Fix the order of TASKQUEUE_DEFINE_THREAD

So it can be used by drivers.

13 months agosound/hda: Use driver specific taskqueue, instead of per-cpu taskqueue
Sepherosa Ziehau [Fri, 31 Jan 2020 10:45:31 +0000 (18:45 +0800)]
sound/hda: Use driver specific taskqueue, instead of per-cpu taskqueue

This driver is not per-cpu ready, so don't user per-cpu taskqueue,
which causes assertion during taskqueue_enqueue.  Instead use driver
specific taskqueue.

13 months agotaskqueue: Fix TASKQUEUE_DEFINE_THREAD
Sepherosa Ziehau [Fri, 31 Jan 2020 10:44:53 +0000 (18:44 +0800)]
taskqueue: Fix TASKQUEUE_DEFINE_THREAD

13 months agohammer2 - Fix inode & chain limits, improve flush pipeline.
Matthew Dillon [Thu, 30 Jan 2020 23:40:01 +0000 (15:40 -0800)]
hammer2 - Fix inode & chain limits, improve flush pipeline.

* Reorganize VFS_MODIFYING() to avoid certain deadlock conditions and
  adjust hammer2 to unconditionally stall in VFS_MODIFYING() when dirty
  limits are exceeded.

  Make sure VFS_MODIFYING() is called in all appropriate filesystem-
  modifying paths.

  This ensures that inode and chain structure allocation limits are
  adhered to.

* Fix hammer2's wakeup code for the dirty inode count hystereis.  This
  fixes a situation where stalls due to excessive dirty inodes were waiting
  a full second before resuming operation based on the dirty count
  hysteresis.

  The hysteresis now works as intended:

  (1) Trigger a sync when the dirty count reache 50% N.
  (2) Stall the frontend when the dirty count reaches 100% N.
  (3) Resume the frontend when the diirty count drops to 66% N.

* Fix trigger_syncer() to guarantee that the syncer will flush the
  filesystem ASAP when called.  If the filesystem is already in a flush,
  it will be flushed again.

  Previously if the filesystem was already in a flush it would wait one
  second before flushing again, which significantly reduces performance
  under conditions where the dirty chain limit or the dirty inode limit is
  constantly being hit (e.g. chown -R, etc).

Reported-by: tuxillo
13 months agokernel - Document UPREQ and EXREQ cases better
Matthew Dillon [Wed, 29 Jan 2020 17:59:51 +0000 (09:59 -0800)]
kernel - Document UPREQ and EXREQ cases better

* Do a better job documenting responsibilities for UPREQ and EXREQ.

13 months agolibfetch: Fix buffer overflow (CVE-2020-7450)
Antonio Huete Jimenez [Wed, 29 Jan 2020 16:52:50 +0000 (17:52 +0100)]
libfetch: Fix buffer overflow (CVE-2020-7450)

  - A remote attacker, who can supply a malicious URL to the application
    that uses libfetch(3), can trigger memory corruption and execute arbitrary
    code on the target system.
  - FreeBSD-SA-20:01.libfetch

Submitted-by: bapt, emaste
13 months agodaemon(8): Sync with FreeBSD. Some ports need options we didn't have.
Sascha Wildner [Wed, 29 Jan 2020 16:46:49 +0000 (17:46 +0100)]
daemon(8): Sync with FreeBSD. Some ports need options we didn't have.

Mainly for -T, see https://github.com/DragonFlyBSD/DeltaPorts/issues/914

Most of the changes revolve around supporting logging the program's
output with syslog(3).

Reported-by: kworr
Taken-from:  FreeBSD

13 months agodsynth - Hack elfinfo note output a bit
Matthew Dillon [Tue, 28 Jan 2020 18:29:22 +0000 (10:29 -0800)]
dsynth - Hack elfinfo note output a bit

* The elf info is a bit of a hack and typically contains two
  note structures, but only one has the version.  The other typically
  has zero for the version field.

* The structures in the .note section can sometimes be transposed,
  so allow the case by testing to see if version is 0 and using the
  second structure's version if it is.

Reported-by: Romick
13 months agolockmgr - Fix bug in lockmgr() cancel path
Matthew Dillon [Mon, 27 Jan 2020 23:00:20 +0000 (15:00 -0800)]
lockmgr - Fix bug in lockmgr() cancel path

* Fix a bug in the lockmgr() cancel path where a cancelable blocked
  exclusive lock is not canceled.  The EXREQ2 bit must be tested in
  addition to EXREQ, as it is possible for EXREQ to be clear when
  EXREQ2 is set.

* Fixes a situation where the usb path could deadlock a softclock
  cpu thread, causing a cascade of issues on that cpu.

13 months agokernel/atkbdc: Remove some dead code.
Sascha Wildner [Mon, 27 Jan 2020 15:17:44 +0000 (16:17 +0100)]
kernel/atkbdc: Remove some dead code.

13 months agophantasia(6)/dsynth(1): Add two missing DPADD definitions.
Sascha Wildner [Sun, 26 Jan 2020 19:14:32 +0000 (20:14 +0100)]
phantasia(6)/dsynth(1): Add two missing DPADD definitions.

13 months agolibc - Check for invalid context in setcontext() and swapcontext()
Matthew Dillon [Sat, 25 Jan 2020 23:44:57 +0000 (15:44 -0800)]
libc - Check for invalid context in setcontext() and swapcontext()

* Check for an invalid context in setcontext() and swapcontext()
  and return -1 instead of switching to the invalid context.

* This is not an exhaustive check but will handle invalid states set
  by makecontext() if e.g. argc is messed up or the supplied stack is
  too small.  In particular, if makecontext() fails and set/swap tries
  to switch to it, it will switch to the state from the getcontext()
  prior to the makecontext() instead of to the desired makecontext()
  state.

Reported-by: zrj, tuxillo
13 months agokernel/vga: Sort I/O port addresses in vgareg.h.
Sascha Wildner [Sat, 25 Jan 2020 20:41:40 +0000 (21:41 +0100)]
kernel/vga: Sort I/O port addresses in vgareg.h.

13 months agorc.d/root: Fix return code that I broke in November.
Sascha Wildner [Sat, 25 Jan 2020 01:03:49 +0000 (02:03 +0100)]
rc.d/root: Fix return code that I broke in November.

After f304a32950ea980273aabeb3a194836fbb8471d2, the umount ended up
being the last command in root_start(), but it is expected to
return a non-zero status.

Fix this by inserting a return 0.

13 months agokernel/ntfs: Fix lockinit() flags.
Sascha Wildner [Fri, 24 Jan 2020 22:17:24 +0000 (23:17 +0100)]
kernel/ntfs: Fix lockinit() flags.

13 months agokernel - Fix missing lock in devfs
Matthew Dillon [Fri, 24 Jan 2020 22:02:30 +0000 (14:02 -0800)]
kernel - Fix missing lock in devfs

* The master devfs lock must be held across a devfs_reference_ops()
  call.

* Should fix races and panics related to fast device creation and
  deletion (typically only triggered by dsynth's use of pty's).

Reported-by: zrj, multiple
13 months agodrm: Fix lockinit() calls in previous commit
François Tigeot [Fri, 24 Jan 2020 21:00:04 +0000 (22:00 +0100)]
drm: Fix lockinit() calls in previous commit

LK_EXCLUSIVE is a lockmgr() argument, not a lockinit() one.

13 months agodrm: Replace all Linux spinlocks by lockmgr locks
François Tigeot [Fri, 24 Jan 2020 19:51:08 +0000 (20:51 +0100)]
drm: Replace all Linux spinlocks by lockmgr locks

* The DragonFly kernel can sleep in different circumstances than Linux

* Linux driver code has not been written to prevent it

* Make all Linux spinlock_t spinlocks lockmgr locks and avoid potential
  problems once and for all

13 months agodrm: Pass CRTC ID in userspace vblank events
Peeter Must [Thu, 23 Jan 2020 08:43:48 +0000 (10:43 +0200)]
drm: Pass CRTC ID in userspace vblank events

* Add DRM_CAP_CRTC_IN_VBLANK_EVENT so userspace can
  query the crtc field.

* This follows Linux's commit
  5db06a8a98f515f67446a69c57577c4c363ec65d.

13 months agolibutil: Fix some weird indentation.
Sascha Wildner [Wed, 22 Jan 2020 19:41:37 +0000 (20:41 +0100)]
libutil: Fix some weird indentation.

13 months agomtest(8): Fix two -Wunused-parameter warnings and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 18:04:34 +0000 (19:04 +0100)]
mtest(8): Fix two -Wunused-parameter warnings and raise WARNS to 6.

13 months agoifmcstat(8): Fix a -Wshadow and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 18:00:55 +0000 (19:00 +0100)]
ifmcstat(8): Fix a -Wshadow and raise WARNS to 6.

13 months agopflogd(8): Fix a duplicate prototype and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 17:33:10 +0000 (18:33 +0100)]
pflogd(8): Fix a duplicate prototype and raise WARNS to 6.

13 months agoLocal changes for the flex upgrade.
Sascha Wildner [Sun, 19 Jan 2020 10:59:28 +0000 (11:59 +0100)]
Local changes for the flex upgrade.

13 months agoMerge branch 'vendor/FLEX'
Sascha Wildner [Sun, 19 Jan 2020 10:25:39 +0000 (11:25 +0100)]
Merge branch 'vendor/FLEX'

13 months agoImport flex-2.6.4 to the vendor branch. vendor/FLEX
Sascha Wildner [Sun, 19 Jan 2020 10:06:36 +0000 (11:06 +0100)]
Import flex-2.6.4 to the vendor branch.

13 months ago[fish] require the user have the card they ask for
Eitan Adler [Sat, 18 Jan 2020 22:29:44 +0000 (22:29 +0000)]
[fish] require the user have the card they ask for

This bug was introduced in ef388479 by me.

Reported by: Matthew Kern <mkern@alconconstruction.com>

13 months agokernel - Fix indefinite wait buffer bug with encrypted disks
Matthew Dillon [Sat, 18 Jan 2020 17:49:45 +0000 (09:49 -0800)]
kernel - Fix indefinite wait buffer bug with encrypted disks

* Preallocate all (nmax) mpipe buffers to avoid doing any large buffer
  allocations inside critical low-memory I/O paths.

* Remove the per-sector objcache, which could cause numerous blocking
  memory allocations in critical low-memory I/O paths.  Instead,
  pre-allocate all necessary data outside of the critical path.

  For now these per-sector structures are cached in a simple linked
  list with a single spin-lock (not ideal).

* Reorganize per-sector data into its own essiv_ivgen_data structure,
  Plus other minor cleanups.

* TODO - We need to queue the bio in the target_crypt_config structure
  instead of relying on mpipe_alloc_callback() which must still allocate
  a small structure via M_INTWAIT.

Reported-by: goleo, profmakx, daftaupe, others