openbsd
2 years agoblist: fix a possible blist corruption with blist_alloc() due to unsigned
semarie [Sat, 13 Aug 2022 16:02:15 +0000 (16:02 +0000)]
blist: fix a possible blist corruption with blist_alloc() due to unsigned
swblk_t on OpenBSD.

reorder if condition in blst_meta_alloc(), in order to check if the node is
'Terminator' node first (and leave the loop).

DragonFlyBSD is unaffected by it as swblk_t is signed (and the first condition
isn't taken).

add a regress test for it.

while here, more the KASSERT() to KDASSERT(). it is useful but only with DEBUG.

ok miod@ todd@

2 years agoCorrect rx data rate for rtl8192eu
kevlo [Sat, 13 Aug 2022 14:16:59 +0000 (14:16 +0000)]
Correct rx data rate for rtl8192eu

ok stsp@, jmatthew@

2 years agoclarify the boot text;
jmc [Sat, 13 Aug 2022 11:13:17 +0000 (11:13 +0000)]
clarify the boot text;
discussed with and ok stsp

2 years agoThe portgen Python modue has been rotting and doesn't generate a usable
kmos [Sat, 13 Aug 2022 07:14:07 +0000 (07:14 +0000)]
The portgen Python modue has been rotting and doesn't generate a usable
port. Disable it and pull mention of it from the portgen(1) man page.

Don't delete the modules yet, in case someone wants to whip it back into
shape.

ok sthen

2 years agoavoid uninitialised var when boot_unit has an unexpected value
jsg [Sat, 13 Aug 2022 06:44:48 +0000 (06:44 +0000)]
avoid uninitialised var when boot_unit has an unexpected value
tested by and ok aoyama@

2 years agosync
deraadt [Sat, 13 Aug 2022 04:35:12 +0000 (04:35 +0000)]
sync

2 years agoCrank amd64 boot loader version numbers for softraid(4) RAID 1C boot support.
stsp [Fri, 12 Aug 2022 20:18:58 +0000 (20:18 +0000)]
Crank amd64 boot loader version numbers for softraid(4) RAID 1C boot support.

2 years agoadd support for booting from RAID 1C softraid(4) volumes on amd64
stsp [Fri, 12 Aug 2022 20:17:46 +0000 (20:17 +0000)]
add support for booting from RAID 1C softraid(4) volumes on amd64

Only boot-loader changes are needed. Both installboot(8) and
the kernel already do what is required to make this work.

ok kn@

Tested:
biosboot on vmm: kn, stsp
biosboot and efiboot on server hardware: stsp

2 years agoRevert to pre-r1.249 more laissez-faire checks for valid MBR
krw [Fri, 12 Aug 2022 20:05:49 +0000 (20:05 +0000)]
Revert to pre-r1.249 more laissez-faire checks for valid MBR
partitions.

miod@ (re)discovered an off-by-one in some device size
calculations. Whether the ancient misbehaviour of some devices to
confuse number of sectors with highest valid sector address or
something newer.

Should fix miod@'s octeon boot disk.

2 years agoMake sure we don't pass uninitialized siginfo values to trapsignal(); from
miod [Fri, 12 Aug 2022 17:19:52 +0000 (17:19 +0000)]
Make sure we don't pass uninitialized siginfo values to trapsignal(); from
clang via jsg@, ok jsg@

2 years agoRemove differences between ip_fragment() and ip6_fragment(). They
bluhm [Fri, 12 Aug 2022 17:04:16 +0000 (17:04 +0000)]
Remove differences between ip_fragment() and ip6_fragment().  They
do nearly the same thing, so they should look similar.
OK sashan@

2 years agoUpdate to 2022bgtz from https://github.com/JodaOrg/global-tz
millert [Fri, 12 Aug 2022 16:50:57 +0000 (16:50 +0000)]
Update to 2022bgtz from https://github.com/JodaOrg/global-tz
Major changes:
 o Chile's DST is delayed by a week in September 2022.
 o Iran no longer observes DST after 2022.
 o Rename Europe/Kiev to Europe/Kyiv.

2 years agoFix non working continue in do while(0) loop.
bluhm [Fri, 12 Aug 2022 16:42:54 +0000 (16:42 +0000)]
Fix non working continue in do while(0) loop.
OK mvs@ jca@
CID 1519492

2 years agoRemove unused fields from 'pflow_softc' structure.
mvs [Fri, 12 Aug 2022 16:38:50 +0000 (16:38 +0000)]
Remove unused fields from 'pflow_softc' structure.

ok bluhm@

2 years agoFix race between pflow_output_process() and pflow_clone_destroy().
mvs [Fri, 12 Aug 2022 16:38:09 +0000 (16:38 +0000)]
Fix race between pflow_output_process() and pflow_clone_destroy().

Unlink pflow(4) interface from `pflowif_list' before start destruction to
prevent pflow_output_process() being rescheduled. Also wait until running
pflow_output_process() task finished.

Problem reported and fix tested by Hrvoje Popovski.

ok bluhm@

2 years agoFix upper bound in a for loop (no functional change).
tb [Fri, 12 Aug 2022 16:13:40 +0000 (16:13 +0000)]
Fix upper bound in a for loop (no functional change).

2 years agoTweak a comment to be more accurate.
tb [Fri, 12 Aug 2022 16:12:39 +0000 (16:12 +0000)]
Tweak a comment to be more accurate.

2 years agoThere are some places in ip and ip6 input where operations fail due
bluhm [Fri, 12 Aug 2022 14:49:15 +0000 (14:49 +0000)]
There are some places in ip and ip6 input where operations fail due
to out of memory.  Use a generic idropped counter for those.
OK mvs@

2 years agoPut more struct vnode fields under splbio().
visa [Fri, 12 Aug 2022 14:30:52 +0000 (14:30 +0000)]
Put more struct vnode fields under splbio().

Buffer cache related struct vnode fields can be accessed in interrupt
context. Be more consistent with the use of splbio().

OK mpi@

2 years agoFix to work 1bpp Xorg server again on 1bpp framebuffer hardware.
aoyama [Fri, 12 Aug 2022 13:36:19 +0000 (13:36 +0000)]
Fix to work 1bpp Xorg server again on 1bpp framebuffer hardware.

Recent xenocara wsfb driver can treat LUNA's framebuffer "offset", but it
requires one more page by mmap() when we use offset.

Noticed and tested on nono emulator with 1bpp setting.

2 years agoImplement slowcgi_timeout() to actually kill the backend bgpctl process.
claudio [Fri, 12 Aug 2022 13:24:30 +0000 (13:24 +0000)]
Implement slowcgi_timeout() to actually kill the backend bgpctl process.
If that succeeds the fcgi session will be terminated the regular way.
If it fails close all fds and finish the request.
Sending a SIGTERM to a read only bgpctl process should be fine at any point.
Also reduce the timeout to 30sec. This is not long enough to dump a full
rib but nobody should do that.
OK tb@

2 years agoNo need to make a deep copy of the EE cert
tb [Fri, 12 Aug 2022 13:19:02 +0000 (13:19 +0000)]
No need to make a deep copy of the EE cert

The EE Cert has just been allocated as part of deserializing the cms.
There is no need for an expensive copy, we can just keep a reference.

ok job

2 years agoAt successful return ip6_check_rh0hdr() keeps *offp unmodified.
bluhm [Fri, 12 Aug 2022 12:08:54 +0000 (12:08 +0000)]
At successful return ip6_check_rh0hdr() keeps *offp unmodified.
The IPv6 routing header type 0 check should modify *offp only in
case of an error, so that the generated icmp6 packet has the correct
pointer.
OK sashan@

2 years agopkg_add.1: fix typo in pkg stem with flavor example
landry [Fri, 12 Aug 2022 10:38:37 +0000 (10:38 +0000)]
pkg_add.1: fix typo in pkg stem with flavor example

from Frederic Nowak, thanks !

2 years agoUse break instead of return so that a HEAD request still consumes all data.
claudio [Fri, 12 Aug 2022 08:40:25 +0000 (08:40 +0000)]
Use break instead of return so that a HEAD request still consumes all data.
OK op@

2 years agouse string literal for format string
jsg [Fri, 12 Aug 2022 08:34:43 +0000 (08:34 +0000)]
use string literal for format string
ok deraadt@ miod@

2 years agouse string literal for format string
jsg [Fri, 12 Aug 2022 08:31:06 +0000 (08:31 +0000)]
use string literal for format string
ok miod@

2 years agofix regression introduced in previous commit. HEAD replies don't have a
op [Fri, 12 Aug 2022 06:41:41 +0000 (06:41 +0000)]
fix regression introduced in previous commit.  HEAD replies don't have a
body so server_fcgi_error shouldn't print the end marker.

OK claudio@

2 years agosftp-server: support home-directory request
djm [Fri, 12 Aug 2022 05:20:28 +0000 (05:20 +0000)]
sftp-server: support home-directory request

Add support to the sftp-server for the home-directory extension defined
in draft-ietf-secsh-filexfer-extensions-00. This overlaps a bit with the
existing expand-path@openssh.com, but uses a more official protocol name,
and so is a bit more likely to be implemented by non-OpenSSH clients.

From Mike Frysinger, ok dtucker@

2 years agoamd64: simplify TSC synchronization testing
cheloha [Fri, 12 Aug 2022 02:20:36 +0000 (02:20 +0000)]
amd64: simplify TSC synchronization testing

Computing a per-CPU TSC skew value is error-prone, especially on
multisocket machines and VMs.  My best guess is that larger latencies
appear to the current skew measurement test as TSC desync, and so the
TSC is demoted to a kernel timecounter on these machines or marked
non-monotonic.

This patch eliminates per-CPU TSC skew values.  Instead of trying to
measure and correct for TSC desync we only try to detect desync, which
is less error-prone.  This approach should allow a wider variety of
machines to use the TSC as a timecounter when running OpenBSD.

In the new sync test, both CPUs repeatedly try to detect whether their
TSC is trailing the other CPU's TSC.  The upside to this approach is
that it yields no false positives.  The downside to this approach is
that it takes more time than the current skew measurement test.  Each
test round takes 1ms, and we run up to two rounds per CPU, so this
patch slows boot down by 2ms per AP.

If any CPU fails the sync test, the TSC is marked non-monotonic and a
different timecounter is activated.  The TC_USER flag remains intact.
There is no middle ground where we fall back to only using the TSC in
the kernel.

Before running the test, we check for the IA32_TSC_ADJUST register and
reset it if necessary.  This is a trivial way to work around firmware
bugs that desync the TSC before we reach the kernel.  Unfortunately,
at the moment this register appears to only be available on Intel
processors.  I cannot find an equivalent but differently-named MSR for
AMD processors.

Because there is no per-CPU skew value, there is also no concept of
TSC drift anymore.

Miscellaneous notes:

- This patch adds a new timecounter utility function, tc_reset_quality().
  Used after sync test failure to mark the TSC non-monotonic.

- I have left TSC_DEBUG enabled for now.  Unsure if we should leave it
  enabled for release or not.  If we disable it we no longer run the
  sync test after failing it once.  Running the test even after failure
  provides information about the desync on every CPU.

- Taking 1ms per test round is fairly conservative.  We can experiment
  with and discuss shorter test rounds.  My main goal with a relatively
  long test round is ensuring VMs actually run the test.  It would be
  bad if a hypervisor interrupted the test for so long that it concealed
  desync.

- The use of two test rounds is mostly a diagnostic tool: it would be
  very strange if a CPU passed the first round but failed the second.
  If we ever saw this in the wild it would indicate something odd.

- Most of the desync seen in test reports is on Ryzen CPUs.  I
  believe, but cannot prove, that this is due to a widespread
  firmware bug on AMD motherboards.  Hopefully AMD and/or the
  downstream vendors fix it.

- Fixing TSC desync by writing the TSC directly with WRMSR is very
  difficult.  The TSC is a moving target incrementing very quickly and
  compensating for WRMSR overhead is non-trivial.  We can experiment
  with this, but my confidence is low that we can make it work reliably.

Prompted by deraadt@ and kettenis@ in 2021. Shepherded along by
deraadt@ throughout.  Reprompted by Yuichiro Naito several times.
With input from Yuichiro Naito, naddy@, sthen@, dv@, and deraadt@.

Tested by florian@, gnezdo@, sthen@, Josh Rickmar, dv@, Mohamed Aslan,
Hrvoje Popovski, Yuichiro Naito, semarie@, mlarkin@, asou@, jmatthew@,
Renato Aguiar, and Timo Myyra.

Patch v1: https://marc.info/?l=openbsd-tech&m=164330092208035&w=2
Patch v2: https://marc.info/?l=openbsd-tech&m=164558519712957&w=2
Patch v3: https://marc.info/?l=openbsd-tech&m=165698681018991&w=2
Patch v4: https://marc.info/?l=openbsd-tech&m=165835507113680&w=2
Patch v5: https://marc.info/?l=openbsd-tech&m=165923705118770&w=2

"just commit it" deraadt@

2 years agoCoverity says multiplying two uint32_t's and assigning them to
krw [Fri, 12 Aug 2022 00:32:59 +0000 (00:32 +0000)]
Coverity says multiplying two uint32_t's and assigning them to
a uint64_t may not produce the (humanly) obvious result.

Cast one of them to a (uint64_t) in the hope of invoking the
appropriate int promotion god.

CID 1519495

2 years agorenice(8): don't succeed after 256 errors
cheloha [Fri, 12 Aug 2022 00:24:07 +0000 (00:24 +0000)]
renice(8): don't succeed after 256 errors

Set error instead of incrementing it.

Link: https://marc.info/?l=openbsd-tech&m=166025831731506&w=2
ok millert@

2 years agoDon't trust gpt header data read from disk until after its
krw [Thu, 11 Aug 2022 20:22:27 +0000 (20:22 +0000)]
Don't trust gpt header data read from disk until after its
validity is checked.

Found the hard way by kn@

Cluebats from millert@ and deraadt@.

Fix tested by and ok kn@

2 years agopowerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()
cheloha [Thu, 11 Aug 2022 17:15:21 +0000 (17:15 +0000)]
powerpc64: cpu_initclocks: do tc_init(9) before cpu_startclock()

In the future, the clock interrupt will need a working timecounter to
accurately reschedule itself.

Move tc_init(9) up before cpu_startclock().

kettenis@ notes several other platforms need this same change.  Maybe
we can do the rest all at once.

Tested by kettenis@.

Link: https://marc.info/?l=openbsd-tech&m=165343754512382&w=2
ok kettenis@

2 years agoDon't yet configure smmu(4) on Qualcomm SoCs as used on the Lenovo x13s
patrick [Thu, 11 Aug 2022 14:49:42 +0000 (14:49 +0000)]
Don't yet configure smmu(4) on Qualcomm SoCs as used on the Lenovo x13s
as it is still not ready for runtime use and probably needs further quirks.

Discussed with deraadt@

2 years agocorrectly handle an abnormal fastcgi termination. httpd handles the
op [Thu, 11 Aug 2022 14:25:22 +0000 (14:25 +0000)]
correctly handle an abnormal fastcgi termination.  httpd handles the
disconnection from the fastcgi application via server_file_error which
assumes that the reply was completey done.  However, if the fastcgi
reply wasn't complete (e.g. because slowcgi hit the timeout) the HTTP
client are left "hanging" and waiting for a reply until they give up.

This adds a server_fcgi_error callback to handle the "no headers" and
"incomplete data" cases and properly close the reply before falling back
to server_file_error.

OK claudio@

2 years agoremove useless Pp;
jmc [Thu, 11 Aug 2022 14:04:08 +0000 (14:04 +0000)]
remove useless Pp;

2 years agoRemove unused variable
tb [Thu, 11 Aug 2022 10:36:32 +0000 (10:36 +0000)]
Remove unused variable

X509_NAME_print() is documented to print things at a given indentation
level. Unfortunately, this never worked since someone got some logic
wrong. Part of the wrong logic was removed in a dead code removal in
OpenSSL commit 92ada7cc, but the variable l was left behind, which leads
to compiler warnings on some platforms. End its sad life pointlessly
and incorrectly measuring column width and remove it.

ok jsing

2 years agoRevert previous commit as the bounds check was correct.
anton [Thu, 11 Aug 2022 09:22:38 +0000 (09:22 +0000)]
Revert previous commit as the bounds check was correct.

2 years agoAdd information about TCP_INFO. Be a bit vague about struct tcp_info since
claudio [Thu, 11 Aug 2022 09:15:35 +0000 (09:15 +0000)]
Add information about TCP_INFO. Be a bit vague about struct tcp_info since
it is not standardised.

2 years agoAdd TCP_INFO support to getsockopt for tcp sessions.
claudio [Thu, 11 Aug 2022 09:13:21 +0000 (09:13 +0000)]
Add TCP_INFO support to getsockopt for tcp sessions.

TCP_INFO provides a lot of information about the TCP session of this socket.
Many processes like to peek at the rtt of a connection but this also provides
a lot of more special info for use by e.g. tcpbench(1).
While the basic minimal info is available all the time the more specific
data is only populated for privileged processes. This is done to not share
data back to userland that may allow to attack a session.
TCP_INFO is available to pledge "inet" since pledged processes like chrome
tend to use TCP_INFO when available.
OK bluhm@

2 years agovi(1) Home/End bindings, from Markus F X J Oberhumer.
nicm [Thu, 11 Aug 2022 09:11:26 +0000 (09:11 +0000)]
vi(1) Home/End bindings, from Markus F X J  Oberhumer.

2 years agoRemove prefix from nested battery struct fields.
anton [Thu, 11 Aug 2022 07:32:57 +0000 (07:32 +0000)]
Remove prefix from nested battery struct fields.

2 years agoRevert uLong -> z_off_t change in the kernel
tb [Thu, 11 Aug 2022 02:56:34 +0000 (02:56 +0000)]
Revert uLong -> z_off_t change in the kernel

The kernel source assumes the original zlib ABI. There is no reason to
stick to this local change. Pull in a fix matching ctfdump.c -r1.26.

This is hopefully the last change necessary to undo a painful hack that
was committed 19 years ago without ok. Someone owes me a lot of beer...

ok millert

2 years agoadd some tests for parse_absolute_time(), including cases where it
djm [Thu, 11 Aug 2022 01:57:50 +0000 (01:57 +0000)]
add some tests for parse_absolute_time(), including cases where it
is forced to the UTC timezone. bz3468 ok dtucker

2 years agoallow certificate validity intervals, sshsig verification times and
djm [Thu, 11 Aug 2022 01:56:51 +0000 (01:56 +0000)]
allow certificate validity intervals, sshsig verification times and
authorized_keys expiry-time options to accept dates in the UTC time
zone in addition to the default of interpreting them in the system
time zone. YYYYMMDD and YYMMDDHHMM[SS] dates/times will be
interpreted as UTC if suffixed with a 'Z' character.

Also allow certificate validity intervals to be specified in raw
seconds-since-epoch as hex value, e.g. -V 0x1234:0x4567890. This
is intended for use by regress tests and other tools that call
ssh-keygen as part of a CA workflow.

bz3468 ok dtucker

2 years agoFix off-by-one in channel count, from NetBSD.
mglocker [Wed, 10 Aug 2022 20:19:22 +0000 (20:19 +0000)]
Fix off-by-one in channel count, from NetBSD.

"Looks right" deraadt@

2 years agoFix Gdium boot setup.
miod [Wed, 10 Aug 2022 17:37:48 +0000 (17:37 +0000)]
Fix Gdium boot setup.

2 years agoOn the Qualcomm SoC as implemented on the Lenovo x13s the BIOS already
patrick [Wed, 10 Aug 2022 17:02:37 +0000 (17:02 +0000)]
On the Qualcomm SoC as implemented on the Lenovo x13s the BIOS already
configures and makes use of the SMMU.  We need to keep those mappings
alive as otherwise the machine will die and reboot.  Unfortunately we
cannot simply set those domains to bypass, as when we set a domain to
bypass it is actually set to fault.  Instead reserve a domain and set
it to disabled, which behaves the same as if we used a bypass mapping.

With feedback from kettenis@

2 years agoProvide the AML root in ACPI's softc so that drivers that need access
patrick [Wed, 10 Aug 2022 16:58:16 +0000 (16:58 +0000)]
Provide the AML root in ACPI's softc so that drivers that need access
don't have to declare it using extern.

Suggested by and with feedback from kettenis@
Tested by deraadt@ on arm64, amd64 and i386
Tested by bluhm@ on amd64 and i386

2 years agoAvoid signed integer overflow due to unary negation
tb [Wed, 10 Aug 2022 16:51:26 +0000 (16:51 +0000)]
Avoid signed integer overflow due to unary negation

The current X509_print_ex() tries too hard pretty printing negative
serialNumbers (which shouldn't occur in the first place). In particular,
negating LONG_MAX leads to signed overflow. Ditch the code dealing with
negative serialNumbers representable as long and fall back to the long
form printing. This simplifies the code and fixes

oss-fuzz #49944

with/ok jsing

2 years agoAlso attach spdmem on Gdium.
miod [Wed, 10 Aug 2022 15:00:58 +0000 (15:00 +0000)]
Also attach spdmem on Gdium.

2 years agoClarify warning related to ROA eContent
job [Wed, 10 Aug 2022 14:54:03 +0000 (14:54 +0000)]
Clarify warning related to ROA eContent

2 years agoDisallow AS Resources extension on ROA EE certificates
job [Wed, 10 Aug 2022 14:37:33 +0000 (14:37 +0000)]
Disallow AS Resources extension on ROA EE certificates

The ROA specification (RFC 6482 section 4) is a bit underspecified, however
in the wild the RFC 3779 AS Resources extension never ever appears on ROA EE
certificates, as it serves no purpose in the validation process.

OK tb@

2 years agoReverse NULL check in krVPN6_change()
tb [Wed, 10 Aug 2022 14:21:24 +0000 (14:21 +0000)]
Reverse NULL check in krVPN6_change()

This matches the VPN4 code and avoids a NULL deref in the else branch.

ok claudio

2 years agoMore kroute_nexthop cleanup. Mainly use direct assignment instead of
claudio [Wed, 10 Aug 2022 14:17:01 +0000 (14:17 +0000)]
More kroute_nexthop cleanup. Mainly use direct assignment instead of
memcpy(). Additionally replace a bzero() with memset() and remove to
superfluous bzero calls.
OK tb@

2 years agoFix check of home directory (&& not ||), from Markus F X J Oberhumer,
nicm [Wed, 10 Aug 2022 14:03:59 +0000 (14:03 +0000)]
Fix check of home directory (&& not ||), from Markus F X J Oberhumer,
GitHub issue 3297.

2 years agoPass the "good random" flag from the bootblocks to the kernel when applicable.
miod [Wed, 10 Aug 2022 12:20:05 +0000 (12:20 +0000)]
Pass the "good random" flag from the bootblocks to the kernel when applicable.

2 years agoCast int64_t to uint64_t for negating
tb [Wed, 10 Aug 2022 12:06:28 +0000 (12:06 +0000)]
Cast int64_t to uint64_t for negating

Avoid signed integer overflow by casting an int64_t to uint64_t before
negating. Same fix was applied in a_int.c -r1.44, but was forgotten to
be applied to a_enum.c.

ok jsing

2 years agoOnly print versions we know about
tb [Wed, 10 Aug 2022 11:15:08 +0000 (11:15 +0000)]
Only print versions we know about

The version field of an X.509 Certificate is an enum

   Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }

Printing the version as l + 1 only really makes sense with 0 <= l <= 2.
Otherwise print a naked l while also indicating that it is an unknown
version.

ok jsing

2 years agoFix logic in network_dump_upcall()
claudio [Wed, 10 Aug 2022 11:11:02 +0000 (11:11 +0000)]
Fix logic in network_dump_upcall()

The nexthop can be valid but still a NULL pointer. In that case just set
the aid like it is done for invalid nexthops. If the nexthop is set by
explicitly specifying one then include the exit_nexthop, that is the
nexthop that is relevant for BGP. Further cleanup the function as usual.
OK tb@

2 years agoAdd iic at glxpcib, to get spdmem to attach on 2F-based systems.
miod [Wed, 10 Aug 2022 11:05:50 +0000 (11:05 +0000)]
Add iic at glxpcib, to get spdmem to attach on 2F-based systems.

2 years agoRemove alpha kernel code to process userland misaligned accesses, and the
miod [Wed, 10 Aug 2022 10:41:35 +0000 (10:41 +0000)]
Remove alpha kernel code to process userland misaligned accesses, and the
machdep.unaligned_* sysctl to control its behaviour. Such code made sense more
than 20 years ago where a lot of code was not 64-bit clean, but this is no
longer the case those days.

ok jsg@ millert@ deraadt@

2 years agoDecrease how long to wait for the remote peer to send IO before giving up
job [Wed, 10 Aug 2022 10:27:03 +0000 (10:27 +0000)]
Decrease how long to wait for the remote peer to send IO before giving up

If a repository is uncommunicative, rpki-client will try other transports,
or come back later (because of a next crontab invocation).

OK claudio@

2 years agofixup header for bgpctl show network so it lines up again.
claudio [Wed, 10 Aug 2022 10:21:47 +0000 (10:21 +0000)]
fixup header for bgpctl show network so it lines up again.
OK tb@

2 years agoRemove netlock assertion from vlan_ioctl(). Now (*if_ioctl)() called
mvs [Wed, 10 Aug 2022 09:01:48 +0000 (09:01 +0000)]
Remove netlock assertion from vlan_ioctl(). Now (*if_ioctl)() called
without netlock for SIOC{G,S}IFMEDIA commands.

ok bluhm@

2 years agoFix two compiler warnings resulting from last zlib bump
tb [Wed, 10 Aug 2022 07:58:04 +0000 (07:58 +0000)]
Fix two compiler warnings resulting from last zlib bump

total_out is now an unsigned long, so a format string warning is issued
on all architectures. Fix this and also fix the format string for the
off_t len, which is signed, not unsigned.

Comparing an unsigned long to an off_t involves implementation-defined
behavior for values > LONG_MAX on 64-bit architectures, so the compiler
complains. Fix this by checking that len >= 0 and then casting both sides
to a wider type.

reported by and ok deraadt

2 years agoBuild the Compress::Raw::Zlib perl module with /usr/lib/libz
tb [Wed, 10 Aug 2022 07:50:16 +0000 (07:50 +0000)]
Build the Compress::Raw::Zlib perl module with /usr/lib/libz

Two actively used copies of zlib in base are enough. This simplifies
handling security fixes. Now that zlib.h r1.7 is reverted, zlib ffi
works fine on 32-bit architectures.

Compared with an earlier attempt in March, this disables the Z_SOLO build
option (problem found by gkoehler) and fixes two regress tests to work
with zlib 1.2.12. Corresponding upstream commits:
https://github.com/pmqs/Compress-Raw-Zlib/commit/c44e0b732e214b7f77d42a3af6ae64e
https://github.com/pmqs/Compress-Raw-Zlib/commit/f47ea5f36c40fe19efe404dd75fd790

ok bluhm

2 years agoRemove games from the default $PATH in /etc/skel
tb [Wed, 10 Aug 2022 07:40:37 +0000 (07:40 +0000)]
Remove games from the default $PATH in /etc/skel

The games are a playground for developers. Their code is very old and full
of bugs.

ok deraadt kn

2 years agomatch other archs use %s for version printf
jsg [Wed, 10 Aug 2022 03:18:19 +0000 (03:18 +0000)]
match other archs use %s for version printf

2 years agoBackout "Call getuptime() just once per function"
kn [Tue, 9 Aug 2022 21:10:02 +0000 (21:10 +0000)]
Backout "Call getuptime() just once per function"

This caused stuck ndp cache entries as found by naddy, sorry.

2 years agosync
deraadt [Tue, 9 Aug 2022 21:09:40 +0000 (21:09 +0000)]
sync

2 years agoprevent breakable hyphens in segment identifiers
schwarze [Tue, 9 Aug 2022 11:21:50 +0000 (11:21 +0000)]
prevent breakable hyphens in segment identifiers
from being turned into underscores;
bug reported by <Eldred dot fr> Habert

2 years agoMake the http code respect MAX_CONN_TIMEOUT and fail connects once they
claudio [Tue, 9 Aug 2022 09:02:26 +0000 (09:02 +0000)]
Make the http code respect MAX_CONN_TIMEOUT and fail connects once they
hit this timeout. This is in line with the rsync code.
OK tb@ job@

2 years agoSync inflateGetHeader() fix from userland
tb [Tue, 9 Aug 2022 07:39:00 +0000 (07:39 +0000)]
Sync inflateGetHeader() fix from userland

2 years agoPull in inflateGetHeader() buffer overflow fix
tb [Tue, 9 Aug 2022 07:38:25 +0000 (07:38 +0000)]
Pull in inflateGetHeader() buffer overflow fix

2 years agoFix buffer overflow in inflateGetHeader()
tb [Tue, 9 Aug 2022 07:37:35 +0000 (07:37 +0000)]
Fix buffer overflow in inflateGetHeader()

This is the initial fix combined with a fix for a NULL deref introduced
in the initial fix.

ok millert, help from tj

commit eff308af425b67093bab25f80f1ae950166bece1
Author: Mark Adler <fork@madler.net>
Date:   Sat Jul 30 15:51:11 2022 -0700

    Fix a bug when getting a gzip header extra field with inflate().

    If the extra field was larger than the space the user provided with
    inflateGetHeader(), and if multiple calls of inflate() delivered
    the extra header data, then there could be a buffer overflow of the
    provided space. This commit assures that provided space is not
    exceeded.

https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1

commit 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d (HEAD -> develop, origin/develop)
Author: Mark Adler <fork@madler.net>
Date:   Mon Aug 8 10:50:09 2022 -0700

    Fix extra field processing bug that dereferences NULL state->head.

    The recent commit to fix a gzip header extra field processing bug
    introduced the new bug fixed here.

https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d

2 years agoriscv64: trigger deferred timer interrupts from splx(9)
cheloha [Tue, 9 Aug 2022 04:49:08 +0000 (04:49 +0000)]
riscv64: trigger deferred timer interrupts from splx(9)

In order to move riscv64 to a machine-independent clock interrupt
subsystem, the riscv64 clock interrupt code needs to function without
any specific knowledge of the clock interrupt schedule.

The easiest way to achieve this (as we just did with powerpc and
powerpc64) is, if the timer interrupt fires while the CPU is at or
above IPL_CLOCK, defer clock interrupt work until the the timer
interrupt is logically unmasked in splx(9).

In particular, trigger the timer interrupt from plic_setipl() so the
interrupt, if any, is pending before we handle soft interrupts.

Because we're no longer deferring work until the next tick, we don't
need to count pending statclock ticks in struct cpu_info.

kettenis@ notes that the timer triggering code should be refactored
into more generic code when we add support for a non-plic(4) riscv64
machine.

Graciously fixed, compiled, and tested by jca@.

Link: https://marc.info/?l=openbsd-tech&m=165931635410276&w=2
ok kettenis@

2 years agopowerpc64: trigger deferred DEC interrupts from splx(9)
cheloha [Tue, 9 Aug 2022 04:40:08 +0000 (04:40 +0000)]
powerpc64: trigger deferred DEC interrupts from splx(9)

In order to move to a machine-independent clock interrupt subsystem,
the powerpc64 clock interrupt code needs to work without knowing
anything about the clock interrupt schedule.

The easiest way to do this is, if the DEC fires while the CPU's IPL is
at or above IPL_CLOCK, to postpone clock interrupt work until the
clock interrupt is logically unmasked from splx(9).

Because we no longer defer work until the next tick, we don't need to
keep track of pending statclock ticks in the cpu_info struct.

With input from kettenis@.

Graciously compiled and tested by gkoehler@ and kettenis@.

Link: https://marc.info/?l=openbsd-tech&m=165862522102767&w=2
ok kettenis@ gkoehler@.

2 years agosync
deraadt [Mon, 8 Aug 2022 23:50:13 +0000 (23:50 +0000)]
sync

2 years agoIf interface drivers had enabled transmit offloading of the payload
bluhm [Mon, 8 Aug 2022 23:00:51 +0000 (23:00 +0000)]
If interface drivers had enabled transmit offloading of the payload
checksum, IPv6 fragments contained invalid checksum.  For fragments
the protocol checksum has to be calculated before fragmentation.
Hardware cannot do this as it is too late.  Do it earlier in software.
tested and OK mbuhl@

2 years agoFor putenv(3), return an error if string starts with a '=' character.
millert [Mon, 8 Aug 2022 22:40:03 +0000 (22:40 +0000)]
For putenv(3), return an error if string starts with a '=' character.
Both FreeBSD and NetBSD have this behavior.  OK deraadt@

2 years agoswitch fgetln remnants to getline. ok millert@
op [Mon, 8 Aug 2022 17:57:05 +0000 (17:57 +0000)]
switch fgetln remnants to getline.  ok millert@

2 years agofully switch quiz(6) to getline; diff from Ben Fuller (ben [at] bvnf
op [Mon, 8 Aug 2022 17:54:08 +0000 (17:54 +0000)]
fully switch quiz(6) to getline; diff from Ben Fuller (ben [at] bvnf
space), ok millert@

2 years agoConstify in6_addr pointer arguments in nd6_*() functions
kn [Mon, 8 Aug 2022 17:47:59 +0000 (17:47 +0000)]
Constify in6_addr pointer arguments in nd6_*() functions

All of them are passed to inspect/copy out fields, none of the functions
writes to the struct.

This makes it easier to argue about code (in MP context).

OK bluhm

2 years agoAdd YGJ, Yanago Kitaro, Tottori, Japan
jeremy [Mon, 8 Aug 2022 17:45:11 +0000 (17:45 +0000)]
Add YGJ, Yanago Kitaro, Tottori, Japan

Also known as Miho-Yanago.  Flew in and out of here in 2019.

2 years agotop(1): display uptime with seconds, print uptime in fixed format
cheloha [Mon, 8 Aug 2022 16:54:09 +0000 (16:54 +0000)]
top(1): display uptime with seconds, print uptime in fixed format

1. It's sometimes useful to know the system uptime with more precision
   than one minute.

So, this patch changes top(1) to print seconds of uptime in addition
to minutes, hours, and days.

2. It's *always* annoying when the information you want on a realtime
   display is not shown in the same place in a consistent format.

So, this patch also changes top(1) to always print the uptime like
this:

up D days HH:MM:SS

This is much easier to read at a glance.  In particular, it requires
no additional thought on my part to figure out whether the machine has
been up less than one day.

Maybe of note is that these changes make top(1)'s output different
from that of uptime(1).  I don't think this matters very much.  top(1)
is a realtime display, so it isn't likely to be parsed.  uptime(1) is
a different story.

Link: https://marc.info/?l=openbsd-tech&m=160046282400892&w=2
Positive feedback from kn@.

ok gnezdo@ bluhm@ millert@

2 years agosync
deraadt [Mon, 8 Aug 2022 16:52:23 +0000 (16:52 +0000)]
sync

2 years agoCall getuptime() just once per function
kn [Mon, 8 Aug 2022 15:56:35 +0000 (15:56 +0000)]
Call getuptime() just once per function

IPv6 pendant to bluhm's sys/netinet/if_ether.c r1.249:
    Instead of calling getuptime() all the time in ARP code, do it only
    once per function.  This gives a more consistent time value.
    OK claudio@ miod@ mvs@

OK bluhm

2 years agoremove unused arm and armv7 headers
jsg [Mon, 8 Aug 2022 15:28:59 +0000 (15:28 +0000)]
remove unused arm and armv7 headers
ok miod@

2 years agoUnify the maximum idle IO timeout for RSYNC & HTTPS
job [Mon, 8 Aug 2022 15:22:31 +0000 (15:22 +0000)]
Unify the maximum idle IO timeout for RSYNC & HTTPS

OK claudio@

2 years agoremove mouse.h last used by pre-wscons drivers
jsg [Mon, 8 Aug 2022 14:43:09 +0000 (14:43 +0000)]
remove mouse.h last used by pre-wscons drivers
ok miod@ millert@

2 years agoSet rsync connection timeout to 15 seconds.
job [Mon, 8 Aug 2022 14:10:10 +0000 (14:10 +0000)]
Set rsync connection timeout to 15 seconds.

OK sthen@

2 years agoTo make protocol input functions MP safe, internet PCB need protection.
bluhm [Mon, 8 Aug 2022 12:06:30 +0000 (12:06 +0000)]
To make protocol input functions MP safe, internet PCB need protection.
Use their reference counter in more places.
The in_pcb lookup functions hold the PCBs in hash tables protected
by table->inpt_mtx mutex.  Whenever a result is returned, increment
the ref count before releasing the mutex.  Then the inp can be used
as long as neccessary.  Unref it at the end of all functions that
call in_pcb lookup.
As a shortcut, pf may also hold a reference to the PCB.  When
pf_inp_lookup() returns it, it also incements the ref count and the
caller can handle it like the inp from table lookup.
OK sashan@

2 years agoChange branch condition inverted to realize original intention in
aoyama [Mon, 8 Aug 2022 11:27:18 +0000 (11:27 +0000)]
Change branch condition inverted to realize original intention in
comment.

Found by Tetsuya Isaki at NetBSD and nono project, during
investigating work-in-progress NetBSD/luna88k.
It originally comes from Mach luna88k port, more than 30 years ago:-)

Tested by me, "That's much better!" miod@

2 years agoBuild llvm-cov in base.
fcambus [Mon, 8 Aug 2022 09:25:13 +0000 (09:25 +0000)]
Build llvm-cov in base.

Since llvm-profdata is in base as well, we can now produce reports from
coverage data without having to install the devel/llvm port.

OK gnezdo@

2 years agoBefore ypconnect(2) addition, "getpw" was a horrible "hole" that triggered
deraadt [Mon, 8 Aug 2022 01:53:01 +0000 (01:53 +0000)]
Before ypconnect(2) addition, "getpw" was a horrible "hole" that triggered
on libc trying to open /var/run/ypbind.lock, so pledge had to BYPASSUNVEIL
accesses to this file.  We accepted the opening of that file for a small
period for build cross-over, but that waiting period ends now.

2 years agoStart to add annotations to the cpu_info members, doing I/a/o for
guenther [Sun, 7 Aug 2022 23:56:06 +0000 (23:56 +0000)]
Start to add annotations to the cpu_info members, doing I/a/o for
immutable/atomic/owned ala <sys/proc.h>.  Move CPUF_USERSEGS and
CPUF_USERXSTATE, which really are private to the CPU, into a new
ci_pflags and rename s/CPUF_/CPUPF_/.  Make all (remaining) ci_flags
alterations via atomic_{set,clear}bits_int(), so its annotation
isn't a lie.  Delete ci_info member as unused all the way from
rev 1.1

ok jsg@ mlarkin@

2 years agoUse PMAP_PREFER_ALIGN() == 0 rather than !defined(PMAP_PREFER) to enable the
miod [Sun, 7 Aug 2022 19:40:48 +0000 (19:40 +0000)]
Use PMAP_PREFER_ALIGN() == 0 rather than !defined(PMAP_PREFER) to enable the
fast path in the pager code; this benefits most mips64 platforms.

ok kettenis@ mpi@

2 years agoMove fallback PMAP_PREFER definitions from uvm_map.c to uvm_pmap.h for them
miod [Sun, 7 Aug 2022 19:39:25 +0000 (19:39 +0000)]
Move fallback PMAP_PREFER definitions from uvm_map.c to uvm_pmap.h for them
to be available to other files. NFC

ok kettenis@ mpi@