20 months agoMerge branch 'vendor/DHCPCD'
Roy Marples [Sat, 28 Nov 2020 14:38:03 +0000 (14:38 +0000)]
Merge branch 'vendor/DHCPCD'

20 months agoUpdate to dhcpcd-9.3.4 with the following changes:
Roy Marples [Sat, 28 Nov 2020 14:36:33 +0000 (14:36 +0000)]
Update to dhcpcd-9.3.4 with the following changes:

 * DHCP: If error adding the address in oneshot, exit with failure
 * DHCP: Only listen to the address if we successfully added it
 * DHCP6: Fix segfault introduced in dhcpcd-9.3.3
 * DHCP6: Abort in test mode when an error is returned by server
 * options: allow --ia_na=1 and --ia_pd=2 on the command line
 * options: Allow duid to take a value

20 months ago<sys/sysproto.h>: Remove unneeded inclusion of <sys/sysmsg.h>.
Sascha Wildner [Sat, 28 Nov 2020 09:22:49 +0000 (10:22 +0100)]
<sys/sysproto.h>: Remove unneeded inclusion of <sys/sysmsg.h>.

After 80d831e1ad5c5886e45827bf13837cf84baba296, which removed the
struct sysmsg's in the *_args structures, this is no longer needed.

It also resolves circular #include issues because that commit at the
same time added #include <sys/sysproto.h> to <sys/sysmsg.h>.

20 months agosh(1) tests: dfregress support
Antonio Huete Jimenez [Fri, 27 Nov 2020 11:14:53 +0000 (12:14 +0100)]
sh(1) tests: dfregress support

20 months agodfregress: Add 'rc' option
Antonio Huete Jimenez [Fri, 27 Nov 2020 10:52:07 +0000 (11:52 +0100)]
dfregress: Add 'rc' option

  - Allows to specify which return code will be considered success for the
    test case being run. In the example below, a return code of '1' will
    make the test PASS.

    # Testcase            type        Options         Args
    builtins/alias.1      userland    nobuild,rc=1    myarg1 myarg2

20 months agodfregress: Fix mistake in the previous commit
Antonio Huete Jimenez [Fri, 27 Nov 2020 10:09:31 +0000 (11:09 +0100)]
dfregress: Fix mistake in the previous commit

  - We only return NULL on failure when fatal is false.

20 months agodfregress: Add 'interpreter' option
Antonio Huete Jimenez [Thu, 26 Nov 2020 22:40:00 +0000 (23:40 +0100)]
dfregress: Add 'interpreter' option

  - Allows to specify the interpreter that will run the testcase file.
    Some test cases just provide a file without execution permissions or no
    shebang, etc. In some cases it is not desirable to modify the test case
    files (i.e. contrib stuff).

    Taking the example below, the previous behavior was to execvp() the file
    'builtins/alias.0' but with 'interpreter' option, now you can specify
    the shell you want to use to run it.

    # Testcase            type        Options                   Args
    builtins/alias.0      userland    nobuild,interpreter=sh    myarg1 myarg2

20 months agoudp: Port FreeBSD's IPPROTO_IP/IP_SENDSRCADDR.
Sepherosa Ziehau [Thu, 26 Nov 2020 03:22:10 +0000 (11:22 +0800)]

Minor difference:
- Multicast src is not allowed.
- Always allow src, if it is same as inp_laddr and is not multicast.

While I'm here, fix datagram sending for multicast bound and connected
UDP socket.

20 months agotbridge: Add a section 4 man page.
Antonio Huete Jimenez [Wed, 25 Nov 2020 00:16:16 +0000 (01:16 +0100)]
tbridge: Add a section 4 man page.

20 months ago<sys/poll.h>: Expose POLLSTANDARD and INFTIM only in the default env.
Sascha Wildner [Tue, 24 Nov 2020 22:19:09 +0000 (23:19 +0100)]
<sys/poll.h>: Expose POLLSTANDARD and INFTIM only in the default env.

Cleans up the POSIX namespace.

20 months agovkernel - Fix the vkernel build after recent syscall changes (2)
Matthew Dillon [Tue, 24 Nov 2020 21:33:34 +0000 (13:33 -0800)]
vkernel - Fix the vkernel build after recent syscall changes (2)

* Another fix.  Now the vkernel actually works again.

Reported-by: pikrzyszt, tuxillo
20 months agokernel - Fix sys_vmspace_ctl()
Matthew Dillon [Tue, 24 Nov 2020 19:57:20 +0000 (11:57 -0800)]
kernel - Fix sys_vmspace_ctl()

* This system call overwrites the trap-frame.  The new syscall code
  just has the argument pointer (uap) pointing into the trap-frame,
  so in this particular case we have to copy the arguments out before
  overwriting it.

Reported-by: pikrzyszt, tuxillo
20 months agokernel - Fix shared spin-lock starvation bug in VMs
Matthew Dillon [Tue, 24 Nov 2020 19:51:38 +0000 (11:51 -0800)]
kernel - Fix shared spin-lock starvation bug in VMs

* 'indefinite_uses_rdtsc' is set to zero by default when running in
  a virtual machine (and set to 1 on a real machine).  However, this
  disables the windowing code in _spin_lock_shared_contested() and
  causes it to defer to pending execusive lock requests indefinitely
  under heavy-enough loads.

* Add a comment and always use a windowing test w/rdtsc() in

  We were trying to avoid using the rdtsc() in VMs because some of them
  apparently trap the rdtsc instruction.  However, this puts us in a
  no-win situation when it comes to dealing with spin-locks.  So take the
  hit and start using rdtsc again in some situations when operating in
  a VM.

Reported-by: mjg
20 months agoinet: Refactor in_pcbbind() for IP_SENDSRCADDR support.
Sepherosa Ziehau [Tue, 24 Nov 2020 14:50:27 +0000 (22:50 +0800)]
inet: Refactor in_pcbbind() for IP_SENDSRCADDR support.

The newly factored out function will be used to validate address
passed through IP_SENDSRCADDR cmsg.

20 months agotools/udpecho: Add command line option to prevent REUSEPORT.
Sepherosa Ziehau [Tue, 24 Nov 2020 14:49:09 +0000 (22:49 +0800)]
tools/udpecho: Add command line option to prevent REUSEPORT.

20 months agotbridge: Add MODULE_DEPEND to the test module declaration.
Antonio Huete Jimenez [Tue, 24 Nov 2020 11:58:09 +0000 (12:58 +0100)]
tbridge: Add MODULE_DEPEND to the test module declaration.

  - Makes sure you can't unload the tbridge module while
    there are test modules loaded.

20 months agolibc/stdio: Add missing MLINK.
Sascha Wildner [Tue, 24 Nov 2020 09:18:05 +0000 (10:18 +0100)]
libc/stdio: Add missing MLINK.

20 months agoinpcb: Factor out function to obtain lport hash token.
Sepherosa Ziehau [Mon, 23 Nov 2020 15:36:52 +0000 (23:36 +0800)]
inpcb: Factor out function to obtain lport hash token.

20 months agojail: Constify the address to be checked.
Sepherosa Ziehau [Mon, 23 Nov 2020 15:02:13 +0000 (23:02 +0800)]
jail: Constify the address to be checked.

20 months agoPut all definitions of htonl() and friends under _BYTEORDER_FUNC_DEFINED.
Sascha Wildner [Mon, 23 Nov 2020 08:42:35 +0000 (09:42 +0100)]
Put all definitions of htonl() and friends under _BYTEORDER_FUNC_DEFINED.

This is the intended way to properly deal with non-__GNUC__ cases (see
<machine/endian.h>). But it was only done properly in <arpa/inet.h> so

Noticed-by: zrj
20 months agolibc/stdio: Add _unlocked() flavors of fflush, fputc, fputs, fread, fwrite.
Sascha Wildner [Sun, 22 Nov 2020 08:27:36 +0000 (09:27 +0100)]
libc/stdio: Add _unlocked() flavors of fflush, fputc, fputs, fread, fwrite.

These are needed by some dports and can also be used in various things
in base. Bump __DragonFly_version, too.

Reported-by: zrj
Taken-from:  FreeBSD

20 months agolibc/siglist: Oops, CKPTX should be CKPTEXIT.
Sascha Wildner [Sun, 22 Nov 2020 08:14:08 +0000 (09:14 +0100)]
libc/siglist: Oops, CKPTX should be CKPTEXIT.

20 months agoClean up the namespace of <arpa/inet.h>, <netdb.h> and <netinet/in.h>.
Sascha Wildner [Sun, 22 Nov 2020 07:04:38 +0000 (08:04 +0100)]
Clean up the namespace of <arpa/inet.h>, <netdb.h> and <netinet/in.h>.

These are further cleanups for stricter POSIX conformance, all related
to the uint*_t types, for which we previously had to include <stdint.h>
wholesale. Instead, wrap them in *_DECLARED macros and typedef them in
the headers that need them, usually just a subset.

Thanks to zrj for testing this with a dports bulk build.

20 months agosys/netproto/smb: Do not trust <netinet/in.h> to bring in <sys/types.h>.
Sascha Wildner [Sun, 22 Nov 2020 06:24:48 +0000 (07:24 +0100)]
sys/netproto/smb: Do not trust <netinet/in.h> to bring in <sys/types.h>.

<sys/types.h> will be removed from <netinet/in.h> in an upcoming commit.

20 months agoRemove non-__STDC__ cases in a number of places.
Sascha Wildner [Sat, 21 Nov 2020 20:39:15 +0000 (21:39 +0100)]
Remove non-__STDC__ cases in a number of places.

We expect a standard C compiler for building DragonFly.

20 months agolibc: Make the signal name array uppercase.
Sascha Wildner [Sat, 21 Nov 2020 20:35:20 +0000 (21:35 +0100)]
libc: Make the signal name array uppercase.

This is to satisfy POSIX which requires that the string printed by
'kill -l <signal number>' shall be the name of the symbolic constant
(for example, SIGKILL) without the 'SIG' part.

This also fixes a number of sh(1) tests.

While here, sync a bit further with FreeBSD. Specifically, use
C99 designated initialization.

Taken-from: FreeBSD

20 months agosh(1) tests: fix ld-elf.so version for DragonFly.
Sascha Wildner [Sat, 21 Nov 2020 19:34:07 +0000 (20:34 +0100)]
sh(1) tests: fix ld-elf.so version for DragonFly.

20 months agotest/netperf: Fix "clobbered" warning.
Sepherosa Ziehau [Sat, 21 Nov 2020 11:43:58 +0000 (19:43 +0800)]
test/netperf: Fix "clobbered" warning.

20 months agoTest commit.
Sepherosa Ziehau [Sat, 21 Nov 2020 11:42:47 +0000 (19:42 +0800)]
Test commit.

20 months agousr.sbin/fstyp: Fix HAMMER1 partial volumes detection (-u option)
Tomohiro Kusumi [Fri, 20 Nov 2020 16:27:42 +0000 (01:27 +0900)]
usr.sbin/fstyp: Fix HAMMER1 partial volumes detection (-u option)

20 months agodhcpcd: update README
Roy Marples [Fri, 20 Nov 2020 14:30:06 +0000 (14:30 +0000)]
dhcpcd: update README

20 months agoMerge branch 'vendor/DHCPCD'
Roy Marples [Fri, 20 Nov 2020 14:28:05 +0000 (14:28 +0000)]
Merge branch 'vendor/DHCPCD'

20 months agodhcpcd: Update to dhcpcd-9.3.3 with the following changes:
Roy Marples [Fri, 20 Nov 2020 14:26:27 +0000 (14:26 +0000)]
dhcpcd: Update to dhcpcd-9.3.3 with the following changes:

 * dhcpcd: Don't create a launcher process if keeping in foreground
 * dhcpcd: Add --noconfigure option
 * control: Create an unpriv socket for non master mode
 * options: Don't log unknown ones when printing pidfile location

20 months agousr.sbin/fstyp: Properly support -l for HAMMER1
Tomohiro Kusumi [Thu, 19 Nov 2020 16:10:05 +0000 (01:10 +0900)]
usr.sbin/fstyp: Properly support -l for HAMMER1

20 months agousr.sbin/fstyp: Minor HAMMER1 fixes
Tomohiro Kusumi [Wed, 18 Nov 2020 16:38:06 +0000 (01:38 +0900)]
usr.sbin/fstyp: Minor HAMMER1 fixes

20 months agosbin/newfs_hammer2: Remove redundant \n in err/errx
Tomohiro Kusumi [Wed, 18 Nov 2020 15:46:41 +0000 (00:46 +0900)]
sbin/newfs_hammer2: Remove redundant \n in err/errx

20 months agosbin/hammer2: Add bulkfree_tid for "volhdr"
Tomohiro Kusumi [Wed, 18 Nov 2020 15:35:33 +0000 (00:35 +0900)]
sbin/hammer2: Add bulkfree_tid for "volhdr"

20 months ago<sys/callout.h>: Add a missing semicolon in the callout_set_arg() macro.
Sascha Wildner [Wed, 18 Nov 2020 13:11:34 +0000 (14:11 +0100)]
<sys/callout.h>: Add a missing semicolon in the callout_set_arg() macro.

Fixes buildkernel with WANT_NETGRAPH7.

20 months agodsynth: Enable 'install' and 'deinstall' phases on test.
Antonio Huete Jimenez [Tue, 17 Nov 2020 19:37:53 +0000 (20:37 +0100)]
dsynth: Enable 'install' and 'deinstall' phases on test.

20 months agodsynth: Remove any trace of 'install-mtree' phase.
Antonio Huete Jimenez [Tue, 17 Nov 2020 12:12:43 +0000 (13:12 +0100)]
dsynth: Remove any trace of 'install-mtree' phase.

  - It's an empty target, poudriere-specific and it will
    be removed from ports at some point.

20 months agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 17 Nov 2020 12:04:00 +0000 (13:04 +0100)]
Update the pciconf(8) database.

November 14, 2020 snapshot from https://pci-ids.ucw.cz

20 months agokernel - Rewrite the callout API, major structural changes (2)
Matthew Dillon [Mon, 16 Nov 2020 10:09:38 +0000 (02:09 -0800)]
kernel - Rewrite the callout API, major structural changes (2)

* Fix deadlock during recursive callback, triggered by the USB

  Basically we have to clear the SET bit immediately after setting
  INPROG, and also allow normal processing to occur synchronously
  from the same thread that dispatched the callback (normally INPROG
  prevents normal processing from occuring).

Reported-by: zrj
Matthew Dillon [Sun, 15 Nov 2020 19:41:26 +0000 (11:41 -0800)]


  This follows the linux and freebsd semantics, however it should be noted
  that since the child of a fork() clears the setting, these semantics have
  a fork/exit race between an exiting parent and a child which has not
  yet setup its death wish.

* Also fix a number of signal ranging checks.

Requested-by: zrj
20 months agokernel - Rewrite the callout API, major structural changes
Matthew Dillon [Fri, 13 Nov 2020 22:38:04 +0000 (14:38 -0800)]
kernel - Rewrite the callout API, major structural changes

* Make struct callout much smaller, primarily now just containing
  a pointer to a shadow structure which is allocated on first use.

  The callout backend uses this shadow structure on the callout
  lists instead of the embedded struct callout.  This should reduce
  occurances of untraceable panics due to list corruption.  Instead,
  the callout-v-shadow structure linkages are validated with an assertion
  and if this panics it should be possible to determine which subsystem
  was responsible from the kernel core.

* tsleep() etc is used early in the boot sequence and use some
  bypass functions to streamline operations and avoid allocation
  calls.  This should also improve tsleep()s performance a bit over
  the original implementation.

20 months agoSync ACPICA with Intel's version 20201113.
Sascha Wildner [Sun, 15 Nov 2020 01:36:51 +0000 (02:36 +0100)]
Sync ACPICA with Intel's version 20201113.

* Fix a memory leak that could occur in _HID repair.

* Improve namespace debugging.

* Handle "orphan" _REG methods.

* Improve iasl(8) and acpihelp(8).

* Add 5 new NVDIMM and NFIT table related UUIDs to the known UUID table.

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

20 months agodrm/linux: Add llist_for_each_entry() and llist_del_first()
François Tigeot [Fri, 13 Nov 2020 13:34:59 +0000 (14:34 +0100)]
drm/linux: Add llist_for_each_entry() and llist_del_first()

Obtained-from: OpenBSD

20 months agokernel: Add atomic_cas_ptr()
François Tigeot [Fri, 13 Nov 2020 13:17:40 +0000 (14:17 +0100)]
kernel: Add atomic_cas_ptr()

Obtained-from: OpenBSD

21 months agodrm/linux: Rewrite the workqueue implementation
François Tigeot [Wed, 11 Nov 2020 19:49:32 +0000 (20:49 +0100)]
drm/linux: Rewrite the workqueue implementation

Most workqueues now use one runner thread per logical CPU, except for
WQ_UNBOUND ones, which only have a single kernel thread.

This commit contains critical fixes from Matthew Dillon for multithread
interaction issues in queue_work() and the cancel functions.

21 months agodrm/linux: Add atomic_dec_if_positive()
François Tigeot [Tue, 10 Nov 2020 13:58:11 +0000 (14:58 +0100)]
drm/linux: Add atomic_dec_if_positive()

Obtained-from: FreeBSD

21 months agolibdialog: Add missing function attribute definitions. Raise WARNS to 6.
Sascha Wildner [Tue, 10 Nov 2020 10:03:28 +0000 (11:03 +0100)]
libdialog: Add missing function attribute definitions. Raise WARNS to 6.

For some reason, 'configure' does not define them ootb.

21 months agokernel/ufs: Add some __dead2 to the stubs for the non-SOFTUPDATES case.
Sascha Wildner [Mon, 9 Nov 2020 15:59:58 +0000 (16:59 +0100)]
kernel/ufs: Add some __dead2 to the stubs for the non-SOFTUPDATES case.

21 months agobuild - Adjust message output after a make build-all
Matthew Dillon [Mon, 9 Nov 2020 01:25:03 +0000 (17:25 -0800)]
build - Adjust message output after a make build-all

* Clarify that the recommended pkg upgrade -f should be run after
  rebooting into the new system.

21 months agodmesg - Check current directory when -n is used
Matthew Dillon [Mon, 9 Nov 2020 01:24:09 +0000 (17:24 -0800)]
dmesg - Check current directory when -n is used

* When -n is used, first check the current directory for kern.n and
  vmcore.n.  If either is not found, then check /var/crash as before.

21 months agokernel: Use howmany() in a couple of places.
Sascha Wildner [Sat, 7 Nov 2020 23:18:43 +0000 (00:18 +0100)]
kernel: Use howmany() in a couple of places.

21 months agokernel - Incorporate drm79.patch to master, cleaned up
Matthew Dillon [Sat, 7 Nov 2020 18:42:33 +0000 (10:42 -0800)]
kernel - Incorporate drm79.patch to master, cleaned up

* Should fix a number of niggling issues in master now,
  that are already incorporated into the next drm sync.

21 months agokernel - Change pager interface to pass page index 3/*
Matthew Dillon [Sat, 7 Nov 2020 18:19:17 +0000 (10:19 -0800)]
kernel - Change pager interface to pass page index 3/*

* Don't shortcut vm_object_page_remove() with a resident_page_count
  test for MGTDEVICE objects.  These objects are not required to have
  their VM pages entered into them.

* in vm_object_page_remove(), change pmap_remove_pages() to
  pmap_remove().  The former is meant to be used only in the
  exit code and does not bother with TLB synchronization.
  pmap_remove() properly handles any TLB synchronization.

21 months agoAdd a minimal kernel configuration file.
Sascha Wildner [Fri, 6 Nov 2020 16:13:14 +0000 (17:13 +0100)]
Add a minimal kernel configuration file.

For testing the kernel build without any options.

21 months agoLINT64: Note that 'ident' and 'cpu' are mandatory, too.
Sascha Wildner [Fri, 6 Nov 2020 16:10:05 +0000 (17:10 +0100)]
LINT64: Note that 'ident' and 'cpu' are mandatory, too.

21 months agokernel: Fix building without 'options _KPOSIX_PRIORITY_SCHEDULING'.
Sascha Wildner [Fri, 6 Nov 2020 15:06:40 +0000 (16:06 +0100)]
kernel: Fix building without 'options _KPOSIX_PRIORITY_SCHEDULING'.

Prototype generation for this case was broken after 80d831e1ad5c5886e458.

Reported-by: zrj
21 months agoUpgrade libressl. 2/2
Daniel Fojt [Wed, 4 Nov 2020 20:52:19 +0000 (21:52 +0100)]
Upgrade libressl. 2/2

Update README.{DELETED,DRAGONFLY} and adapt Makefiles.

21 months agoUpgrade libressl. 1/2
Daniel Fojt [Wed, 4 Nov 2020 20:19:57 +0000 (21:19 +0100)]
Upgrade libressl. 1/2

Merge branch 'vendor/LIBRESSL' into master.

21 months agovendor/libressl: upgrade from 3.1.4 to 3.2.2
Daniel Fojt [Tue, 3 Nov 2020 18:37:17 +0000 (19:37 +0100)]
vendor/libressl: upgrade from 3.1.4 to 3.2.2

Summary of notable changes:

  * new TLSv1.3 implementation enabled by default for both client
    and server

  * new X509 certificate chain validator that correctly handles
    multiple paths through intermediate certificates

  * new name constraints verification implementation which passes
    the bettertls.com certificate validation check suite

  * numerous leaks and out-of-bounds write fixed

  * many improvements, refactoring, optimizations and code cleanups

See ChangeLog for details.

21 months agokernel: Reindent a few functions that were not using tabs.
Sascha Wildner [Thu, 5 Nov 2020 05:04:55 +0000 (06:04 +0100)]
kernel: Reindent a few functions that were not using tabs.

While here, fix a typo in the comments.

21 months agokernel/amd{smn,temp}: Sync with FreeBSD.
Sascha Wildner [Thu, 5 Nov 2020 03:13:11 +0000 (04:13 +0100)]
kernel/amd{smn,temp}: Sync with FreeBSD.

Adds support for Ryzen 4000 APU (Zen 2, "Renoir").

Reported-by: zrj
21 months agolib/csu: Add ifunc support for statically linked programs.
zrj [Wed, 4 Nov 2020 10:31:21 +0000 (10:31 +0000)]
lib/csu: Add ifunc support for statically linked programs.

 This assumes that both _init_tls() and _rtld_call_init() paths in libc
 will not contain ifunc calls.  For now should be enough since there was
 no ifunc support previously.

Derived-from: NetBSD crt0-common.c implementation

21 months agortld: Handle non-PLT type 37 relocations.
zrj [Tue, 3 Nov 2020 17:28:17 +0000 (17:28 +0000)]
rtld: Handle non-PLT type 37 relocations.

 Mainly to unbreak certain use cases of ifunc.

21 months agortld: Extract reloc_iresolve_one().
zrj [Tue, 3 Nov 2020 17:22:11 +0000 (17:22 +0000)]
rtld: Extract reloc_iresolve_one().

 Will be used to properly handle non-PLT 37 ifunc relocations in -pie.

21 months agokernel - Change pager interface to pass page index 2/2
Matthew Dillon [Wed, 4 Nov 2020 21:51:40 +0000 (13:51 -0800)]
kernel - Change pager interface to pass page index 2/2

* Adjust the DRM calls to vm_pager_get_page() to pass the
  page index.

* Greatly simplify drm/linux_shmem.c and drm/ttm/ttm_bo_vm.c,
  removing the need to deal with placemarker pages for
  VM faults on OBJT_MGTDEVICE objects.

21 months agokernel - Change pager interface to pass page index 1/2
Matthew Dillon [Wed, 4 Nov 2020 21:49:03 +0000 (13:49 -0800)]
kernel - Change pager interface to pass page index 1/2

* Change the *getpage() API to include the page index as
  an argument.  This allows us to avoid passing any vm_page_t
  for OBJT_MGTDEVICE VM pages.

  By removing this requirement, the VM system no longer has to
  pre-allocate a placemarker page for DRM faults and the DRM
  system can directly install the page in the pmap without
  tracking it via a vm_page_t.

21 months agokernel - Fix uninitialized variable in kqueue_register()
Matthew Dillon [Wed, 4 Nov 2020 21:34:09 +0000 (13:34 -0800)]
kernel - Fix uninitialized variable in kqueue_register()

* Fix another uninitialized variable that gcc didn't detect,
  this time in kqueue_register().

* Caused kernel compiled with -O0 to not operate properly.

* Initializing the error variable to 0 solves the problem.

Reported-by: zrj
21 months agokernel - Fix missing initialization in vnode_pager_lock()
Matthew Dillon [Wed, 4 Nov 2020 18:35:22 +0000 (10:35 -0800)]
kernel - Fix missing initialization in vnode_pager_lock()

* struct vnode *vp was not being initialized to NULL, causing
  a garbage return not caught by gcc if no while() condition
  is met.

* Only occurred with -O0.  The optimized case doesn't seem to hit
  the issue through luck.

Reported-by: zrj
21 months agosys/vfs/hammer2: Illustrate level1-6 freemap
Tomohiro Kusumi [Tue, 3 Nov 2020 16:30:19 +0000 (01:30 +0900)]
sys/vfs/hammer2: Illustrate level1-6 freemap

21 months agokernel: Avoid spurious diagnostic with older gcc47.
zrj [Mon, 2 Nov 2020 18:38:20 +0000 (18:38 +0000)]
kernel: Avoid spurious diagnostic with older gcc47.

21 months agobsd.sys.mk: Make -Wmissing-field-initializers non-fatal.
zrj [Mon, 2 Nov 2020 18:34:45 +0000 (18:34 +0000)]
bsd.sys.mk: Make -Wmissing-field-initializers non-fatal.

 It was decided that gcc47 gives few diagnostics wrongly in C99 mode.

21 months agoSync zoneinfo database with tzdata2020d from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Sun, 1 Nov 2020 20:45:06 +0000 (21:45 +0100)]
Sync zoneinfo database with tzdata2020d from ftp://ftp.iana.org/tz/releases

* Palestine ends DST earlier than predicted, on 2020-10-24.

* Fiji starts DST later than usual, on 2020-12-20.

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

21 months agoscript.7: Fix description of the length of the '#!' line.
Sascha Wildner [Sun, 1 Nov 2020 19:59:43 +0000 (20:59 +0100)]
script.7: Fix description of the length of the '#!' line.

21 months agoenviron.7: Sync with FreeBSD.
Sascha Wildner [Sun, 1 Nov 2020 19:58:49 +0000 (20:58 +0100)]
environ.7: Sync with FreeBSD.

21 months agokernel: fix getcwd(3) return value for non-existing directory
Daniel Fojt [Sun, 1 Nov 2020 16:53:52 +0000 (17:53 +0100)]
kernel: fix getcwd(3) return value for non-existing directory

In case current directory no longer exists, properly return ENOENT
from getcwd(), as described in manpage.

Issue: https://bugs.dragonflybsd.org/issues/3250

21 months agosys/vfs/hammer2: Remove obsolete comment on copyids
Tomohiro Kusumi [Sun, 1 Nov 2020 15:10:09 +0000 (00:10 +0900)]
sys/vfs/hammer2: Remove obsolete comment on copyids

copyids in inode was removed in
ae183399278ee71fba31527cd18a7545ac9af2e4 in 2012.

21 months agoNote dhcpcd update
Roy Marples [Sun, 1 Nov 2020 14:37:48 +0000 (14:37 +0000)]
Note dhcpcd update

21 months agoMerge branch 'vendor/DHCPCD'
Roy Marples [Sun, 1 Nov 2020 14:35:46 +0000 (14:35 +0000)]
Merge branch 'vendor/DHCPCD'

21 months agoUpdate to dhcpcd-9.3.2 with the following changes:
Roy Marples [Sun, 1 Nov 2020 14:33:08 +0000 (14:33 +0000)]
Update to dhcpcd-9.3.2 with the following changes:

 * DHCP: Add support for IPv6-Only Preferred option, RFC 8925.
 * BSD: `LINK_STATE_UNKNOWN` is treated as UP once again
 * privsep: pass logging to the privileged actioneer
 * privsep: allow logfile re-opening to work
 * privsep: close BPF socket on ENXIO
 * privsep: don't leave a BOOTP BPF listener rebooting in non master mode

21 months agoboot/pc32: Fix ambiguity in legacy loaders for Hammer selection.
zrj [Sat, 31 Oct 2020 19:19:42 +0000 (19:19 +0000)]
boot/pc32: Fix ambiguity in legacy loaders for Hammer selection.

 Explicitly name both variants.  Default Hammer2 stays in legacy loader.
 Allow to built loader with HAMMER(5) support for testing purposes.
 Adjust libstand(3).

21 months agoboot/pc32: Reorder fs probe list.
zrj [Sat, 31 Oct 2020 18:57:55 +0000 (18:57 +0000)]
boot/pc32: Reorder fs probe list.

 Sort by: disk, cd, net, file.
 This should increase lookup speed for network loaders.

21 months agoboot/pc32: Conditionalize splitfs support in legacy loaders.
zrj [Sat, 31 Oct 2020 18:11:03 +0000 (18:11 +0000)]
boot/pc32: Conditionalize splitfs support in legacy loaders.

 This floppy feature was inherited and not so useful anymore.  Disabling
 it reduces filename lookups by half.  Also put it last, if enabled.

21 months agoSwitch to ld.bfd as default ld for world stage.
zrj [Sat, 31 Oct 2020 09:12:38 +0000 (09:12 +0000)]
Switch to ld.bfd as default ld for world stage.

 Until boot/efi issues are resolved:
 * ld.gold not respecting linker script for section merges;
 * clang built boot1.efi and loader.efi failures.

 Default can be restored by setting WORLD_LDVER=ld.gold in make.conf(5).
 Final installed ld(1) will still default to ld.gold to not disturb
 things in DPorts.

 NOTE: this might produce different final binaries if building in tree,
 but it should not be fatal as we support both ld.bfd and ld.gold.
 Use "make LDVER=ld.bfd" to mimic buildworld behaviour when needed.

21 months agoSwitch to binutils234 as default base binutils.
zrj [Sat, 31 Oct 2020 08:31:02 +0000 (08:31 +0000)]
Switch to binutils234 as default base binutils.

21 months agoboot/efi: Objcopy more sections to final *.efi objects.
zrj [Sat, 31 Oct 2020 08:29:40 +0000 (08:29 +0000)]
boot/efi: Objcopy more sections to final *.efi objects.

 Unbreaks uefi boot with when compiled with ld.gold from binutils234.

21 months agoboot/pc32: Consistently disable integrated-as for intermediates.
zrj [Sat, 31 Oct 2020 06:44:42 +0000 (06:44 +0000)]
boot/pc32: Consistently disable integrated-as for intermediates.

 This ensures that produced assembly intermediates are compatible with
 external as(1) when compiling with clang.

21 months agokernel: Disable use of clang's integrated as.
zrj [Sat, 31 Oct 2020 06:42:39 +0000 (06:42 +0000)]
kernel: Disable use of clang's integrated as.

21 months agodsynth(1): Ignore dot files in CRC sums.
zrj [Sat, 31 Oct 2020 06:40:22 +0000 (06:40 +0000)]
dsynth(1): Ignore dot files in CRC sums.

21 months agocpdup - Bump version to 1.22
Matthew Dillon [Fri, 30 Oct 2020 21:47:58 +0000 (14:47 -0700)]
cpdup - Bump version to 1.22

* Bump cpdup version to 1.22 (supporting symlink utimes/etc)

21 months agocpdup - Add support for lchmod(), lutimes(), and lchflags()
Matthew Dillon [Fri, 30 Oct 2020 21:43:52 +0000 (14:43 -0700)]
cpdup - Add support for lchmod(), lutimes(), and lchflags()

* Add support for these functions, allowing symlinks to be fully

* Fix issues when the destination of a rename is chflagged in a way
  that causes the rename to fail.

* Delete temporary files when a rename files.

* Set SrcHost/DstHost.version for local sources or targets
  to make version tests easier.

Reported-by: Oliver Fromme
21 months agokernel - Fix buffer overflow in legacy (non EFI) boot loader
Matthew Dillon [Fri, 30 Oct 2020 18:25:23 +0000 (11:25 -0700)]
kernel - Fix buffer overflow in legacy (non EFI) boot loader

* Fix a buffer overflow primarily in bd_read().  The code contains
  a work-around for segment boundary crossings that very old BIOSes
  would sometimes blow-up on, but was improperly calculating the
  bounce-buffer I/O limit to be the full bounce-buffer size
  instead of 1/2 the bounce buffer size.

  Thus if the bounce buffer's base address happened to be certain
  values, large I/O requests would overflow the buffer.

* Make sure the bounce-buffer is 16-byte aligned, again for old

Reported-by: zrj
Debugging-by: dillon, zrj, Naabed-
21 months agobsd-family-tree: Sync with FreeBSD (FreeBSD 12.2).
Sascha Wildner [Fri, 30 Oct 2020 17:20:05 +0000 (18:20 +0100)]
bsd-family-tree: Sync with FreeBSD (FreeBSD 12.2).

21 months agobsd.own.mk: Remove some obsolete variables.
Sascha Wildner [Thu, 29 Oct 2020 20:59:53 +0000 (21:59 +0100)]
bsd.own.mk: Remove some obsolete variables.

Those were overlooked in c880cbafebe60271ee and 086b69d307ad34d5d4.

21 months agokernel - Fix slow memory leak in kernel
Matthew Dillon [Wed, 28 Oct 2020 18:23:00 +0000 (11:23 -0700)]
kernel - Fix slow memory leak in kernel

* Fix a slow memory leak with the resource limit structure when
  forking a heavily-threaded process.

* Fixes a kmalloc limit panic related to M_PLIMIT.

Reported-by: tuxillo
21 months agosys/vfs/hammer2: Remove #if0'd code using removed function
Tomohiro Kusumi [Mon, 26 Oct 2020 15:54:16 +0000 (00:54 +0900)]
sys/vfs/hammer2: Remove #if0'd code using removed function

hammer2_sync_scan2() was removed in
ecfe89b8868b30c9ddfa9c86cb4b0a20365a248d in 2018,
so remove #if0'd code using hammer2_sync_scan2().

21 months agosys/vfs/hammer2: Remove unused hammer2_dev_{ex,sh,un}lock()
Tomohiro Kusumi [Mon, 26 Oct 2020 15:11:23 +0000 (00:11 +0900)]
sys/vfs/hammer2: Remove unused hammer2_dev_{ex,sh,un}lock()

Added in 506bd6d145b6429947d572e34575b4a2a864193c in 2015,
but unused since 6f445d15835c6677a0a79c8d168ef44d0b9b22c3 in 2018.

It currently takes vchain lock via hammer2_chain_lock(),
so this function won't be needed or used again.

21 months agosys/vfs/hammer2: Fix comments on rbtree which should be radix tree
Tomohiro Kusumi [Sun, 25 Oct 2020 16:41:23 +0000 (01:41 +0900)]
sys/vfs/hammer2: Fix comments on rbtree which should be radix tree