openbsd
2 years agodocument i2a_ASN1_STRING(3) and a2i_ASN1_STRING(3)
schwarze [Mon, 15 Nov 2021 10:41:11 +0000 (10:41 +0000)]
document i2a_ASN1_STRING(3) and a2i_ASN1_STRING(3)

2 years agoFix a strange check in the auto DH codepath
tb [Sun, 14 Nov 2021 22:31:29 +0000 (22:31 +0000)]
Fix a strange check in the auto DH codepath

The code assumes that the server certificate has an RSA key and bases
the calculation of the size of the ephemeral DH key on this assumption.
So instead of checking whether we have any key by inspecting the dh
part of the union, let's check that we actually have an RSA key.
While here, make sure that its length is non-negative.

ok jsing

2 years agoDelete all the no-op RELOC_GOT() macros and their uses.
guenther [Sun, 14 Nov 2021 22:07:38 +0000 (22:07 +0000)]
Delete all the no-op RELOC_GOT() macros and their uses.
Annotate RELOC_DYN() on non-hppa as only used in lib/csu.
Delete some inconsistent comments, adjust whitespace, and reorder
  mips64's archdep.h so that the ld.so/*/archdep.h files look
  (almost) the same.

ok visa@ kettenis@

2 years agoMake sure efiboot is built with RELA/REL relocations and not RELR,
guenther [Sun, 14 Nov 2021 21:51:48 +0000 (21:51 +0000)]
Make sure efiboot is built with RELA/REL relocations and not RELR,
as self_reloc.c only handles the former.

ok deraadt@ kettenis@

2 years agouse ppoll() instead of pselect()
deraadt [Sun, 14 Nov 2021 18:47:43 +0000 (18:47 +0000)]
use ppoll() instead of pselect()
with djm

2 years agoWhen we transition from RENEWING to REBINDING state we have to
florian [Sun, 14 Nov 2021 18:13:19 +0000 (18:13 +0000)]
When we transition from RENEWING to REBINDING state we have to
calculate the next timeout based on the rebinding time (T2), not
renewal time (T1). At this point T1 already expired and we would wait
way too long, past the lease lifetime.

Spotted while investigating a problem reported by Zack Newman on misc@

2 years agoCalculate initial OpenBSD partition start/size using LBA values
krw [Sun, 14 Nov 2021 17:28:29 +0000 (17:28 +0000)]
Calculate initial OpenBSD partition start/size using LBA values
instead of CHS values. Shorter, easier to follow.

No intentional functional change.

2 years agothe last argument of BIO_gets(3) is called "size", not "len"
schwarze [Sun, 14 Nov 2021 13:40:16 +0000 (13:40 +0000)]
the last argument of BIO_gets(3) is called "size", not "len"

2 years agofix a typo; diff from Matthias Schmidt <xosc dot org> on tech@
schwarze [Sun, 14 Nov 2021 11:22:36 +0000 (11:22 +0000)]
fix a typo; diff from Matthias Schmidt <xosc dot org> on tech@

2 years agoImprove and simplify timer handling in "stop" and "reload".
ajacoutot [Sun, 14 Nov 2021 09:31:44 +0000 (09:31 +0000)]
Improve and simplify timer handling in "stop" and "reload".
Rename _rc_wait to _rc_wait_for_start since only "start" uses this now (to
handle rc_bg daemons).
In any situation, none of these actions should be able to hang boot or shutdown.

We should now be able to manage most corner cases out there ("most" because it's
unreasonable to assume we can cope with all the non-default
rc_{start,stop,reload} crazyness).

Several tests have been made and no obvious regression has been found.
But that doesn't mean there isn't; if some behavior changed for the worst, talk
to me.

ok robert@ sthen@

2 years agoPut curly brace on the correct line.
jsing [Sun, 14 Nov 2021 08:21:47 +0000 (08:21 +0000)]
Put curly brace on the correct line.

2 years agomatch .events with .fd better
deraadt [Sun, 14 Nov 2021 06:15:36 +0000 (06:15 +0000)]
match .events with .fd better

2 years agoconvert select() to poll()
deraadt [Sun, 14 Nov 2021 03:25:10 +0000 (03:25 +0000)]
convert select() to poll()
ok djm

2 years ago"autoconf" is an automatic "up"
kn [Sun, 14 Nov 2021 03:02:06 +0000 (03:02 +0000)]
"autoconf" is an automatic "up"

OK deraadt

2 years agoSplit out the hppa and mips64 versions of boot.h similar to how I
guenther [Sun, 14 Nov 2021 00:45:38 +0000 (00:45 +0000)]
Split out the hppa and mips64 versions of boot.h similar to how I
split ld.so/boot.c in 2019:
 * delete extraneous #includes
 * delete jmprel handling on non-hppa
 * delete RELOC_GOT() and DT_PROC bits on non-mips64

ok visa@

2 years agoCatch up with (proposed) Linux device tree bindings.
kettenis [Sat, 13 Nov 2021 23:24:24 +0000 (23:24 +0000)]
Catch up with (proposed) Linux device tree bindings.

2 years agoreplace select() with ppoll(), including converting timeval's to timespec's
deraadt [Sat, 13 Nov 2021 21:14:13 +0000 (21:14 +0000)]
replace select() with ppoll(), including converting timeval's to timespec's
to make things easier.
back and forth and ok; djm

2 years agoThe key/nonce disclaimers were copied from ipsec.conf.5 but aren't relevant
tobhe [Sat, 13 Nov 2021 20:56:51 +0000 (20:56 +0000)]
The key/nonce disclaimers were copied from ipsec.conf.5 but aren't relevant
to iked. Encryption keys and nonces are generated by the handshake and don't
have to be supplied in the config.

2 years agoTest ASN1_STRING_copy(3).
schwarze [Sat, 13 Nov 2021 20:50:14 +0000 (20:50 +0000)]
Test ASN1_STRING_copy(3).

As a side effect, this also tests various aspects of ASN1_STRING_new(3),
ASN1_STRING_set(3), ASN1_STRING_length_set(3), ASN1_STRING_get0_data(3),
ASN1_STRING_length(3), and ASN1_STRING_type(3).

2 years agoFix a nasty quirk in ASN1_STRING_copy(3).
schwarze [Sat, 13 Nov 2021 20:44:00 +0000 (20:44 +0000)]
Fix a nasty quirk in ASN1_STRING_copy(3).
In case of failure, it reported the failure
but corrupted the type of the destination string.
Instead, let's make sure that in case of failure,
existing objects remain in their original state.

OK tb@

2 years agoDocument the interactions of X509_V_FLAG_USE_CHECK_TIME,
schwarze [Sat, 13 Nov 2021 19:21:17 +0000 (19:21 +0000)]
Document the interactions of X509_V_FLAG_USE_CHECK_TIME,
X509_V_FLAG_NO_CHECK_TIME, X509_VERIFY_PARAM_set_time(3),
X509_VERIFY_PARAM_set_flags(3), and X509_VERIFY_PARAM_clear_flags(3)
in detail because the API design is both surprising and surprisingly
complicated in this respect, and the resulting nasty traps have
already caused bugs in the past.

2 years agoMark the public X509_VP_FLAG_* constants as intentionally undocumented.
schwarze [Sat, 13 Nov 2021 18:50:31 +0000 (18:50 +0000)]
Mark the public X509_VP_FLAG_* constants as intentionally undocumented.
With LibreSSL, they can only be used internally in the library itself,
and even with OpenSSL, no real-world application code uses them.
OK tb@

2 years agoFix a bug in check_crl_time() that could result in incomplete
schwarze [Sat, 13 Nov 2021 18:24:45 +0000 (18:24 +0000)]
Fix a bug in check_crl_time() that could result in incomplete
verification, accepting CRLs that ought to be rejected, if an unusual
combination of verification flags was specified.

If time verification was explicitly requested with
X509_V_FLAG_USE_CHECK_TIME, it was skipped on CRLs if
X509_V_FLAG_NO_CHECK_TIME was also set, even though the former is
documented to override the latter both in the OpenSSL and in the
LibreSSL X509_VERIFY_PARAM_set_flags(3) manual page.

The same bug in x509_check_cert_time() was already fixed by beck@
in rev. 1.57 on 2017/01/20.

This syncs the beginning of the function check_crl_time() with the
OpenSSL 1.1.1 branch, which is still under a free license.

OK beck@

This teaches that having too many flags and options is bad because they
breed bugs, and even more so if they are poorly designed to override
each other in surprising ways.

2 years agoUse long filenames by default on FAT filesystems
kn [Sat, 13 Nov 2021 18:18:59 +0000 (18:18 +0000)]
Use long filenames by default on FAT filesystems

These days, 8.3 filenames are often a problem, filesystems containing
firmware with long names must not truncate them -- it's also a sane default
as portable file system between OSes, anyway.

Altough undocumented in mount_msdos(8), the default for FAT32 already is to
use long filenames:  ever since its import from NetBSD in 1998.

Previously, mount_msdos would ignore long filenames and default to short
filenames unless a flag was used or long ones were found on the filesystem
prior to mounting it.

Just always mount with support for long filenames (unless `-s' is used).

As various install media use FAT filesystems, adjust the remaining ones to
also pass explicit mount option reflecting the previous default.

OK deraadt

2 years agoSimplify address family handling, ditch inet_ntop(3)
kn [Sat, 13 Nov 2021 17:49:40 +0000 (17:49 +0000)]
Simplify address family handling, ditch inet_ntop(3)

Reduce duplicate code, use getnameinfo(3) for IPv4 as well and use
gai_strerror(3) in case of failure.

This was split out as part of the previous IPv6-LL fix.

2 years agoInstall missing scope identifier for IPv6 link-local addresses
kn [Sat, 13 Nov 2021 17:32:46 +0000 (17:32 +0000)]
Install missing scope identifier for IPv6 link-local addresses

RTM_PROPOSAL's list of IP addresses does not contain scope IDs by design.
This is not a problem as the proposal is always bound to an interface,
as long as we use it...

Fill in the scope ID for link-local IPs and replace inet_ntop(3) usage with
getnameinfo(3) in the IPv6 case such that it actually turns up in the string
representation.

Otherwise resolv.conf(5) ends up with "nameserver fe80::1" entries and
libc/asr won't be able to resolve without an interface.

2 years agoIt really looks like pledge "stdio dns" is possible earlier.
deraadt [Sat, 13 Nov 2021 17:26:13 +0000 (17:26 +0000)]
It really looks like pledge "stdio dns" is possible earlier.
Discussed with mestre

2 years agodocument ASN1_STRING_copy(3)
schwarze [Sat, 13 Nov 2021 17:12:18 +0000 (17:12 +0000)]
document ASN1_STRING_copy(3)

2 years agoUse a proper PKGPATH in the WRKOBJDIR example
kn [Sat, 13 Nov 2021 12:09:30 +0000 (12:09 +0000)]
Use a proper PKGPATH in the WRKOBJDIR example

www/mozilla is a module, www/mozilla-firefox is an actual port.

OK sthen

2 years agoUn-hook the X11 tests. The new X server doesn't install libfb anymore.
matthieu [Sat, 13 Nov 2021 08:48:50 +0000 (08:48 +0000)]
Un-hook the X11 tests. The new X server doesn't install libfb anymore.
ok kettenis@, anton@

2 years agohook up unfdpassfail and ungc
anton [Sat, 13 Nov 2021 08:25:42 +0000 (08:25 +0000)]
hook up unfdpassfail and ungc

2 years agoLet filt_fileattach() run without the kernel lock
visa [Sat, 13 Nov 2021 06:04:02 +0000 (06:04 +0000)]
Let filt_fileattach() run without the kernel lock

This makes it possible to attach pipe, socket and kqueue event filters
without acquiring the kernel lock. Event filters behind vn_kqfilter()
are not MP-safe yet, so vn_kqfilter() has to take KERNEL_LOCK().
dmabuf_kqfilter() can skip locking because it has no side effects.

OK anton@, mpi@

2 years agoAdd support for RELR relocations in the executable and share objects.
guenther [Fri, 12 Nov 2021 22:28:13 +0000 (22:28 +0000)]
Add support for RELR relocations in the executable and share objects.
This doesn't affect ld.so's self-reloc, which still requires DT_REL/DT_RELA

ok kettenis@

2 years agoTeach binutils enough about RELR relocations to not break them and for
guenther [Fri, 12 Nov 2021 22:23:40 +0000 (22:23 +0000)]
Teach binutils enough about RELR relocations to not break them and for
readelf to display them in a way compatible with llvm-readelf, including
the --raw-relr debugging option

ok kettenis@

2 years agoAdd #defines and typedefs for RELR, a compressed form for relative relocations
guenther [Fri, 12 Nov 2021 22:20:57 +0000 (22:20 +0000)]
Add #defines and typedefs for RELR, a compressed form for relative relocations

ok kettenis@

2 years agoDocument the public constants X509_V_FLAG_POLICY_MASK
schwarze [Fri, 12 Nov 2021 18:56:00 +0000 (18:56 +0000)]
Document the public constants X509_V_FLAG_POLICY_MASK
and X509_V_FLAG_USE_CHECK_TIME.

While here, fix a typo and improve the wording
for X509_V_FLAG_NOTIFY_POLICY.

2 years agosigsuspend(2): sleep on &nowake channel
cheloha [Fri, 12 Nov 2021 17:57:13 +0000 (17:57 +0000)]
sigsuspend(2): sleep on &nowake channel

sigsuspend(2) only returns upon delivery of a signal: we do not expect
a wakeup(9).  Indicate this by sleeping on &nowake instead of
&p->p_p->ps_sigacts.  We still need to loop here to handle spurious
wakeups, though.

Spurious wakeup case pointed out by kettenis@.

ok claudio@

2 years agoAdd support for controlling keyboard LEDs.
kettenis [Fri, 12 Nov 2021 17:05:15 +0000 (17:05 +0000)]
Add support for controlling keyboard LEDs.

ok patrick@

2 years agoUse a mutex to lock the bus such that we can safely access the bus from
kettenis [Fri, 12 Nov 2021 17:04:32 +0000 (17:04 +0000)]
Use a mutex to lock the bus such that we can safely access the bus from
interrupt handlers and process context.

ok patrick@

2 years agoImplement the probe variable. Can be used for example with
claudio [Fri, 12 Nov 2021 16:57:24 +0000 (16:57 +0000)]
Implement the probe variable. Can be used for example with
@map[probe] = count();
OK mpi@

2 years ago"netconfigd" is now better known as resolvd(8)
deraadt [Fri, 12 Nov 2021 15:49:41 +0000 (15:49 +0000)]
"netconfigd" is now better known as resolvd(8)

2 years agoBump maxproc-cur to 512 for the pbuild user.
ajacoutot [Fri, 12 Nov 2021 15:40:19 +0000 (15:40 +0000)]
Bump maxproc-cur to 512 for the pbuild user.
This will prevent recurring failures in bulks ('cannot fork').

ok tb@ sthen@ deraadt@

2 years agoUpdate awk to Nov 03, 2021 version.
millert [Fri, 12 Nov 2021 15:16:58 +0000 (15:16 +0000)]
Update awk to Nov 03, 2021 version.
We already had the fix so no actual code changes.

2 years agomention what X509_cmp_time(3) does with a cmp_time argument of NULL
schwarze [Fri, 12 Nov 2021 14:34:57 +0000 (14:34 +0000)]
mention what X509_cmp_time(3) does with a cmp_time argument of NULL

2 years agoRefactor order of checks when handling IKEv2 message fragments.
tobhe [Fri, 12 Nov 2021 14:18:54 +0000 (14:18 +0000)]
Refactor order of checks when handling IKEv2 message fragments.
Only modify SA after sucessful ikev2_msg_decrypt().

ok patrick@

2 years agoAs pointed out by tb@, LibreSSL no longer supports user-defined
schwarze [Fri, 12 Nov 2021 14:05:28 +0000 (14:05 +0000)]
As pointed out by tb@, LibreSSL no longer supports user-defined
X509_LOOKUP_METHODs because these objects are now opaque.
Simplify the documentation accordingly, shortening it by
about 35 input lines in total, but continue providing the
information which RETURN VALUES functions might return with
other implementations of the library.
OK tb@

2 years agoIn x509_vfy.h rev. 1.41, tb@ provided X509_STORE_CTX_get_by_subject(3),
schwarze [Fri, 12 Nov 2021 11:41:50 +0000 (11:41 +0000)]
In x509_vfy.h rev. 1.41, tb@ provided X509_STORE_CTX_get_by_subject(3),
changed the return type of X509_OBJECT_get_type(3) and argument
types of X509_LOOKUP_by_subject(3), X509_LOOKUP_by_issuer_serial(3),
X509_LOOKUP_by_fingerprint(3), X509_LOOKUP_by_alias(3),
X509_OBJECT_idx_by_subject(3), X509_OBJECT_retrieve_by_subject(3),
and X509_STORE_get_by_subject(3) from int to X509_LOOKUP_TYPE, and
in rev. 1.42, he provided X509_STORE_CTX_get_obj_by_subject(3).

Adjust the documentation.
Joint work with and OK tb@.

2 years agoAdd support for 40MHz channels to the iwn(4) driver.
stsp [Fri, 12 Nov 2021 11:41:04 +0000 (11:41 +0000)]
Add support for 40MHz channels to the iwn(4) driver.

Tested:
4965: jsg
5300: stsp, Jan Stary
6030: Fred Crowsons
6200: stsp
6205: stsp, Josh Grosse
6300: okan, afresh1

2 years agoSync the iwn(4) "enhanced Tx power" eeprom data structure with Linux.
stsp [Fri, 12 Nov 2021 11:40:35 +0000 (11:40 +0000)]
Sync the iwn(4) "enhanced Tx power" eeprom data structure with Linux.
No functional change, as this data is not being used anywhere yet.

2 years agosync after libc++abi minor bump
robert [Fri, 12 Nov 2021 10:09:58 +0000 (10:09 +0000)]
sync after libc++abi minor bump

2 years agobackport https://reviews.llvm.org/D107127 to fix shared libraries using emutls
robert [Fri, 12 Nov 2021 10:08:35 +0000 (10:08 +0000)]
backport https://reviews.llvm.org/D107127 to fix shared libraries using emutls

Our emulated TLS implementation relies on local state (e.g. for the pthread
key), and if we duplicate this state across different shared libraries,
accesses to the same TLS variable from different shared libraries will yield
different results (see https://github.com/android/ndk/issues/1551 for an
example). __emutls_get_address is the only external entry point for emulated
TLS, and by making it default visibility and weak, we can rely on the dynamic
linker to coalesce multiple copies at runtime and ensure a single unique copy
of TLS state. This is a best effort;

Also bump the libc++abi minor because now it picks up the __emutls_get_address
symbol.

ok kettenis@

2 years agoConsistency in test; no behavior change.
ajacoutot [Fri, 12 Nov 2021 08:47:02 +0000 (08:47 +0000)]
Consistency in test; no behavior change.

2 years agoSet SECONDS to 0 in _rc_wait.
ajacoutot [Fri, 12 Nov 2021 08:44:05 +0000 (08:44 +0000)]
Set SECONDS to 0 in _rc_wait.
While this is not strictly required, it's a failsafe and more fair to
daemon_timeout as we will effectively wait for the start/stop/reload sequence
instead of the duration of the rc.d script itself.

2 years agoSimplify _rc_exit.
ajacoutot [Fri, 12 Nov 2021 08:38:02 +0000 (08:38 +0000)]
Simplify _rc_exit.

2 years agohonor objdir
anton [Fri, 12 Nov 2021 06:53:51 +0000 (06:53 +0000)]
honor objdir

2 years agoaggressively pre-fill the pollfd array with fd=-1
deraadt [Fri, 12 Nov 2021 05:23:49 +0000 (05:23 +0000)]
aggressively pre-fill the pollfd array with fd=-1

2 years agoKeep knotes between poll/select systems calls
visa [Fri, 12 Nov 2021 04:34:22 +0000 (04:34 +0000)]
Keep knotes between poll/select systems calls

Reduce the time overhead of kqueue-based poll(2) and select(2) by
keeping knotes registered between the system calls. It is expected that
the set of monitored file descriptors is relatively unchanged between
consecutive iterations of these system calls. By keeping the knotes,
the system saves the effort of repeated knote unregistering and
re-registering.

To avoid receiving events from file descriptors that are no longer in
the monitored set, each poll/select knote is assigned an increasing
serial number. Every iteration of poll/select uses a previously unused
range of serials for its knotes. In the setup stage, kqueue_register()
updates the serials of any existing knotes in the currently monitored
set. Function kqueue_scan() delivers only the events whose serials are
recent enough; expired knotes are dropped. When the serial range is
about to wrap around, all the knotes in the kqueue backend are dropped.

This change is a space-time tradeoff. Memory usage is increased somewhat
because of the retained knotes. The increase is limited by the number
of open file descriptors and active threads.

Idea from DragonFly BSD, initial patch by mpi@, kqueue_scan()-based
approach by me.

Tested by anton@ and mpi@
OK mpi@

2 years agoAdd test case for INVALID_KE in IKE_SA_INIT fallback.
tobhe [Thu, 11 Nov 2021 22:12:52 +0000 (22:12 +0000)]
Add test case for INVALID_KE in IKE_SA_INIT fallback.

2 years agonwid -> join
kn [Thu, 11 Nov 2021 21:05:46 +0000 (21:05 +0000)]
nwid -> join

Missed in the previous commit to the installer and wifi driver manuals:
---
Use ifconfig(8)'s "join" command by default

Its adoption went quite well, so install "join" rather than the old "nwid"
in new hostname.if(5) files and follow this trend in our wifi manuals.

OK deraadt sthen
---

Spotted/diff from From Raf Czlonka < rczlonka AT gmail DOT com>, thanks!

Tweak the example sentence while here.
Feedback jmc sthen

2 years agoadd some missing Ns; from leon fischer
jmc [Thu, 11 Nov 2021 20:42:54 +0000 (20:42 +0000)]
add some missing Ns; from leon fischer

2 years agoMake "config -e" work with ramdisk kernels
kn [Thu, 11 Nov 2021 20:25:56 +0000 (20:25 +0000)]
Make "config -e" work with ramdisk kernels

amd64, alpha, i386 and macppc strip *all* symbols off the ramdisk bsd.rd
(before compressing it) and thus break config(8)'s modification feature:

$ gzcat bsd.rd > bsd.rd.raw
$ config -e bsd.rd.raw
...
config: failed to get first cfdata

This is different from "boot> boot /bsd.rd -c" which sucessfully drops into
UKC on all platforms regardless of stripping.

Having needed "config -e" this on arm64 made me look into this for all
platforms.  Other platforms work because they don't strip these symbols.

Tweak objcopy(1)'s stripping on amd64 and macppc to unbreak permanent
modifications.  I have no alpha or i386 to test, so these remain broken.

macppc works without cranking media size.
amd64 was cranked to the smallest possible size.

OK deraadt

2 years agoThe Apple DART has a nifty feature that allows us protection of subranges
kettenis [Thu, 11 Nov 2021 18:43:05 +0000 (18:43 +0000)]
The Apple DART has a nifty feature that allows us protection of subranges
of a page with a granularity of 32-bit words.  Use this to expose just
those parts of memory to devices that we want the device to see.  This
means that handing down a small mbuf to a network card driver no longer
gives the hardware access to other mbufs in the same page.

It turns out that bge(4) always does aligned 64-bit access to memory though.
So round up/down to the nearest 64-bit boundary to prevent triggering an
IOMMU fault.

ok patrick@

2 years agoFix GENERIC kernel compilation.
mvs [Thu, 11 Nov 2021 18:36:59 +0000 (18:36 +0000)]
Fix GENERIC kernel compilation.

2 years agoDo not call ip_deliver() recursively from IPsec. As there is no
bluhm [Thu, 11 Nov 2021 18:08:17 +0000 (18:08 +0000)]
Do not call ip_deliver() recursively from IPsec.  As there is no
crypto task anymore, it is possible to return the next protocol.
Then ip_deliver() will walk the header chain in its loop.
IPsec bridge(4) tested by jan@
OK mvs@ tobhe@ jan@

2 years agoremove switch(4) entry in SEE ALSO;
jmc [Thu, 11 Nov 2021 17:33:10 +0000 (17:33 +0000)]
remove switch(4) entry in SEE ALSO;

2 years agoUse vnode(9) lock to protect `v_socket' dereference.
mvs [Thu, 11 Nov 2021 17:20:02 +0000 (17:20 +0000)]
Use vnode(9) lock to protect `v_socket' dereference.

The bind(2)ed UNIX socket hat the reference from the file system layer.
When we bind(2) such socket we link it to `v_socket' of associated
vnode(9). When we connect(2) to the socket we previously bind(2)ed we
finding it by namei(9) and obtain it's reference through `v_socket'. When
we close(2) this socket we set `v_socket' of associated vnode(9) to NULL.

This time the global `unp_lock' rwlock(9) protects the whole layer and the
dereference of `v_socket'. With the upcoming fine grained locking diffs it
will be replaced by per-socket solock(). So the dereference of `v_socket'
will be unsafe because it will be unlocked and has no extra reference in
the associated file descriptor.

Actually we have vnode(9) locked while we perform unp_bind() and
unp_connect() paths so use vnode(9) lock in the unp_detach() path too when
we disconnect dying socket from the associated vnode(9). This makes
`v_socket' locking consistent because `v_socket' relies to vnode(9) layer.
Also this makes `v_socket' dereference safe for the upcoming fine grained
locking diffs.

Do `v_socket' unlinking before `unp_refs' list cleanup to prevent
concurrent connections while dying socket `so' is unlocked.

ok bluhm@

2 years agosync
deraadt [Thu, 11 Nov 2021 16:41:39 +0000 (16:41 +0000)]
sync

2 years agoDestroy protocol control block before perform `so_q0' and `so_q' queues
mvs [Thu, 11 Nov 2021 16:35:09 +0000 (16:35 +0000)]
Destroy protocol control block before perform `so_q0' and `so_q' queues
cleanup.

The dying socket is already unlinked from the file descriptor layer, but
still accessible from the stack or from the file system layer. We need to
unlink the socket to prevent concurrent connection when we unlocked dying
socket while we perform `so_q0' or `so_q' queues cleanup or while we
perform (*pr_detach)(). This unlocking will be appeared with the upcoming
fine grained locked sockets diffs.

ok bluhm@

2 years agoexponential_test passes on i386.
mbuhl [Thu, 11 Nov 2021 16:01:38 +0000 (16:01 +0000)]
exponential_test passes on i386.

2 years agomention the public constants XN_FLAG_SEP_MASK and XN_FLAG_FN_MASK
schwarze [Thu, 11 Nov 2021 15:58:49 +0000 (15:58 +0000)]
mention the public constants XN_FLAG_SEP_MASK and XN_FLAG_FN_MASK

2 years agoMove the assignment of http_query down. Also do not assign a non-malloced
claudio [Thu, 11 Nov 2021 15:52:33 +0000 (15:52 +0000)]
Move the assignment of http_query down. Also do not assign a non-malloced
string to it since the code assumes it can call free on it.
Fixes crashes noticed by tobhe@ and florian@
OK otto@ tobhe@

2 years agoConvert from select() to ppoll(). Along the way, I observed that the
deraadt [Thu, 11 Nov 2021 15:32:32 +0000 (15:32 +0000)]
Convert from select() to ppoll().  Along the way, I observed that the
select() code was using exceptfds incorrectly..
ok millert

2 years agoIgnore tags files
kn [Thu, 11 Nov 2021 14:03:21 +0000 (14:03 +0000)]
Ignore tags files

Besides obj (and all the build objects inside), tags seem to be the only
thing that's automatically created by our build infrastructure which should
never be committed.

CVS ignores "tags" due to its builtin list of ignore patterns.
Git does not ignore tags, although it has a builtin list (e.g. "*.o").
Got has no such builtin list.

Add "**/tags" to .gitignore specifically to provide a sane default for
Got checkouts.

Mirror .gitignore with sys/.gitignore to have the same experience with
kernel-only checkouts, as is common practise with Got.

OK stsp sthen

2 years agoMention the X509v3_KU_* aliases for the KU_* constants
schwarze [Thu, 11 Nov 2021 13:58:59 +0000 (13:58 +0000)]
Mention the X509v3_KU_* aliases for the KU_* constants
because some third party application code uses them.
List the full names (even though they are long)
such that they can be found with "man -k Dv=...".

2 years agoFix iwn(4) with 4965 devices.
stsp [Thu, 11 Nov 2021 13:36:58 +0000 (13:36 +0000)]
Fix iwn(4) with 4965 devices.

Our driver was using the wrong data structure for RXON_ASSOC commands on
4965 devices. This resulted in fatal firmware errors during association.

Problem found and fix tested on 4965 by jsg@.
Patch also tested on 6200 by me.

2 years agoExplicitly list all public functions in roff(7) comments
schwarze [Thu, 11 Nov 2021 13:13:38 +0000 (13:13 +0000)]
Explicitly list all public functions in roff(7) comments
that are related to this page but intentionally undocumented,
to better support grepping the source directory for function names.

2 years agoadd tests to cover DIOCCHANGERULE ioctl(2)
sashan [Thu, 11 Nov 2021 12:49:53 +0000 (12:49 +0000)]
add tests to cover DIOCCHANGERULE ioctl(2)

OK bluhm@

2 years agoAllow pfi_kif_get() callers to pre-allocate buffer for new kif. If kif
sashan [Thu, 11 Nov 2021 12:35:01 +0000 (12:35 +0000)]
Allow pfi_kif_get() callers to pre-allocate buffer for new kif. If kif
object exists already, then caller must free the pre-allocated buffer.
If caller does not pre-allocate buffer, the pfi_kif_get() will get
memory from pool using M_NOWAIT flag.

Commit is  also polishing pfi_initialize() a bit so it uses M_WAITOK
allocation for pfi_all.

there is no change in current behaviour.

feedback by bluhm@

OK bluhm@

2 years agoTweak rc_stop and rc_reload description by mentioning their corresponding
ajacoutot [Thu, 11 Nov 2021 12:23:15 +0000 (12:23 +0000)]
Tweak rc_stop and rc_reload description by mentioning their corresponding
_signal variable.
Fix a warning from 'mandoc -T lint' while here.

2 years agoRun "_rc_wait stop" _before_ stopping the daemon and not after...
ajacoutot [Thu, 11 Nov 2021 12:08:36 +0000 (12:08 +0000)]
Run "_rc_wait stop" _before_ stopping the daemon and not after...
This doesn't change the default behavior but fixes rc.d scripts with a home made
rc_stop() function that can block and potentially hangs halt/reboot forever.

ok robert@

2 years agonew manual page X509_policy_tree_get0_policies(3),
schwarze [Thu, 11 Nov 2021 12:06:25 +0000 (12:06 +0000)]
new manual page X509_policy_tree_get0_policies(3),
also documenting X509_policy_tree_get0_user_policies(3)

2 years agoReturn 0 in case we reach KILL; this allows "restart" to work as expected
ajacoutot [Thu, 11 Nov 2021 10:37:36 +0000 (10:37 +0000)]
Return 0 in case we reach KILL; this allows "restart" to work as expected
in this situation.

reported by and ok robert@

2 years agoRemove switchd regress tests.
claudio [Thu, 11 Nov 2021 10:03:54 +0000 (10:03 +0000)]
Remove switchd regress tests.

2 years agoRetire switch(4) it never really was production ready and the OpenFlow
claudio [Thu, 11 Nov 2021 10:03:08 +0000 (10:03 +0000)]
Retire switch(4) it never really was production ready and the OpenFlow
API implemented is a deadend.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

2 years agoRetire switchd and switchctl. While interesting they never managed to
claudio [Thu, 11 Nov 2021 09:59:19 +0000 (09:59 +0000)]
Retire switchd and switchctl. While interesting they never managed to
really get into a usable state. The OpenFlow API is mostly superseeded
by P4 and so this is a bit of a dead end.
OK akoshibe@ yasuoka@ deraadt@ kn@ patrick@ sthen@

2 years agoUnhook switchd and switchctl
claudio [Thu, 11 Nov 2021 09:52:24 +0000 (09:52 +0000)]
Unhook switchd and switchctl

2 years agoRegen after switch(4) removal
claudio [Thu, 11 Nov 2021 09:51:32 +0000 (09:51 +0000)]
Regen after switch(4) removal

2 years agoRegen after switch(4) removal
claudio [Thu, 11 Nov 2021 09:49:29 +0000 (09:49 +0000)]
Regen after switch(4) removal

2 years ago/dev/switch[0-4] is no longer needed.
claudio [Thu, 11 Nov 2021 09:47:32 +0000 (09:47 +0000)]
/dev/switch[0-4] is no longer needed.

2 years agoUnhook switch.4 and update bridge.4 since some switch(4) specific ioctls
claudio [Thu, 11 Nov 2021 09:45:27 +0000 (09:45 +0000)]
Unhook switch.4 and update bridge.4 since some switch(4) specific ioctls
will be removed soon.
OK sthen@ kn@ patrick@

2 years agoRemove switch(4) specific bits from ifconfig.
claudio [Thu, 11 Nov 2021 09:39:16 +0000 (09:39 +0000)]
Remove switch(4) specific bits from ifconfig.
OK deraadt@ patrick@

2 years agoswitch(4) and switchd(8) are retiering. Unhook them from various
claudio [Thu, 11 Nov 2021 09:38:14 +0000 (09:38 +0000)]
switch(4) and switchd(8) are retiering. Unhook them from various
configuration files.
OK sthen@ kn@ patrick@

2 years agoConvert a for loop into LIST_FOREACH to reduce the diff to NetBSD.
tb [Thu, 11 Nov 2021 09:34:27 +0000 (09:34 +0000)]
Convert a for loop into LIST_FOREACH to reduce the diff to NetBSD.

ok millert mpi

2 years agoswitch(4) is being retired, sthen@ already removed the bits in the code
claudio [Thu, 11 Nov 2021 09:33:36 +0000 (09:33 +0000)]
switch(4) is being retired, sthen@ already removed the bits in the code
adjust the man page as well.
OK sthen@ kn@ patrick@

2 years agoIf automatic-rename is off, allow the escape sequence to set an empty
nicm [Thu, 11 Nov 2021 09:31:16 +0000 (09:31 +0000)]
If automatic-rename is off, allow the escape sequence to set an empty
window name, GitHub issue 2964.

2 years agoIf trimming menu item text, show key if it would take up less than a
nicm [Thu, 11 Nov 2021 09:22:33 +0000 (09:22 +0000)]
If trimming menu item text, show key if it would take up less than a
quarter of the space; from Alexis Hildebrandt.

Also new sentence, new line in tmux.1, from jmc.

2 years agoremove whitespace
mestre [Thu, 11 Nov 2021 08:48:48 +0000 (08:48 +0000)]
remove whitespace

2 years agoThere's no need to call pledge(2) so many times, or on many places, with the
mestre [Thu, 11 Nov 2021 08:42:31 +0000 (08:42 +0000)]
There's no need to call pledge(2) so many times, or on many places, with the
same promises, just call it once before the switch case while at the same time
hoisting one unveil(2) so they are all grouped.

The call to pledge(2) on file() can also be simplified since "stdio rpath getpw"
will already be activated when we reach it.

OK deraadt@

2 years agoHere we go again, revert the second attempt to resolve the
anton [Thu, 11 Nov 2021 07:04:45 +0000 (07:04 +0000)]
Here we go again, revert the second attempt to resolve the
UHIDEV_CLAIM_MULTIPLE_REPORTID conflict.

Breaks fido(4) as reported by gnezdo@

2 years agoresolvd(8) also monitors proposals learned by sppp(4)
bket [Thu, 11 Nov 2021 05:52:03 +0000 (05:52 +0000)]
resolvd(8) also monitors proposals learned by sppp(4)

OK kn@