openbsd
2 years agocad(4): Mention PolarFire SoC.
visa [Thu, 27 Jan 2022 17:36:22 +0000 (17:36 +0000)]
cad(4): Mention PolarFire SoC.

2 years agocad(4): Disable unused priority queues
visa [Thu, 27 Jan 2022 17:34:51 +0000 (17:34 +0000)]
cad(4): Disable unused priority queues

The GEMs on the PolarFire Soc implement four Rx queues and four
Tx queues for prioritizing traffic. All the queues are in a pseudo
active state after reset. The driver uses only queues with index 0.
Disable the rest to avoid DMA errors.

Tested on a SiFive FU740 by jca@, Microchip PolarFire SoC and
Xilinx Zynq-7000 by me.

2 years agoUpdate awk to Dec 8, 2021 version.
millert [Thu, 27 Jan 2022 16:58:37 +0000 (16:58 +0000)]
Update awk to Dec 8, 2021 version.
Fixes error handling in closefile() and closeall(). Long standing
warnings had been made fatal and some fatal errors went undetected.

2 years agoNuke single use function PRT_fix_BN() and just use the ATA/ATAPI LBA -> CHS
krw [Thu, 27 Jan 2022 16:26:32 +0000 (16:26 +0000)]
Nuke single use function PRT_fix_BN() and just use the ATA/ATAPI LBA -> CHS
conversion formula

LBA = (C × HPC + H) × SPT + (S − 1)

instead of the equivalent tortuous arithmetic used in PRT_fix_BN().

No intentional functional change.

2 years agodrop some local changes in an unused function
jsg [Thu, 27 Jan 2022 12:25:22 +0000 (12:25 +0000)]
drop some local changes in an unused function

2 years agoraise sched_engine lock mtx ipl to IPL_TTY
jsg [Thu, 27 Jan 2022 04:20:01 +0000 (04:20 +0000)]
raise sched_engine lock mtx ipl to IPL_TTY

used with spin_lock_irq() from
resubmit_virtual_request()
execlists_hold()
execlists_unhold()
execlists_capture()
remove_from_engine()
rcu_virtual_context_destroy()
virtual_submission_tasklet()

used with spin_lock_irqsave() from
execlists_submit_request()
execlists_reset_rewind()
execlists_reset_cancel()
virtual_submit_request()
intel_execlists_show_requests()

2 years agoraise mm obj_lock mtx ipl to IPL_TTY
jsg [Thu, 27 Jan 2022 04:17:40 +0000 (04:17 +0000)]
raise mm obj_lock mtx ipl to IPL_TTY

used with spin_lock_irqsave() from
__i915_gem_object_set_pages()
i915_gem_suspend_late()
i915_gem_shrink()
i915_gem_shrinker_oom()
i915_gem_object_make_unshrinkable()
i915_gem_madvise_ioctl()

2 years agouse process name for both thread and process name
jsg [Thu, 27 Jan 2022 02:56:13 +0000 (02:56 +0000)]
use process name for both thread and process name

2 years agoAllow rsync:// URI as file in -f mode. This makes it easier to explore
claudio [Wed, 26 Jan 2022 14:42:39 +0000 (14:42 +0000)]
Allow  URI as file in -f mode. This makes it easier to explore
rpki repositories by following AIA and manifest URIs.
Also stop checking the the loaded file is not part of the auth tree,
it is possible that this file was loaded before as a dependency.
OK tb@

2 years agoAn ACPI device needs to be both present and enabled for it to function.
kettenis [Wed, 26 Jan 2022 14:39:07 +0000 (14:39 +0000)]
An ACPI device needs to be both present and enabled for it to function.
So only attempt to attach hardware that has both bits enabled.  This fixes
an issue where com(4) would attach for a disabled serial port leading to
misdetection of the hardware variant and a subsequent hang when /etc/rc
runs ttyflags -a.

ok anton@, deraadt@

2 years agoChange the repository layout by removing the valid directory. Everything
claudio [Wed, 26 Jan 2022 13:57:56 +0000 (13:57 +0000)]
Change the repository layout by removing the valid directory. Everything
that was in that directory is now in the chachedir root. The rsync and
rrdp directories are now .rsync/ and .rrdp/. The ta/ directory still
remains because TAs are special.
Idea and most of the diff from job@
OK tb@ and benno@

2 years agoshrink uca.ibufsize from UCHCOMIBUFSIZE to wMaxPacketSize of bulk-in pipe
uaa [Wed, 26 Jan 2022 12:05:33 +0000 (12:05 +0000)]
shrink uca.ibufsize from UCHCOMIBUFSIZE to wMaxPacketSize of bulk-in pipe

USB transaction is finished when whole requested data has transferred,
or short packet (the size is less than wMaxPacketSize) has sent.

UCHCOMIBUFSIZE(256) was multiply of wMaxPacketSize(32). When CH340 sends
exact wMaxPacketSize byte packet, this will cause Rx jam problem
due to transaction is not finished.

Now uca.ibufsize is same as wMaxPacketSize to avoid this problem.

ok kevlo@

2 years agowhitespace
tb [Wed, 26 Jan 2022 11:05:41 +0000 (11:05 +0000)]
whitespace

2 years agoMake vmm(4/amd64) tracepoints amd64-only
kn [Wed, 26 Jan 2022 06:31:31 +0000 (06:31 +0000)]
Make vmm(4/amd64) tracepoints amd64-only

One can use them on non-VMM architectures, but they obviously won't hit:

# arch -s ; btrace -l | grep vmm
sparc64
tracepoint:vmm:guest_enter
tracepoint:vmm:guest_exit

Move them under __amd64__ to avoid confusion and safe a few bytes.

OK dv

2 years agoRework initialization of sensors on device connect.
anton [Wed, 26 Jan 2022 06:05:59 +0000 (06:05 +0000)]
Rework initialization of sensors on device connect.

2 years agoimplement might_alloc() using assertwaitok()
jsg [Wed, 26 Jan 2022 04:18:05 +0000 (04:18 +0000)]
implement might_alloc() using assertwaitok()

2 years agoreduce diff to linux ggtt_probe_common()
jsg [Wed, 26 Jan 2022 01:46:12 +0000 (01:46 +0000)]
reduce diff to linux ggtt_probe_common()

2 years agosync
tb [Tue, 25 Jan 2022 21:55:13 +0000 (21:55 +0000)]
sync

2 years agominor bump after api additiom
eric [Tue, 25 Jan 2022 21:53:45 +0000 (21:53 +0000)]
minor bump after api additiom

2 years agoIntroduce a signer interface intented to make TLS privsep simpler
eric [Tue, 25 Jan 2022 21:51:24 +0000 (21:51 +0000)]
Introduce a signer interface intented to make TLS privsep simpler
to implement.

Add a tls_config_set_sign_cb() function that allows to register
a callback for the signing operation on a tls_config. When used,
the context installs fake pivate keys internally, and the callback
receives the hash of the public key.

Add a tls_signer_*() set of functions to manage tls_signer objects.
A tls_signer is an opaque structure on which keys are added.
It is used to compute signatures with private keys identified by
their associated public key hash.

Discussed with and ok jsing@ tb@

2 years agoreduce diff to linux shmem_create_from_object()
jsg [Tue, 25 Jan 2022 21:31:26 +0000 (21:31 +0000)]
reduce diff to linux shmem_create_from_object()

includes linux 988d4ff6e3c2220d13d8dde22a98945b64fd7977
drm/i915: Fix ww locking in shmem_create_from_object

2 years agoreduce diff to linux vm_fault_cpu()
jsg [Tue, 25 Jan 2022 21:19:21 +0000 (21:19 +0000)]
reduce diff to linux vm_fault_cpu()

adds change made in linux 9fa1f4785f2a54286ccb8a850cda5661f0a3aaf9
drm/i915: Add object locking to vm_fault_cpu

2 years agoRewrite paragraph to refer to EVP_CIPHER_CTX_new() and HMAC_CTX_new()
tb [Tue, 25 Jan 2022 18:01:20 +0000 (18:01 +0000)]
Rewrite paragraph to refer to EVP_CIPHER_CTX_new() and HMAC_CTX_new()
to match reality.

spotted by/ok jmc

2 years agoRemove some HMAC_CTX_init() remnants in HMAC(3).
tb [Tue, 25 Jan 2022 17:55:39 +0000 (17:55 +0000)]
Remove some HMAC_CTX_init() remnants in HMAC(3).

spotted by/ok jmc

2 years agoFix another return 0 bug in SSL_shutdown()
tb [Tue, 25 Jan 2022 15:00:09 +0000 (15:00 +0000)]
Fix another return 0 bug in SSL_shutdown()

If tls13_recod_layer_send_pending() returns TLS13_IO_EOF, we will
bubble this up to the caller via tls13_legacy_return_code(), which
translates TLS13_IO_EOF to 0. This can happen if we have pending
post handshake-handshake data and the peer closes the pipe.

Presumably tls13_legacy_shutdown() should be rewritten yet again.

ok jsing

2 years agoAvoid an infinite loop in SSL_shutdown()
tb [Tue, 25 Jan 2022 14:51:54 +0000 (14:51 +0000)]
Avoid an infinite loop in SSL_shutdown()

If the peer closed the write side of the connection and we have not
yet received the close_notify, SSL_shutdown() makes an extra read to
try and read the peer's close_notify from the pipe. In that situation,
we receive EOF. The legacy stack will return -1 while the TLSv1.3
stack will end up returning 0.

Since the documentation is not super explicit about what should be
done if SSL_shutdown() returns 0, some applications will enter an
infinite loop. The code and documentation indicate that SSL_shutdown()
should only be called once more if it returned 0. Newer versions
of the OpenSSL documentation explicitly say that one should call
SSL_read() if SSL_shutdown() returns 0 in order to retrieve the
close_notify. Doing this would also have avoided this infinite loop.

Reported by Carsten Arzig and bluhm with a test case extracted from the
syslogd tests using IO::Socket::SSL, which has such an infinite loop.

ok bluhm jsing

2 years agoUse unguarded loads in stack trace saving
visa [Tue, 25 Jan 2022 07:10:19 +0000 (07:10 +0000)]
Use unguarded loads in stack trace saving

The stack trace saver should see a system state that is not broken.
Therefore use unguarded memory accesses.

However, the unwinder is still haphazard. Terminate immediately if
the program counter or stack pointer look inconsistent.

2 years agoPreserve pcb_onfault in kdbpeek() and kdbpoke()
visa [Tue, 25 Jan 2022 07:08:43 +0000 (07:08 +0000)]
Preserve pcb_onfault in kdbpeek() and kdbpoke()

This avoids misbehaviour if kdbpeek() or kdbpoke() is used in the middle
of a guarded copy operation.

2 years agoCapture a repeated pattern into sysctl_securelevel_int function
gnezdo [Tue, 25 Jan 2022 04:04:40 +0000 (04:04 +0000)]
Capture a repeated pattern into sysctl_securelevel_int function

A few variables in the kernel are only writeable before securelevel is
raised. It makes sense to handle them with less code.

OK sthen@ bluhm@

2 years agoAn af-to pf rule must have an address family naf to use after
bluhm [Mon, 24 Jan 2022 22:49:48 +0000 (22:49 +0000)]
An af-to pf rule must have an address family naf to use after
translation.  Make stricter sanity checks in pf ioctl to avoid later
crashes during packet processing.
Reported-by: syzbot+0ef9190e7d0195496d0d@syzkaller.appspotmail.com
OK sashan@

2 years agoDocument X509_V_ERR_UNNESTED_RESOURCE. Previous version looked good
tb [Mon, 24 Jan 2022 17:39:59 +0000 (17:39 +0000)]
Document X509_V_ERR_UNNESTED_RESOURCE. Previous version looked good
to claudio

2 years agoAdjust code to handle unsupported file types a bit more graceful.
claudio [Mon, 24 Jan 2022 17:29:37 +0000 (17:29 +0000)]
Adjust code to handle unsupported file types a bit more graceful.
The file still needs to match its hash to make the MFT valid but then
there will only be a warning printed. Parsing of other files from that
MFT are not influenced.
OK tb@

2 years agoWhen rename fails show the source filename and not the destination.
claudio [Mon, 24 Jan 2022 15:50:34 +0000 (15:50 +0000)]
When rename fails show the source filename and not the destination.
The error should be more helpful thisway.
OK tb@

2 years agoGarbage collect unused ret in ssl3_get_new_session_ticket()
tb [Mon, 24 Jan 2022 13:53:29 +0000 (13:53 +0000)]
Garbage collect unused ret in ssl3_get_new_session_ticket()

ret is used to bubble up an error from ssl3_get_message() and is unused
otherwise. Zap dead store and silly ret = 1; return ret;

ok inoguchi jsing

2 years agoIn ssl3_get_server_key_exchange() switch a 'goto err' to
tb [Mon, 24 Jan 2022 13:51:48 +0000 (13:51 +0000)]
In ssl3_get_server_key_exchange() switch a 'goto err' to
'goto fatal_err' so that the illegal_parameter alert is
actually sent in case of X509_get0_pubkey() failure.

ok inoguchi jsing

2 years agoAvoid use of uninitialized in tlsext_sni_server_parse()
tb [Mon, 24 Jan 2022 13:49:50 +0000 (13:49 +0000)]
Avoid use of uninitialized in tlsext_sni_server_parse()

If the hostname is too long, tlsext_sni_is_valid_hostname() will fail
without having initialized *is_ip. As a result, the garbage value could
lead to accepting (but otherwise ignoring) overlong and possibly invalid
hostnames without erroring in tlsext_sni_server_parse().

ok inoguchi jsing

2 years agoGarbage collect the unused rv in tls1_check_ec_server_key() and
tb [Mon, 24 Jan 2022 13:47:53 +0000 (13:47 +0000)]
Garbage collect the unused rv in tls1_check_ec_server_key() and
convert to usual form of error checking.

ok inoguchi jsing

2 years agosync dma-resv with linux-5.15.y
jsg [Mon, 24 Jan 2022 08:55:58 +0000 (08:55 +0000)]
sync dma-resv with linux-5.15.y

revert linux cd29f22019ec4ab998d2e1e8c831c7c42db4aa7d
dma-buf: Use sequence counter with associated wound/wait mutex
to not have to deal with seqcount_ww_mutex

2 years agoin the options list, show -f as taking "file ..." arguments;
jmc [Mon, 24 Jan 2022 06:54:15 +0000 (06:54 +0000)]
in the options list, show -f as taking "file ..." arguments;
tweak/ok claudio

2 years agoRedownload existing files with failed checksums
afresh1 [Mon, 24 Jan 2022 00:47:05 +0000 (00:47 +0000)]
Redownload existing files with failed checksums

2 years agomove uao_reference() call before uvm_map()
jsg [Sun, 23 Jan 2022 22:53:03 +0000 (22:53 +0000)]
move uao_reference() call before uvm_map()

other uses in the kernel do this as uvm_map() may sleep and the segment
may be deallocated while sleeping without a reference

kettenis notes that shouldn't happen here due to a obj reference from an
earlier i915_gem_object_lookup() call

ok visa@ kettenis@

2 years agoDefine all TCP TF_ flags as unsigned numbers. They are stored in
bluhm [Sun, 23 Jan 2022 21:44:31 +0000 (21:44 +0000)]
Define all TCP TF_ flags as unsigned numbers.  They are stored in
u_int t_flags.  Shifting TF_TIMER with TCPT_DELACK can touch the
sign bit.
found by kubsan; suggested by deraadt@; OK miod@

2 years agorearrange SYNOPSIS/usage to be a bit clearer;
jmc [Sun, 23 Jan 2022 18:40:55 +0000 (18:40 +0000)]
rearrange SYNOPSIS/usage to be a bit clearer;
discussed with and ok claudio

2 years agoHandle EINTR the same way in all poll loops. In all cases restart the
claudio [Sun, 23 Jan 2022 12:09:24 +0000 (12:09 +0000)]
Handle EINTR the same way in all poll loops. In all cases restart the
poll loop. In the main process move the timeout handling for repositories
into a single function that does the timeouts and the calculation of the
timeout in one go.
OK tb@

2 years agoOn poll() failure we want to skip pollfd related action but the signal
claudio [Sun, 23 Jan 2022 11:59:40 +0000 (11:59 +0000)]
On poll() failure we want to skip pollfd related action but the signal
delivery checks at the end still need to happen. So that on EINTR bgpd
processes reconfigure or mrt files ASAP.
Fix for mrt integration tests.
Reported by and ok anton@

2 years agozap extra blank line
tb [Sun, 23 Jan 2022 09:19:13 +0000 (09:19 +0000)]
zap extra blank line

2 years agoAllow rpki-client to display more than one file in -f mode.
claudio [Sun, 23 Jan 2022 07:21:12 +0000 (07:21 +0000)]
Allow rpki-client to display more than one file in -f mode.
Change -f to be a mode flag and pass one or multiple files as arguments
to rpki-client. Some extra checks need to be done to not load the same
certificate or CRL multiple times.
Input and OK tb@

2 years agoSimplify valid_cert() and valid_roa() by passing in struct auth instead
claudio [Sun, 23 Jan 2022 05:59:35 +0000 (05:59 +0000)]
Simplify valid_cert() and valid_roa() by passing in struct auth instead
of looking it up again. For this valid_roa() needs to be moved up in
proc_parser_roa() also move out the assignment of the TAL id. Not the
right thing to alter an object in a validation function.
OK tb@

2 years agoFlush all stdio streams before running a shell command.
millert [Sat, 22 Jan 2022 23:22:11 +0000 (23:22 +0000)]
Flush all stdio streams before running a shell command.
Otherwise, if ed's output is not line buffered (e.g. if it is
redirected to a file or pipe) the shell command output may be
displayed before data buffered by ed itself is written.
From Soeren Tempel.  OK deraadt@

2 years agoWrap some long lines.
krw [Sat, 22 Jan 2022 15:39:00 +0000 (15:39 +0000)]
Wrap some long lines.

2 years agoChange valid_filename() ot return an enum rtype and rename it to
tb [Sat, 22 Jan 2022 09:18:48 +0000 (09:18 +0000)]
Change valid_filename() ot return an enum rtype and rename it to
rtype_from_mftfile(). Move both rtype_from functions to mft.c.

ok beck claudio

2 years agoSupport multiple -v as promised in the man page
afresh1 [Sat, 22 Jan 2022 05:03:47 +0000 (05:03 +0000)]
Support multiple -v as promised in the man page

There are now four levels of verbosity:
0. Prints only the summary
1. Prints a line when installing/removing
2. Uses the ftp(1) progress bar
3. Provides more details for debugging

With some excellent ksh knowledge provided by kn@

2 years agosync
deraadt [Sat, 22 Jan 2022 00:49:39 +0000 (00:49 +0000)]
sync

2 years agoadd a ssh_packet_process_read() function that reads from a fd
djm [Sat, 22 Jan 2022 00:49:34 +0000 (00:49 +0000)]
add a ssh_packet_process_read() function that reads from a fd
directly into the transport input buffer.

Use this in the client and server mainloops to avoid unnecessary
copying. It also lets us use a more greedy read size without penalty.

Yields a 2-3% performance gain on cipher-speed.sh (in a fairly
unscientific test tbf)

feedback dtucker@ ok markus@

2 years agoUse sshbuf_read() to read directly into the channel input buffer
djm [Sat, 22 Jan 2022 00:45:31 +0000 (00:45 +0000)]
Use sshbuf_read() to read directly into the channel input buffer
rather than into a stack buffer that needs to be copied again;
Improves performance by about 1% on cipher-speed.sh
feedback dtucker@ ok markus@

2 years agoUse memmove instead of memcpy for overlapping memory
inoguchi [Sat, 22 Jan 2022 00:45:17 +0000 (00:45 +0000)]
Use memmove instead of memcpy for overlapping memory

CID 251047 251094

OK beck@ jsing@ millert@ tb@

2 years agoAdd a sshbuf_read() that attempts to read(2) directly in to a
djm [Sat, 22 Jan 2022 00:43:43 +0000 (00:43 +0000)]
Add a sshbuf_read() that attempts to read(2) directly in to a
sshbuf; ok markus@

2 years agoUse memmove instead of memcpy for overlapping memory
inoguchi [Sat, 22 Jan 2022 00:43:41 +0000 (00:43 +0000)]
Use memmove instead of memcpy for overlapping memory

CID 250936 251103

OK beck@ jsing@ millert@ tb@

2 years agoX509_GET_PUBKEY(3) return value check in libcrypto
inoguchi [Sat, 22 Jan 2022 00:36:46 +0000 (00:36 +0000)]
X509_GET_PUBKEY(3) return value check in libcrypto

CID 345116

ok beck@ tb@

2 years agoX509_GET_PUBKEY(3) return value check in libcrypto
inoguchi [Sat, 22 Jan 2022 00:34:48 +0000 (00:34 +0000)]
X509_GET_PUBKEY(3) return value check in libcrypto

CID 25131

ok beck@ tb@

suggest using X509_REQ_get0_pubkey() and remove the EVP_PKEY_free() from tb@

2 years agoX509_GET_PUBKEY(3) return value check in libcrypto
inoguchi [Sat, 22 Jan 2022 00:33:02 +0000 (00:33 +0000)]
X509_GET_PUBKEY(3) return value check in libcrypto

ok beck@ tb@

suggest using X509_get0_pubkey() and remove EVP_PKEY_free() from tb@

2 years agoX509_GET_PUBKEY(3) return value check in libcrypto
inoguchi [Sat, 22 Jan 2022 00:31:23 +0000 (00:31 +0000)]
X509_GET_PUBKEY(3) return value check in libcrypto

ok beck@ tb@

2 years agoX509_GET_PUBKEY(3) return value check in libcrypto
inoguchi [Sat, 22 Jan 2022 00:29:59 +0000 (00:29 +0000)]
X509_GET_PUBKEY(3) return value check in libcrypto

ok beck@ tb@

2 years agorelease mtx before pool_get() in __xa_alloc()/__xa_store() when
jsg [Fri, 21 Jan 2022 23:49:36 +0000 (23:49 +0000)]
release mtx before pool_get() in __xa_alloc()/__xa_store() when
PR_WAITOK is used to not sleep with mtx held

2 years agoTreat ppoll(2) errors as fatal. OK deraadt@
millert [Fri, 21 Jan 2022 22:53:20 +0000 (22:53 +0000)]
Treat ppoll(2) errors as fatal.  OK deraadt@

2 years agoAdd function to determine the file type from the file name extension
tb [Fri, 21 Jan 2022 18:49:44 +0000 (18:49 +0000)]
Add function to determine the file type from the file name extension

rpki-client uses the same idiom to determine the file type in too many
places. Use one function that determines the appropriate RTYPE from the
file name. Add that type to struct mftfile and use this new member to
simplify queue_add_from_mft*().

input/ok claudio

2 years agothe wrapped cron line is going to lose people
deraadt [Fri, 21 Jan 2022 18:46:21 +0000 (18:46 +0000)]
the wrapped cron line is going to lose people

2 years ago"move" part of the OpenBSD::State code into its own (stateless) class
espie [Fri, 21 Jan 2022 17:41:41 +0000 (17:41 +0000)]
"move" part of the OpenBSD::State code into its own (stateless) class
so that it can be reused light-weight by portgen and the likes.

(the actual move will happen once the base sets all have the new files)

2 years agoSplit PRT_print() into PRT_print_parthdr() and PRT_print_part()
krw [Fri, 21 Jan 2022 17:29:24 +0000 (17:29 +0000)]
Split PRT_print() into PRT_print_parthdr() and PRT_print_part()
to align with GPT functions. Simplifies logic and eliminates the
magic invocations to print the header.

No functional change.

2 years agoLimit unwinder symbol search to FUNC symbols
visa [Fri, 21 Jan 2022 16:39:56 +0000 (16:39 +0000)]
Limit unwinder symbol search to FUNC symbols

The prolog scanning has to locate the start of the subroutine, not some
local symbol in the middle.

This should reduce cases where unwinding goes astray.

OK miod@

2 years agoIn 1999 fd_set overflowing beyond FD_SETSIZE became enough of a problem that I
deraadt [Fri, 21 Jan 2022 16:18:16 +0000 (16:18 +0000)]
In 1999 fd_set overflowing beyond FD_SETSIZE became enough of a problem that I
changed the entire tree to use fd_set allocation, and this manpage documented
the "calloc(howmany(max+1, NFDBITS), sizeof(fd_mask))" idiom.  Since then we
completed converting the entire tree to poll(2), for many reasons, even ssh/sshd.
Now the use of kernel-only sys/param.h-found howmany() and related macross grate
on me, so it is time to recommend use of poll(2) instead.  [On a related note,
MacOS poll(2) is been dangerously broken for many years; that is their problem to
handle as the whole ecosystem joins us in pivoting select -> poll)
ok millert

2 years agoFix and re-enable active scans on iwm(4) and iwx(4).
stsp [Fri, 21 Jan 2022 15:51:02 +0000 (15:51 +0000)]
Fix and re-enable active scans on iwm(4) and iwx(4).

Ensure that we supply the access point's DTIM period to firmware after
an active scan, as soon as the next beacon arrives. This prevents the
problems which prompted us to keep active scans disabled in our drivers.

Problem debugged and patch by zxystd from the OpenIntelWireless project.
I made some tweaks regarding TIM parsing, which were reviewed by zxystd.

Johannes Berg from Intel has confirmed to me via IRC that firmware
will misbehave if running with a zero DTIM period.

Tested:
8265: jca, stsp
9260: kettenis (possible fallout observed here; will keep an eye on it)
9650: stsp
ax200: zxystd, kevlo, stsp
ax201: stsp

ok kevlo@ kettenis@

2 years agoDocument EAGAIN error return, as specified by POSIX.
millert [Fri, 21 Jan 2022 15:23:36 +0000 (15:23 +0000)]
Document EAGAIN error return, as specified by POSIX.
Our poll does not use EAGAIN but code needs to handle it for portability.
OK deraadt@ visa@

2 years agoEnable dt(4)
kn [Fri, 21 Jan 2022 15:05:01 +0000 (15:05 +0000)]
Enable dt(4)

This produces helpful flamegraphs on macppc.
With Andrew Krasavin <noiseless-ak AT yandex DOT ru>.

OK mpi

2 years agoAvoid out-of-bounds accesses in case the filename is too showrt to
tb [Fri, 21 Jan 2022 14:08:33 +0000 (14:08 +0000)]
Avoid out-of-bounds accesses in case the filename is too showrt to
contain an extension of length four.

ok claudio

2 years agoFix NULL dereference which allows user programs to read parts
tobhe [Fri, 21 Jan 2022 14:07:06 +0000 (14:07 +0000)]
Fix NULL dereference which allows user programs to read parts
of the kernel memory.  Found with clang static analyzer.

Feedback and ok gkoehler@
ok bluhm@

2 years agosync kfd_ioctl.h with linux 5.15
jsg [Fri, 21 Jan 2022 11:59:40 +0000 (11:59 +0000)]
sync kfd_ioctl.h with linux 5.15

2 years agomove media-bus-format.h to match comment in drm_connector.c
jsg [Fri, 21 Jan 2022 11:37:53 +0000 (11:37 +0000)]
move media-bus-format.h to match comment in drm_connector.c

2 years agodocument show-list
espie [Fri, 21 Jan 2022 09:06:38 +0000 (09:06 +0000)]
document show-list

2 years agoadd a helper for writing an error message to the stderr_buf and setting
djm [Fri, 21 Jan 2022 07:04:19 +0000 (07:04 +0000)]
add a helper for writing an error message to the stderr_buf and setting
quit_pending; no functional change but saves a bunch of boilerplate

2 years agocorrect comment and use local variable instead of long indirection;
djm [Fri, 21 Jan 2022 06:58:06 +0000 (06:58 +0000)]
correct comment and use local variable instead of long indirection;
spotted by dtucker@

2 years agoRequire trig_test-2 to pass on arm64 and powerpc64
gnezdo [Fri, 21 Jan 2022 03:13:22 +0000 (03:13 +0000)]
Require trig_test-2 to pass on arm64 and powerpc64

Thanks to mbuhl@ for testing on a plethora of platforms.

OK mbuhl@, tested by mbuhl@ and phessler@

2 years agoOptimization for tiny x in cos and sin
gnezdo [Fri, 21 Jan 2022 03:13:10 +0000 (03:13 +0000)]
Optimization for tiny x in cos and sin

Subset of FreeBSD commit 4339c67c485f0b1f7699863fc29f6c06862d1dde:
Moved the optimization for tiny x from __kernel_{cos,sin}[f](x) to
{cos_sin}[f](x) so that x doesn't need to be reclassified in the
"kernel" functions to determine if it is tiny (it still needs to be
reclassified in the cosine case for other reasons that will go away).
...

Parts of the original change were applied separately before.

Suggested by kettenis@

OK mbuhl@, tested by mbuhl@ and phessler@

2 years agoUnplug assembly implementations of trig functions on x86 platforms
gnezdo [Fri, 21 Jan 2022 03:12:55 +0000 (03:12 +0000)]
Unplug assembly implementations of trig functions on x86 platforms

The same change was done by NetBSD some time back as:

Disable x87 implementations of sin, cos, tan.

The x87 hardware uses a bad approximation to pi for argument
reduction, and consequently yields bad answers for inputs near pi or
pi/2.

OK mbuhl@, tested by mbuhl@ and phessler@

2 years agoCopy cos(3) software implementation from FreeBSD-13
gnezdo [Fri, 21 Jan 2022 03:12:43 +0000 (03:12 +0000)]
Copy cos(3) software implementation from FreeBSD-13

The result passes more tests from msun suite. In particular,
testacc(cos, -0.34061437849088045332L, 0.94254960031831729956L,
ALL_STD_EXCEPT, FE_INEXACT);
matches instead of being 1e-16 off.

OK mbuhl@, tested by mbuhl@ and phessler@

2 years agoEnable all supported ciphers and macs in the server before trying
dtucker [Fri, 21 Jan 2022 02:54:41 +0000 (02:54 +0000)]
Enable all supported ciphers and macs in the server before trying
to benchmark them.  Increase the data file size to get more signal.

2 years agoWhen poll(2) returns -1, for some error conditions pfd[].revents is
deraadt [Fri, 21 Jan 2022 00:53:40 +0000 (00:53 +0000)]
When poll(2) returns -1, for some error conditions pfd[].revents is
not cleared.  There are subtle errors in various programs.
In this particular case, the program should error out.
ok djm millert

2 years agoRemove the remaining three parens in return statements.
tb [Thu, 20 Jan 2022 20:37:33 +0000 (20:37 +0000)]
Remove the remaining three parens in return statements.

2 years agoUse correct spelling of NULL.
tb [Thu, 20 Jan 2022 20:35:46 +0000 (20:35 +0000)]
Use correct spelling of NULL.

2 years agoMake sure that all poll loops properly restart the poll loop on EINTR.
claudio [Thu, 20 Jan 2022 18:06:20 +0000 (18:06 +0000)]
Make sure that all poll loops properly restart the poll loop on EINTR.
Also either fail hard or restart after other errors. In anycase do not
look at pollfds after an error.
OK benno@

2 years agocatch poll() returning EINTR.
benno [Thu, 20 Jan 2022 17:56:35 +0000 (17:56 +0000)]
catch poll() returning EINTR.
ok millert@ claudio@

2 years agopfkey import_flow() must do the NULL check before doing pointer
bluhm [Thu, 20 Jan 2022 17:13:12 +0000 (17:13 +0000)]
pfkey import_flow() must do the NULL check before doing pointer
arithmetic.
found by kubsan; joint work with tobhe@; OK millert@

2 years agosnprintf(9) allows NULL string if size is 0. But doing NULL pointer
bluhm [Thu, 20 Jan 2022 17:11:30 +0000 (17:11 +0000)]
snprintf(9) allows NULL string if size is 0.  But doing NULL pointer
arithmetic is undefined behavior.  Check that size is positive
before adding to pointer.  While there, use NUL char for string
termination.
found by kubsan; joint work with tobhe@; OK millert@

2 years agoMove the notBefore and notAfter checks from proc_parser_root_cert()
claudio [Thu, 20 Jan 2022 16:36:19 +0000 (16:36 +0000)]
Move the notBefore and notAfter checks from proc_parser_root_cert()
to ta_parse(). This fits better there. Also drop extracting and
printing the x509 subject of the TAs. The subject is more or less
the filename anyway which is already printed.
OK tb@

2 years agoremove unused variable from all copies of _asr_strdname()
naddy [Thu, 20 Jan 2022 14:18:10 +0000 (14:18 +0000)]
remove unused variable from all copies of _asr_strdname()

... including those inlined into print_dname().  This also fixes
-Wunused-but-set-variable warnings warnings in smtpd and smtpctl.
The code was imported with asr and then copied around.

ok deraadt@ guenther@

2 years agoospf6ctl: fix -Wunused-but-set-variable warning
naddy [Thu, 20 Jan 2022 14:12:55 +0000 (14:12 +0000)]
ospf6ctl: fix -Wunused-but-set-variable warning

ok guenther@

2 years agoeigrpd: fix -Wunused-but-set-variable warning
naddy [Thu, 20 Jan 2022 14:11:27 +0000 (14:11 +0000)]
eigrpd: fix -Wunused-but-set-variable warning

ok guenther@

2 years agodvmrpctl: fix -Wunused-but-set-variable warning
naddy [Thu, 20 Jan 2022 14:10:07 +0000 (14:10 +0000)]
dvmrpctl: fix -Wunused-but-set-variable warning

ok guenther@

2 years agomg: fix -Wunused-but-set-variable warnings
naddy [Thu, 20 Jan 2022 14:07:34 +0000 (14:07 +0000)]
mg: fix -Wunused-but-set-variable warnings

strtonum() is only called to verify that a string is numerical, the
return value is unused.
inlist is no longer used after the code was refactored.

ok millert@ guenther@

2 years agoospf6d: fix -Wunused-but-set-variable warnings
naddy [Thu, 20 Jan 2022 14:03:31 +0000 (14:03 +0000)]
ospf6d: fix -Wunused-but-set-variable warnings

ospf6d.c: sync a missing bit of (disabled) code with ospfd
rde.c: ifdef out some more incomplete code

ok denis@ claudio@