claudio [Mon, 25 Oct 2021 10:24:54 +0000 (10:24 +0000)]
Revert commitid: ufM9BcSbXqfLpzBH;
Move vfs_stall_barrier() from the fd layer into vn_lock() and the vfs layer.
In some cases it can result in a deadlock while suspending.
Discussed with mpi@ and deraadt@
jsing [Mon, 25 Oct 2021 10:14:48 +0000 (10:14 +0000)]
Add record processing limit to DTLS code.
This is effectively the same record processing limit that was previously
added to the legacy TLS stack - without this a single session can be made
to spin on a stream of alerts or other similar records.
ok beck@ tb@
jsing [Mon, 25 Oct 2021 10:09:28 +0000 (10:09 +0000)]
Use ssl_force_want_read() in the DTLS code.
Also mop up some mostly unhelpful comments while here.
ok beck@ tb@
deraadt [Mon, 25 Oct 2021 10:08:26 +0000 (10:08 +0000)]
open() flags never contain O_CREAT, so variatic mode_t can be removed here also
deraadt [Mon, 25 Oct 2021 10:07:12 +0000 (10:07 +0000)]
do not need a temporary one time use variable which befuddles
jsing [Mon, 25 Oct 2021 10:01:46 +0000 (10:01 +0000)]
Fold SSL_SESSION_INTERNAL back into SSL_SESSION.
ok beck@ tb@
tobhe [Mon, 25 Oct 2021 09:47:02 +0000 (09:47 +0000)]
Fix use of uninitialized variable 'rpl'.
Found by jsg@
ok patrick@
nicm [Mon, 25 Oct 2021 09:38:36 +0000 (09:38 +0000)]
Add -s and -S to display-popup to set popup and border style, from
Alexis Hildebrandt in GitHub issue 2931.
nicm [Mon, 25 Oct 2021 09:22:17 +0000 (09:22 +0000)]
Instead of setting the popup default colours in the draw callback, set
it up in popup_display and follow the same routine as panes in the draw
and init_ctx callbacks - use the palette if the option value is default.
Allows application-set fg and bg to work in panes again.
tb [Mon, 25 Oct 2021 07:17:14 +0000 (07:17 +0000)]
Drop two uses of the terrible asn1 kludge spotted by anton
mbuhl [Mon, 25 Oct 2021 00:48:49 +0000 (00:48 +0000)]
Use EXPECTED_FAIL instead of DISABLED.
tobhe [Sun, 24 Oct 2021 23:33:37 +0000 (23:33 +0000)]
Merge esp_input_cb() intp esp_input().
ok bluhm@
bluhm [Sun, 24 Oct 2021 22:59:47 +0000 (22:59 +0000)]
Remove code duplication by merging the v4 and v6 input functions
for ah, esp, and ipcomp. Move common code into ipsec_protoff()
which finds the offset of the next protocol field in the previous
header.
OK tobhe@
tobhe [Sun, 24 Oct 2021 22:34:19 +0000 (22:34 +0000)]
Refactor ah_input() and ah_output() for new crypto API.
ok bluhm@
deraadt [Sun, 24 Oct 2021 21:37:49 +0000 (21:37 +0000)]
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert
deraadt [Sun, 24 Oct 2021 21:27:07 +0000 (21:27 +0000)]
What kind of Sun idiot called open() with flags of "2".
deraadt [Sun, 24 Oct 2021 21:24:15 +0000 (21:24 +0000)]
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef.
ok millert
tobhe [Sun, 24 Oct 2021 18:15:58 +0000 (18:15 +0000)]
Refactor ipcomp_input() and ipcomp_output(). Remove obsolete code related
to old crypto API.
ok bluhm@
martijn [Sun, 24 Oct 2021 18:03:27 +0000 (18:03 +0000)]
Even though AgentX supports null-oids and incidentally has a valid usecase
for them, they don't map on ber, which needs a minimum of 2 identifiers.
Enforce this minimum in libagentx.
While here add some additional checks where they were lacking.
OK claudio@
claudio [Sun, 24 Oct 2021 17:54:28 +0000 (17:54 +0000)]
Use the print.c file which is now shipped in rpki-client to print
the cert, gbr, mft, roa and tal file contents. No real functional change.
OK tb@
claudio [Sun, 24 Oct 2021 17:53:07 +0000 (17:53 +0000)]
Move the various print functions from the regress tests into print.c.
OK tb@
mpi [Sun, 24 Oct 2021 17:52:26 +0000 (17:52 +0000)]
Constify struct cfattach.
ok visa@ a long time ago, ok patrick@
deraadt [Sun, 24 Oct 2021 17:49:19 +0000 (17:49 +0000)]
#define open O_* flags in libsa/stand.h, so that bootblocks can use
O_RDONLY rather using 0
ok beck
martijn [Sun, 24 Oct 2021 17:43:38 +0000 (17:43 +0000)]
Initialize OID print buffer, even when oidlen is 0.
Fix printing old garbage from previous conversions.
OK tb@
patrick [Sun, 24 Oct 2021 17:20:06 +0000 (17:20 +0000)]
Some more whitespace cleanup
claudio [Sun, 24 Oct 2021 17:16:09 +0000 (17:16 +0000)]
Add $OpenBSD$ header and add a licence to rrdp.h which was lacking it.
bluhm [Sun, 24 Oct 2021 17:08:27 +0000 (17:08 +0000)]
There are more m_pullup() in IPsec input. Pass down the pointer
to the mbuf to update it globally. At the end it will reach
ip_deliver() which expects a pointer to an mbuf.
OK sashan@
mpi [Sun, 24 Oct 2021 17:05:03 +0000 (17:05 +0000)]
Constify struct cfattach.
ok visa@ a long time ago
claudio [Sun, 24 Oct 2021 16:59:14 +0000 (16:59 +0000)]
Add my copyright to some files
OK job@
mpi [Sun, 24 Oct 2021 16:57:30 +0000 (16:57 +0000)]
Constify struct cfattach.
ok visa@ a long time ago, ok krw@
patrick [Sun, 24 Oct 2021 16:02:44 +0000 (16:02 +0000)]
tiny little whitespace fixes
ian [Sun, 24 Oct 2021 16:01:04 +0000 (16:01 +0000)]
Add httpd custom error page facility. Adapted by me from
https://github.com/mpfr/httpd-plus.
Improvements from & (earlier version) reads fine to tracey@;
improvements & OK this version benno@, florian@. Thanks.
kn [Sun, 24 Oct 2021 15:57:17 +0000 (15:57 +0000)]
Use braces in config examples
We document them as explicitly required, `unwind -dnvf...' spits them
out like this and the last `force' example uses them as well.
tobhe [Sun, 24 Oct 2021 15:47:39 +0000 (15:47 +0000)]
Remove 'struct tdb_crypto' allocations from esp_input() and esp_output().
This was needed to pass arguments to the callback function, but is no longer
necessary after the API makeover.
ok bluhm@
patrick [Sun, 24 Oct 2021 15:41:47 +0000 (15:41 +0000)]
A tiny bit of cleanup.
patrick [Sun, 24 Oct 2021 15:33:12 +0000 (15:33 +0000)]
Add mount -ur/uw support to tmpfs.
From Pedro Martelletto
visa [Sun, 24 Oct 2021 15:29:10 +0000 (15:29 +0000)]
Unlock top part of UVM fault handler on mips64.
OK mpi@
mpi [Sun, 24 Oct 2021 15:23:52 +0000 (15:23 +0000)]
Move pmap_{,k}remove() inside uvm_km_pgremove{,_intrsafe}().
Reduce differences with NetBSD, tested by many as part of a larger diff.
ok kettenis@
schwarze [Sun, 24 Oct 2021 15:10:13 +0000 (15:10 +0000)]
merge documentation for SSL_read_ex(3), SSL_peek_ex(3), and SSL_write_ex(3)
from the OpenSSL 1.1.1 branch, which is still under a free license
patrick [Sun, 24 Oct 2021 14:54:52 +0000 (14:54 +0000)]
Now that ampintcmsi(4)'s establish function returns a pointer to the
more generic machine intr handle, we need to call intr_barrier() for
it instead.
Panic found by bluhm@
ok kettenis@
tobhe [Sun, 24 Oct 2021 14:50:42 +0000 (14:50 +0000)]
Remove crp_etype and return errors directly from crypto_invoke()
ok patrick@
deraadt [Sun, 24 Oct 2021 14:40:30 +0000 (14:40 +0000)]
use O_RDONLY instead of 0 as open() flags parameter
bluhm [Sun, 24 Oct 2021 14:24:29 +0000 (14:24 +0000)]
Pass the error of the IPsec callback to the caller. The dropped
counter is handled there.
OK tobhe@
mpi [Sun, 24 Oct 2021 14:18:58 +0000 (14:18 +0000)]
Use unveil(2) for the possible script file, dt(4) and ksyms(4) nodes.
btrace(8) cannot be pledge due to its use of special ioctl()s.
ok deraadt@
tb [Sun, 24 Oct 2021 13:52:13 +0000 (13:52 +0000)]
Prepare to provide a number of X509_STORE_CTX_* setters.
ok beck jsing
tb [Sun, 24 Oct 2021 13:51:07 +0000 (13:51 +0000)]
Prepare to provide EVP_MD_CTX_get_md_data()
ok beck jsing
tb [Sun, 24 Oct 2021 13:50:14 +0000 (13:50 +0000)]
Prepare to provide a bunch of OCSP_resp_* getters.
ok beck jsing
tb [Sun, 24 Oct 2021 13:48:15 +0000 (13:48 +0000)]
Prepare to provide X509_STORE_CTX_get_num_untrusted()
ok beck jsing
tb [Sun, 24 Oct 2021 13:46:56 +0000 (13:46 +0000)]
Prepare to provide BIO_get_init()
ok beck jsing
mpi [Sun, 24 Oct 2021 13:46:14 +0000 (13:46 +0000)]
Shuffle variables around and use KASSERT() instead of panic().
No functionnal change.
Reduce differences with NetBSD, tested by many as part of a larger diff.
job [Sun, 24 Oct 2021 13:45:19 +0000 (13:45 +0000)]
Improve variable naming
OK tb@ claudio@
deraadt [Sun, 24 Oct 2021 13:32:48 +0000 (13:32 +0000)]
sync
schwarze [Sun, 24 Oct 2021 13:10:46 +0000 (13:10 +0000)]
Since tb@ added DECLARE_STACK_OF(GENERAL_NAMES) to x509v3.h in rev. 1.9
and since CMS_ReceiptRequest_get0_values(3) uses it, add it to the
list of STACK_OF(3) types.
While here, also add the missing CMS_RecipientInfo, CMS_SignerInfo,
OPENSSL_STRING, SRTP_PROTECTION_PROFILE, SSL_CIPHER, SSL_COMP and
X509_NAME to the list of stack types used by the API, drop
STACK_OF(X509_PURPOSE) which is only used internally, and list those
STACK_OF(*) types separately that are obfuscated with typedef.
kn [Sun, 24 Oct 2021 12:32:42 +0000 (12:32 +0000)]
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
florian [Sun, 24 Oct 2021 12:16:14 +0000 (12:16 +0000)]
nsd 4.3.7 shipped with DNS cookies on and then flipped to a default of
in 4.3.8. Since we shipped 4.3.7 in 7.0 we should not flip-flop
between on and off all the time. Keep the default to on.
Suggested by & OK sthen
florian [Sun, 24 Oct 2021 12:14:18 +0000 (12:14 +0000)]
Update to 4.3.8.
OK sthen
job [Sun, 24 Oct 2021 12:06:16 +0000 (12:06 +0000)]
Restrict the characterset for filenames on Manifests
feedback from benno@
OK claudio@
mpi [Sun, 24 Oct 2021 11:23:22 +0000 (11:23 +0000)]
Implement poll(2), select(2), ppoll(2) & pselect(2) on top of kqueue.
The given set of fds are converted to equivalent kevents using EV_SET(2)
and passed to the scanning internals of kevent(2): kqueue_scan().
ktrace(1) will now output the converted kevents on top of the usuals set
bits to be able to find possible error in the convertion.
This switch implies that poll(2) and select(2) will now query underlying
kqfilters instead of the *_poll() routines. An increase in latency is
visible, especially with UDP sockets and NET_LOCK()-contended subsystems
and will be addressed in next steps.
Based on similar work done on MacOS and DragonFlyBSD with inputs from
visa@, millert@, anton@, cheloha@, thanks!
Tested by many, thanks!
ok claudio@, bluhm@
sashan [Sun, 24 Oct 2021 10:58:43 +0000 (10:58 +0000)]
let pf_table.c to use standard way to work with lists
OK todd@, mvs@, kn@
patrick [Sun, 24 Oct 2021 10:26:22 +0000 (10:26 +0000)]
Stop setting etype in the MD crypto code. So far we have set the etype
and returned the error, which made the MI crypto code set the etype for
a second time. We still have to set etype after calling the MD process
function, as the callers of crypto_invoke() still expect error handling
to be shown through the etype. But at least now all MD crypto code does
not have to worry about that anymore. Once the callers are changed to
not look at etype anymore, we can get rid of it completely.
ok tobhe@
kn [Sun, 24 Oct 2021 10:11:24 +0000 (10:11 +0000)]
Fall back to HTTP for fetching automatically
Drop the "Unable to connect using https. Use http instead?" question as it
does not provide any security benefit; SHA256.sig is used to verify sets.
Do provide an informative message iff the fallback happened such that
installations/upgrades that cannot Get/Verify first but Install directly
can be aborted in lack of SHA256.sig, i.e. sets were fetched over HTTP and
verification would be skipped.
Discussed with deraadt tb
OK deraadt
jsg [Sun, 24 Oct 2021 10:05:22 +0000 (10:05 +0000)]
ansi
ok mpi@ deraadt@
patrick [Sun, 24 Oct 2021 09:59:52 +0000 (09:59 +0000)]
Prohibit renames of tmpfs mount-points to fix a panic.
From gerhard@
tb [Sun, 24 Oct 2021 09:27:48 +0000 (09:27 +0000)]
Prepare to provide X509_OBJECT_{new,free}()
ok beck inoguchi jsing
deraadt [Sun, 24 Oct 2021 09:18:51 +0000 (09:18 +0000)]
extra 0 fields in cfdriver are not needed
deraadt [Sun, 24 Oct 2021 09:16:53 +0000 (09:16 +0000)]
pretty & normalize the cfdriver decl
beck [Sun, 24 Oct 2021 09:15:00 +0000 (09:15 +0000)]
Don't leak internal->verfied_chain, clean it up in ssl3_clear and free.
spotted by and ok jsing@
claudio [Sun, 24 Oct 2021 09:05:41 +0000 (09:05 +0000)]
Anther day another broken test-http.c report from anton@
Adjust code again.
mpi [Sun, 24 Oct 2021 08:42:38 +0000 (08:42 +0000)]
Fix mangled license.
From Leon Fischer
jmc [Sun, 24 Oct 2021 07:08:20 +0000 (07:08 +0000)]
spelling;
visa [Sun, 24 Oct 2021 07:02:47 +0000 (07:02 +0000)]
Set klist lock for sockets to make socket event filters MP-safe
The filterops instances already provide f_modify and f_process
callbacks with proper internal locking. Locking of socket klists
has been the missing detail for MP-safety.
OK mpi@
visa [Sun, 24 Oct 2021 06:59:54 +0000 (06:59 +0000)]
Make pipe event filters MP-safe
Add the missing f_modify and f_process callbacks so that pipe_lock
serializes pipe knote handling. As pipe klist locking is already in
place, pipe event filters should now be MP-safe.
This uses write locking everywhere in the callbacks for simplicity.
There is not much multiple-readers parallelism to utilize.
OK mpi@ anton@
jsg [Sun, 24 Oct 2021 00:02:24 +0000 (00:02 +0000)]
use NULL not 0 for pointer values in kern
ok semarie@
bluhm [Sat, 23 Oct 2021 22:19:37 +0000 (22:19 +0000)]
There is an m_pullup() down in AH input. As it may free or change
the mbuf, the callers must be careful. Although there is no bug,
use the common pattern to handle this. Pass down an mbuf pointer
mp and let m_pullup() update the pointer in all callers.
It looks like the tcp signature functions should not be called.
Avoid an mbuf leak and return an error.
OK mvs@
bluhm [Sat, 23 Oct 2021 22:00:51 +0000 (22:00 +0000)]
Fix use-after-free in ipcomp_output() introduced by previous commit.
Retrieve ilen and olen from crypto descriptors before freeing them.
Found by regress/sys/netinet/ipsec.
OK mpi@
jmc [Sat, 23 Oct 2021 21:17:45 +0000 (21:17 +0000)]
spread some ipcrm/ipcs Xr; from mikhail
ok schwarze
benno [Sat, 23 Oct 2021 20:46:18 +0000 (20:46 +0000)]
do not duplicate "Connection: close" headers and only add it if its
not a websockets response.
Reported by Marcus MERIGHI and Jonathon Fletcher, this fix is by Jonathon, Thanks!
ok claudio@
mvs [Sat, 23 Oct 2021 20:44:42 +0000 (20:44 +0000)]
sonewconn() returns the pointer to 'socket' struct so check it against
NULL instead of '0'.
ok deraadt@
beck [Sat, 23 Oct 2021 20:42:50 +0000 (20:42 +0000)]
Add SSL_get0_verified_chain - needed by some new stuff
symbol will be exposed with tb@'s forthcoming bump
ok tb@
claudio [Sat, 23 Oct 2021 20:01:16 +0000 (20:01 +0000)]
Rename io_buf_new to io_new_buffer and io_buf_close to io_close_buffer.
With this the write functions are all of the form io_xyz_buffer.
Remove some prototypes of functions I forgot to remove in previous commit.
OK benno@
deraadt [Sat, 23 Oct 2021 19:40:29 +0000 (19:40 +0000)]
btrace dir
mpi [Sat, 23 Oct 2021 19:37:35 +0000 (19:37 +0000)]
Provide common btrace(8) scripts.
. kprofile.bt - to save kernel stackframces and produce flamegraphs
. runqlat.bt - to measure the latency of the scheduler runqueues
deraadt [Sat, 23 Oct 2021 19:13:13 +0000 (19:13 +0000)]
sync
deraadt [Sat, 23 Oct 2021 19:12:50 +0000 (19:12 +0000)]
sync
mestre [Sat, 23 Oct 2021 19:08:48 +0000 (19:08 +0000)]
ensure that sensitive data is zeroed out from mem.
ok beck@
bluhm [Sat, 23 Oct 2021 17:56:31 +0000 (17:56 +0000)]
For testing snmpd, use rc script to stop any running snmpd on machine
and restart it afterwards.
tb [Sat, 23 Oct 2021 17:43:06 +0000 (17:43 +0000)]
Declare STACK_OF(GENERAL_NAMES)
ok jsing
patrick [Sat, 23 Oct 2021 17:39:08 +0000 (17:39 +0000)]
Call uvm_vnp_uncache() in tmpfs_write(). We currently only call
uvm_vnp_uncache() in tmpfs_write() when a file grows in size. This
is not enough. We need to invalidate UVM's cache of the vnode every
time the contents of the vnode are modified. Failure to do so might
lead to inconsistencies between read/mmap consumers.
From Pedro Martelletto
patrick [Sat, 23 Oct 2021 17:38:00 +0000 (17:38 +0000)]
Fix tmpfs_lookup locking for ".." == ".". unveil_find_cover() calls
VFS_LOOKUP(dir, &parent) in a loop and looks up the parent directory
".." repeatedly. VFS_LOOKUP is expected to unlock 'dir' and return
'parent' locked.
So tmpfs_lookup() is called for ISDOTDOT and:
- runs with dvp = dir, vpp = &parent
- gets parent from tmpfs_vnode_get() and
- re-locks dir with vn_lock(dvp)
but skips the call to
VOP_UNLOCK(dvp);
on return because *vpp == dvp
The reason for doing so is the lookup for ".". In this case
tmpfs_lookup() just increases the reference on dvp and copies the
pointer:
*vpp = dvp; vref(dvp);
However, in our case we also have *vpp == dvp, but for a different
lookup (ISDOTDOT), so we must do the unlock.
From markus@
schwarze [Sat, 23 Oct 2021 17:20:50 +0000 (17:20 +0000)]
fix wrong and missing return types and wrong macros in the SYNOPSIS;
while here, also apply some minor wording improvements
martijn [Sat, 23 Oct 2021 17:13:50 +0000 (17:13 +0000)]
Rename a couple of variables overlooked in the conversion from subagentx to
agentx. Make things more consistent.
No functional change.
OK bluhm@
martijn [Sat, 23 Oct 2021 17:10:34 +0000 (17:10 +0000)]
Add a glossary of variable names.
Requested by and OK bluhm@
mestre [Sat, 23 Oct 2021 16:45:32 +0000 (16:45 +0000)]
stty(1) can't be pledged for all modes, but it can be unveiled. the only file to
be opened is on stty -f `file', so call unveil(2) afterwards to restrict all fs
access.
OK deraadt@
dv [Sat, 23 Oct 2021 16:39:03 +0000 (16:39 +0000)]
tpm(4): add support for tpm2 CRB interface
Some modern tpm2 devices require or prefer drivers communicate via
the CRB interface and not the TIS/fifo interface. This change adds
basic support for detecting CRB start mode and using CRB to issue
commands required for proper S4 hibernation. As a result, this also
defines a new struct definition for the TPM2 acpi table required
for start mode detection.
This fixes recent S4 regressions on the Surface Go 2 caused by a
change in firmware from Microsoft.
Other CRB start methods may need implementing in the future to
support additional hardware.
tested by deraadt@ and many others, ok kettenis@
beck [Sat, 23 Oct 2021 16:29:15 +0000 (16:29 +0000)]
Add new OpenSSL API SSL_CTX_set_num_tickets and friends.
Since we don't support session tickets in LibreSSL at the moment
these functions currently do not have any effect.
Again, symbols will appear with tb@'s reptar sized bump..
ok tb@
tb [Sat, 23 Oct 2021 16:18:20 +0000 (16:18 +0000)]
KNF a particularly ugly comment
tb [Sat, 23 Oct 2021 16:17:44 +0000 (16:17 +0000)]
Zap trailing whitespace
krw [Sat, 23 Oct 2021 16:16:22 +0000 (16:16 +0000)]
Arithmetic is hard! Since MBR partition 0 is the only partition in the boot
media MBR, just use '*' to take all the available space.
ok visa@ deraadt@
claudio [Sat, 23 Oct 2021 16:12:30 +0000 (16:12 +0000)]
Fixup test-http.c after big io change before anton@ complains
tb [Sat, 23 Oct 2021 16:11:30 +0000 (16:11 +0000)]
Unhandroll X509_up_ref()
ok beck jsing