2 years agoUpgrade libressl. 1/2
Daniel Fojt [Thu, 10 Dec 2020 19:16:14 +0000 (20:16 +0100)]
Upgrade libressl. 1/2

Merge branch 'vendor/LIBRESSL' into master.

2 years agovendor/libressl: upgrade from 3.2.2 to 3.2.3
Daniel Fojt [Thu, 10 Dec 2020 17:13:07 +0000 (18:13 +0100)]
vendor/libressl: upgrade from 3.2.2 to 3.2.3

Fixes ASN.1 vulnerability (aka CVE-2020-1971):

* Malformed ASN.1 in a certificate revocation list or a timestamp
  response token can lead to a NULL pointer dereference

2 years agosys/vfs/ext2fs: In ext2 BA_CLRBUF is used in ext2_balloc() not UFS_BALLOC()
Tomohiro Kusumi [Thu, 10 Dec 2020 16:00:13 +0000 (01:00 +0900)]
sys/vfs/ext2fs: In ext2 BA_CLRBUF is used in ext2_balloc() not UFS_BALLOC()

from freebsd/freebsd@262611483aad9f91d0450b5fc6b41a4075fc5ba4

2 years agovkernel: Add extra space.
Sascha Wildner [Thu, 10 Dec 2020 14:53:31 +0000 (15:53 +0100)]
vkernel: Add extra space.

2 years agokernel/mmap_single: Pass a_fp properly into the *_mmap_single dev op.
Sascha Wildner [Wed, 9 Dec 2020 19:31:20 +0000 (20:31 +0100)]
kernel/mmap_single: Pass a_fp properly into the *_mmap_single dev op.

Follow-up to 8c530b23e3584f72dc8c660b3816187017eeeb6b which passed NULL

Nothing is broken because of this at the moment but it will be useful
for drivers that want to access per-fp private data (with for example
devfs_get_cdevpriv()) from their blah_mmap_single() dev_ops function.

OK'd-by: dillon

2 years agoedk2: Sync our TianoCore EDK II headers with the edk2-stable202011 tag.
Sascha Wildner [Wed, 9 Dec 2020 16:17:25 +0000 (17:17 +0100)]
edk2: Sync our TianoCore EDK II headers with the edk2-stable202011 tag.

Nothing of importance to us.

* Add ACPI's Interrupt Vector Flags

* Remove various prototypes of deprecated interfaces

* Bump block I/O protocol revision


2 years agoinet6_opt_init.3: Use standard integer types in the SYNOPSIS.
Sascha Wildner [Tue, 8 Dec 2020 22:35:39 +0000 (23:35 +0100)]
inet6_opt_init.3: Use standard integer types in the SYNOPSIS.

2 years agosbin/hammer2: Remove 0x prefix for blockref data_off/key in "show"
Tomohiro Kusumi [Tue, 8 Dec 2020 19:17:17 +0000 (04:17 +0900)]
sbin/hammer2: Remove 0x prefix for blockref data_off/key in "show"

Other blockref fields don't have 0x prefix.
Quiet mode also doesn't have 0x prefix for data_off/key.

2 years agousr.sbin/fstyp: Don't fail fsvtyp with err(3) on fopen failure
Tomohiro Kusumi [Tue, 8 Dec 2020 17:16:49 +0000 (02:16 +0900)]
usr.sbin/fstyp: Don't fail fsvtyp with err(3) on fopen failure

fsvtyp vectors (currently only for HAMMER1) need to open device(s),
but don't exit with err(3) on fopen failure. This behavior interferes
with fsvtyp for HAMMER2 when it gets supported in future.

2 years agoip: Allow ip_mreqn support for IP_MULTICAST_IF,IP_{ADD,DROP}_MEMBERSHIP
Sepherosa Ziehau [Mon, 7 Dec 2020 15:16:53 +0000 (23:16 +0800)]
ip: Allow ip_mreqn support for IP_MULTICAST_IF,IP_{ADD,DROP}_MEMBERSHIP

- ip_mreqn.imr_ifindex takes precendence over ip_mreqn.imr_address,
  if it's not 0.  This strictly follows what Linux does.
- Allow ip_mreq for IP_MULTICAST_IF as what Linux does.

While I'm here, remove unnecessary critical section among

Bump kernel version.

Requested-by: tuxillo
2 years agosys/vfs/ext2fs: Document BA_CLRBUF flag used in ext2
Tomohiro Kusumi [Mon, 7 Dec 2020 15:44:40 +0000 (00:44 +0900)]
sys/vfs/ext2fs: Document BA_CLRBUF flag used in ext2

from freebsd/freebsd@137374ad40a464a4c47db068682a3cd0c724cdaf

2 years agosys/vfs/hammer2: Minor kprintf fix
Tomohiro Kusumi [Sat, 5 Dec 2020 19:02:56 +0000 (04:02 +0900)]
sys/vfs/hammer2: Minor kprintf fix

2 years agosys/vfs/hammer2: Add missing vrele in b15468809847b3946cceaf7c4fb471ae94d96f53
Tomohiro Kusumi [Fri, 4 Dec 2020 18:12:59 +0000 (03:12 +0900)]
sys/vfs/hammer2: Add missing vrele in b15468809847b3946cceaf7c4fb471ae94d96f53

2 years agokern: Bump kernel version for IPPROTO_IP/IP_SENDSRCADDR,IP_TOS.
Sepherosa Ziehau [Fri, 4 Dec 2020 12:45:25 +0000 (20:45 +0800)]
kern: Bump kernel version for IPPROTO_IP/IP_SENDSRCADDR,IP_TOS.

2 years agoudp: Port IPPROTO_IP/IP_TOS cmsg support from FreeBSD.
Sepherosa Ziehau [Fri, 4 Dec 2020 12:43:15 +0000 (20:43 +0800)]
udp: Port IPPROTO_IP/IP_TOS cmsg support from FreeBSD.

2 years agoinet: Port IPPROTO/IP_RECVTOS from FreeBSD.
Sepherosa Ziehau [Fri, 4 Dec 2020 11:57:34 +0000 (19:57 +0800)]
inet: Port IPPROTO/IP_RECVTOS from FreeBSD.

Bump kernel version.

Requested-by: zrj
2 years agovkernel/vke: Add missing semicolon.
Sascha Wildner [Fri, 4 Dec 2020 11:49:03 +0000 (12:49 +0100)]
vkernel/vke: Add missing semicolon.

2 years agokernel/dup: Fix off-by-one in descriptor limit check.
Sascha Wildner [Wed, 2 Dec 2020 19:35:27 +0000 (20:35 +0100)]
kernel/dup: Fix off-by-one in descriptor limit check.

Reported-by: zrj (found by gnulib's tests)
2 years agoifmedia: Port SIOCGIFXMEDIA from FreeBSD
Sepherosa Ziehau [Wed, 2 Dec 2020 12:58:04 +0000 (20:58 +0800)]
ifmedia: Port SIOCGIFXMEDIA from FreeBSD

- Max # of media type is 255 on DragonFly; additional bit was used.
- Description of the media is changed to ###baseXX instead of
  ###Base-XX; it is more consistent with what we already have.
- Fix some media types in vke(4), e.g. 1000baseT <half-duplex>
  is actually never deployed anywhere.
- Use ULL consistently in bce(4) for the if_baudrate.
- Setup if_baudrate properly for re(4).
- Fix typo in mii(4).
- Handle SIOCGIFXMEDIA in re(4) (for 2500baseT) and vke(4) (for
  all newly added types).
- Bump kernel version.

2 years agolibaura: More tests for dicts, duplicate handling
Antonio Huete Jimenez [Mon, 30 Nov 2020 17:28:17 +0000 (18:28 +0100)]
libaura: More tests for dicts, duplicate handling

2 years agolibaura: Add another test for dicts
Antonio Huete Jimenez [Mon, 30 Nov 2020 14:42:11 +0000 (15:42 +0100)]
libaura: Add another test for dicts

2 years agolibaura: Return NULL in some cases.
Antonio Huete Jimenez [Mon, 30 Nov 2020 09:01:28 +0000 (10:01 +0100)]
libaura: Return NULL in some cases.

  - Fail if there's not enough memory for allocating
    num_buckets or if the method is unknown.
  - Add test.

2 years agolibaura: Staticize non-interface functions
Antonio Huete Jimenez [Sat, 28 Nov 2020 07:37:20 +0000 (08:37 +0100)]
libaura: Staticize non-interface functions

2 years agobce: Use IF_Mbps to avoid float number in kernel.
Sepherosa Ziehau [Mon, 30 Nov 2020 14:36:31 +0000 (22:36 +0800)]
bce: Use IF_Mbps to avoid float number in kernel.

Reported-by: zrj
2 years agore: Sync with Realtek's re-196.04; and fix re_start/re_tx_collect.
Sepherosa Ziehau [Wed, 4 Nov 2020 12:35:53 +0000 (20:35 +0800)]
re: Sync with Realtek's re-196.04; and fix re_start/re_tx_collect.

- Add several new chips' support, noticably RTL8125 support.
- Reorder chip related initializaton on the attach path a bit;
  mainly to make sure ifnet is initialized.
- In re_start(), solely rely on the re_tx_free for the TX descriptor
  setup loop.  This avoids the fixup on the end of the loop.  Add
  assertion that the TX descriptor's corresponding mbuf is not setup
- On RTL8125, the EOF in the TX descriptor is no longer left uncleared
  upon TX done, so simply rely on whether the TX descriptor's
  corresponding mbuf is set or not to unload the busdma(9) and free the
  TX mbuf.  We actually should do this instead of rely on the EOF.

Tested-by: me (8101, 8111, 8168, 8125)
    Romick <yellowrabbit2010 gmail.com> (8111)
    Daniel Fojt <df neosystem.org> (8111)

2 years agosys/vfs/hammer2: Make kprintf prefix consistent
Tomohiro Kusumi [Mon, 30 Nov 2020 15:06:34 +0000 (00:06 +0900)]
sys/vfs/hammer2: Make kprintf prefix consistent

2 years agosys/vfs/hammer2: Don't ignore vn_isdisk() result on mount
Tomohiro Kusumi [Mon, 30 Nov 2020 15:07:40 +0000 (00:07 +0900)]
sys/vfs/hammer2: Don't ignore vn_isdisk() result on mount

2 years agonrelease: Define BUILDING_NRELEASE_DPORTS when building packages.
Sascha Wildner [Sun, 29 Nov 2020 09:46:13 +0000 (10:46 +0100)]
nrelease: Define BUILDING_NRELEASE_DPORTS when building packages.

Requested by zrj to allow further optimization at the ports level.

2 years agoUpdate dhcpcd README.DRAGONFLY
Roy Marples [Sat, 28 Nov 2020 14:41:39 +0000 (14:41 +0000)]

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

2 years 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

2 years 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>.

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

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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
2 years 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
2 years 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
2 years 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.

2 years 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.

2 years 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.

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

2 years 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.

2 years 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.

2 years 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
2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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.

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

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

2 years 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)

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

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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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"

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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
2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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
2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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
2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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
2 years 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