openbsd
19 months agobn_test: rand_neg() is not only one of the most stupidly named functions
tb [Fri, 7 Apr 2023 22:22:10 +0000 (22:22 +0000)]
bn_test: rand_neg() is not only one of the most stupidly named functions
in the entire code base it also has a few parentheses too many

19 months agobn_test: handle rc consistently
tb [Fri, 7 Apr 2023 22:18:42 +0000 (22:18 +0000)]
bn_test: handle rc consistently

Various test functions had bugs due to the fact that the return code
would be set to 1 at the top so that each error would have to set rc = 0.
This is silly. Fail closed instead by setting rc = 0 at the top and only
flipping to 1 before the err label

19 months agobn_test: inline the only use of lst[]
tb [Fri, 7 Apr 2023 22:14:20 +0000 (22:14 +0000)]
bn_test: inline the only use of lst[]

lst[] can be converted from a bit string to a hex string. Use BN_hex2bn()
isntead of BN_bin2bn(). Handle this inside test_lshift() rather than doing
artistic ownership dances.

19 months agoRemove kernel locks from the ARP input path. Caller if_netisr()
bluhm [Fri, 7 Apr 2023 22:02:58 +0000 (22:02 +0000)]
Remove kernel locks from the ARP input path.  Caller if_netisr()
grabs the exclusive netlock and that is sufficent for in_arpinput()
and arpcache().
with kn@; OK mvs@; tested by Hrvoje Popovski

19 months agoImprove some test failure reporting
tb [Fri, 7 Apr 2023 17:09:54 +0000 (17:09 +0000)]
Improve some test failure reporting

19 months agoOops. Missed files in last commit.
krw [Fri, 7 Apr 2023 16:34:41 +0000 (16:34 +0000)]
Oops. Missed files in last commit.

19 months agoIgnore ten getter and setter control macros related to proxy BIOs.
schwarze [Fri, 7 Apr 2023 15:43:18 +0000 (15:43 +0000)]
Ignore ten getter and setter control macros related to proxy BIOs.
Those are not useful because such a BIO type neither exists
in LibreSSL nor in OpenSSL 1.1.1.
Not adding the deprecation notice to some manual page
because there is no manual page that is even vaguely related.

19 months agoTwo minor tweaks that are useful for processing bio.h, among other headers:
schwarze [Fri, 7 Apr 2023 15:39:18 +0000 (15:39 +0000)]
Two minor tweaks that are useful for processing bio.h, among other headers:
* ignore lines defining "__bounded__()"
* ignore whitespace between "#" and "include"

19 months agoMark BIO_CB_return(), BIO_cb_pre(), and BIO_cb_post() as intentionally
schwarze [Fri, 7 Apr 2023 14:47:37 +0000 (14:47 +0000)]
Mark BIO_CB_return(), BIO_cb_pre(), and BIO_cb_post() as intentionally
undocumented because they are unused according to codesearch.debian.net
and would cause nothing but obfuscation if they were used.

19 months agoAdd helper functions find_mbr_desc() and find_gpt_desc() to allow
krw [Fri, 7 Apr 2023 14:42:51 +0000 (14:42 +0000)]
Add helper functions find_mbr_desc() and find_gpt_desc() to allow
checking mbr_type[N].mt_desc and gpt_type[N].gt_desc before using
name on menu when printing out partition tables.

Tweak logic in find_mbr_type() and find_gpt_type() to be a bit
more paranoid.

Tweak function/variable names to be more in line to usage.

No functional change as all mt_desc and gt_desc are currently
NULL.

19 months agoPass a pt_entry pointer to rib_get() and rib_add().
claudio [Fri, 7 Apr 2023 13:49:03 +0000 (13:49 +0000)]
Pass a pt_entry pointer to rib_get() and rib_add().
Add rib_get_addr() to behave like rib_get() did before.
OK tb@

19 months agoDefault 'Is the disk partition alrady mounted?' to 'no' on install
kn [Fri, 7 Apr 2023 13:48:42 +0000 (13:48 +0000)]
Default 'Is the disk partition alrady mounted?' to 'no' on install

For installation, no partitions whatsoever are mounted, so 'yes' is always
wrong unless the user manually mounted stuff before that question.

No change for upgrade, where partitions on the root disk are mounted.

Idea from naddy, diff from Mikhail (mp39590 AT gmail)
Tweaks from me
OK op afresh1

19 months agoFix whitespace on two lines
tb [Fri, 7 Apr 2023 09:43:38 +0000 (09:43 +0000)]
Fix whitespace on two lines

19 months agoNail the root disk default in the guided disk encryption case
kn [Fri, 7 Apr 2023 09:40:18 +0000 (09:40 +0000)]
Nail the root disk default in the guided disk encryption case

Save the softraid volume's device and make it root disk default, being the
only legit choice in this case;  this gets it always right on systems with
multiple physical disks.

All other install/upgrade cases keep picking the first available [sw]d* disk
as root disk default.

OK afresh1

19 months agoregister a mapping of dwqe interfaces to ofw nodes/phandles.
dlg [Fri, 7 Apr 2023 09:33:51 +0000 (09:33 +0000)]
register a mapping of dwqe interfaces to ofw nodes/phandles.

i forgot to commit this as part of src/sys/dev/fdt/if_dwqe_fdt.c r1.7

found by mglocker@

19 months agoavoid use of uninitialised memory
jsg [Fri, 7 Apr 2023 09:31:59 +0000 (09:31 +0000)]
avoid use of uninitialised memory
ok miod@ kettenis@

19 months agoDetermine PHY mode and pass the appropriate flags down to the PHY when we
kettenis [Fri, 7 Apr 2023 08:53:03 +0000 (08:53 +0000)]
Determine PHY mode and pass the appropriate flags down to the PHY when we
attach it.

ok dlg@

19 months agoregister a mapping of dwqe interfaces to ofw nodes/phandles.
dlg [Fri, 7 Apr 2023 06:33:49 +0000 (06:33 +0000)]
register a mapping of dwqe interfaces to ofw nodes/phandles.

ok kettenis@

19 months agofixed regulators could have a "gpios" or "gpio" property.
dlg [Fri, 7 Apr 2023 06:18:26 +0000 (06:18 +0000)]
fixed regulators could have a "gpios" or "gpio" property.

we only handled "gpio" before. figuring this out has wasted many
days of my life recently.

ok patrick@ kettenis@

19 months agodrm/amdkfd: Get prange->offset after svm_range_vram_node_new
jsg [Fri, 7 Apr 2023 04:11:42 +0000 (04:11 +0000)]
drm/amdkfd: Get prange->offset after svm_range_vram_node_new

From Xiaogang Chen
d0386bd84e6d81990ef22e10657d5a5d9c209763 in linux-6.1.y/6.1.23
8eeddc0d4200762063e1c66b9cc63afa7b24ebf0 in mainline linux

19 months agodrm/i915: Move CSC load back into .color_commit_arm() when PSR is enabled on skl/glk
jsg [Fri, 7 Apr 2023 04:09:51 +0000 (04:09 +0000)]
drm/i915: Move CSC load back into .color_commit_arm() when PSR is enabled on skl/glk

From Ville Syrjala
fcf712b4e5d0aacbc193e71962bdaa4d4afe3335 in linux-6.1.y/6.1.23
a8e03e00b62073b494886dbff32f8b5338066c8b in mainline linux

19 months agodrm/i915: Disable DC states for all commits
jsg [Fri, 7 Apr 2023 04:07:59 +0000 (04:07 +0000)]
drm/i915: Disable DC states for all commits

From Ville Syrjala
0fc6fea41c7122aa5f2088117f50144b507e13d7 in linux-6.1.y/6.1.23
a2b6e99d8a623544f3bdccd28ee35b9c1b00daa5 in mainline linux

19 months agodrm/i915/dpt: Treat the DPT BO as a framebuffer
jsg [Fri, 7 Apr 2023 04:06:11 +0000 (04:06 +0000)]
drm/i915/dpt: Treat the DPT BO as a framebuffer

From Ville Syrjala
c781c107731fc09ce4330c8c636b8446d0f72aa4 in linux-6.1.y/6.1.23
3413881e1ecc3cba722a2e87ec099692eed5be28 in mainline linux

19 months agodrm/i915/gem: Flush lmem contents after construction
jsg [Fri, 7 Apr 2023 04:03:48 +0000 (04:03 +0000)]
drm/i915/gem: Flush lmem contents after construction

From Chris Wilson
21ee19974b19edcda7a8e4f9bd5b02c3a750a69e in linux-6.1.y/6.1.23
d032ca43f2c80049ce5aabd3f208dc3849359497 in mainline linux

19 months agodrm/amd/display: Take FEC Overhead into Timeslot Calculation
jsg [Fri, 7 Apr 2023 04:02:25 +0000 (04:02 +0000)]
drm/amd/display: Take FEC Overhead into Timeslot Calculation

From Fangzhi Zuo
fd71f4c9e3fa7454f9797c539abd5fcfc8b92b41 in linux-6.1.y/6.1.23
68dc1846c3a44d5e633be145c169ce2fd5420695 in mainline linux

19 months agodrm/amd/display: Add DSC Support for Synaptics Cascaded MST Hub
jsg [Fri, 7 Apr 2023 04:00:35 +0000 (04:00 +0000)]
drm/amd/display: Add DSC Support for Synaptics Cascaded MST Hub

From Fangzhi Zuo
41abe8828c83e8f73940790a3861b498a8b5ee3f in linux-6.1.y/6.1.23
f4f3b7dedbe849e780c779ba67365bb1db0d8637 in mainline linux

19 months agodrm/amdgpu: allow more APUs to do mode2 reset when go to S4
jsg [Fri, 7 Apr 2023 03:58:43 +0000 (03:58 +0000)]
drm/amdgpu: allow more APUs to do mode2 reset when go to S4

From Tim Huang
febacc33298f8d72d5bfd4d23a556cc21b5cd6c2 in linux-6.1.y/6.1.23
2fec9dc8e0acc3dfb56d1389151bcf405f087b10 in mainline linux

19 months agodrm/i915/tc: Fix the ICL PHY ownership check in TC-cold state
jsg [Fri, 7 Apr 2023 03:57:13 +0000 (03:57 +0000)]
drm/i915/tc: Fix the ICL PHY ownership check in TC-cold state

From Imre Deak
75084659969f5cd0287a86e7faae3ef0a5651d1e in linux-6.1.y/6.1.23
38c583019484f190d5b33f59b8ae810e6b1763c6 in mainline linux

19 months agodrm/amdkfd: Fixed kfd_process cleanup on module exit.
jsg [Fri, 7 Apr 2023 03:55:33 +0000 (03:55 +0000)]
drm/amdkfd: Fixed kfd_process cleanup on module exit.

From David Belanger
b969838c9554a0e9aab3c3cadfcd23d246bc2abe in linux-6.1.y/6.1.23
20bc9f76b6a2455c6b54b91ae7634f147f64987f in mainline linux

19 months agodrm/amdkfd: fix potential kgd_mem UAFs
jsg [Fri, 7 Apr 2023 03:53:55 +0000 (03:53 +0000)]
drm/amdkfd: fix potential kgd_mem UAFs

From Chia-I Wu
5045360f3bb62ccd4f87202e33489f71f8bbc3fc in linux-6.1.y/6.1.23
9da050b0d9e04439d225a2ec3044af70cdfb3933 in mainline linux

19 months agodrm/amdkfd: fix a potential double free in pqm_create_queue
jsg [Fri, 7 Apr 2023 03:52:40 +0000 (03:52 +0000)]
drm/amdkfd: fix a potential double free in pqm_create_queue

From Chia-I Wu
b861f0e62ae148eb5f0a48c4d6fcd5dc03b4e252 in linux-6.1.y/6.1.23
b2ca5c5d416b4e72d1e9d0293fc720e2d525fd42 in mainline linux

19 months agodrm/amdkfd: Fix BO offset for multi-VMA page migration
jsg [Fri, 7 Apr 2023 03:50:10 +0000 (03:50 +0000)]
drm/amdkfd: Fix BO offset for multi-VMA page migration

From Xiaogang Chen
b61b21bcbb8a379269de7d2e3e9ceb42e5368ec4 in linux-6.1.y/6.1.23
b4ee9606378bb9520c94d8b96f0305c3696f5c29 in mainline linux

19 months agoadd MLN
deraadt [Fri, 7 Apr 2023 01:18:01 +0000 (01:18 +0000)]
add MLN

19 months agoAdd two more RK3568 clocks.
kettenis [Thu, 6 Apr 2023 21:17:01 +0000 (21:17 +0000)]
Add two more RK3568 clocks.

ok dlg@

19 months agoFix two documentation bugs:
schwarze [Thu, 6 Apr 2023 20:52:18 +0000 (20:52 +0000)]
Fix two documentation bugs:
1. The function event_base_free(3) does reset the global variable
to the initial state when needed.
2. The CAVEATS section got the issue backwards: multiple threads
per base cause trouble, whereas multiples bases per thread do not.

While here, also avoid the plural when talking about the global
variable used by event_init(3): there is only one.

Using input from jmc@ and from Ted Bullock.

19 months agoDocument the effects that BIO_set_info_callback(3), BIO_callback_ctrl(3),
schwarze [Thu, 6 Apr 2023 19:23:12 +0000 (19:23 +0000)]
Document the effects that BIO_set_info_callback(3), BIO_callback_ctrl(3),
BIO_get_info_callback(3), and BIO_info_cb(3) have on connect BIOs.

19 months agoProperly document BIO_set_info_callback(3) and BIO_get_info_callback(3)
schwarze [Thu, 6 Apr 2023 19:06:51 +0000 (19:06 +0000)]
Properly document BIO_set_info_callback(3) and BIO_get_info_callback(3)
which where mentioned below SYNOPSIS and HISTORY but not described.
Also document the command constant BIO_CTRL_SET_CALLBACK
and the deprecated function type name bio_info_cb(3).
Mention that callbacks installed using BIO_set_callback_ex(3)
and BIO_set_callback(3) can tamper with *all* the return values.

19 months agoThe simplebus_attach() function already prints a newline, so drop it here.
kettenis [Thu, 6 Apr 2023 19:02:29 +0000 (19:02 +0000)]
The simplebus_attach() function already prints a newline, so drop it here.

19 months agoUse RCS tag instead of an incorrect path.
tb [Thu, 6 Apr 2023 18:43:47 +0000 (18:43 +0000)]
Use RCS tag instead of an incorrect path.

19 months agoMove a comment to the proper place
tb [Thu, 6 Apr 2023 12:01:45 +0000 (12:01 +0000)]
Move a comment to the proper place

19 months agoMarkup route flags to get tags
kn [Thu, 6 Apr 2023 11:29:55 +0000 (11:29 +0000)]
Markup route flags to get tags

":tM" to jump to the definition of RTF_MODIFIED is easier and faster than
manually navigating there.

OK schwarze

19 months agowycheproof: fix copy-paste error in previous
tb [Thu, 6 Apr 2023 08:41:53 +0000 (08:41 +0000)]
wycheproof: fix copy-paste error in previous

19 months agowycheproof: use EVP_MD instead of importing "hash"
tb [Thu, 6 Apr 2023 08:38:53 +0000 (08:38 +0000)]
wycheproof: use EVP_MD instead of importing "hash"

19 months agoCheck and assign on one line
tb [Thu, 6 Apr 2023 07:08:41 +0000 (07:08 +0000)]
Check and assign on one line

19 months agoZap extra empty line
tb [Thu, 6 Apr 2023 07:07:54 +0000 (07:07 +0000)]
Zap extra empty line

19 months agosimplify sshsig_find_principals() similar to what happened to
djm [Thu, 6 Apr 2023 03:56:02 +0000 (03:56 +0000)]
simplify sshsig_find_principals() similar to what happened to
sshsig_check_allowed_keys() in r1.31, removing some dead code

19 months agoremove redundant ssh!=NULL check; we'd already dereferenced it
djm [Thu, 6 Apr 2023 03:21:31 +0000 (03:21 +0000)]
remove redundant ssh!=NULL check; we'd already dereferenced it

19 months agomatch_user() shouldn't be called with user==NULL unless
djm [Thu, 6 Apr 2023 03:19:32 +0000 (03:19 +0000)]
match_user() shouldn't be called with user==NULL unless
host and ipaddr are also NULL

19 months agodon't care about glob() return value here.
djm [Thu, 6 Apr 2023 03:12:32 +0000 (03:12 +0000)]
don't care about glob() return value here.

19 months agobetter handle "phy-mode" properties, in particular around clk delays.
dlg [Thu, 6 Apr 2023 00:09:39 +0000 (00:09 +0000)]
better handle "phy-mode" properties, in particular around clk delays.

the phy mode can encode whether rk3568 mac should be doing the
delays when talking to the phy, or whether it should ignore them
and let the phy handle them. turns out this will probably be needed
by kettenis to get working ethernet on another rk3568 based system.

tweaks and ok kettenis@

19 months agoPush kernel lock into nd6_resolve()
kn [Wed, 5 Apr 2023 23:01:03 +0000 (23:01 +0000)]
Push kernel lock into nd6_resolve()

Tested as part of bigger unlock diffs, commit now as tiny first step.

OK bluhm

19 months agoARP has a sysctl to show the number of packets waiting for an arp
bluhm [Wed, 5 Apr 2023 21:51:47 +0000 (21:51 +0000)]
ARP has a sysctl to show the number of packets waiting for an arp
response.  Implement analog sysctl net.inet6.icmp6.nd6_queued for
ND6 to reduce places where mbufs can hide within the kernel.
Atomic operations operate on unsigned int.  Make the type of total
hold queue length consistent.
Use atomic load to read the value for the sysctl.  This clarifies
why no lock around sysctl_rdint() is needed.
OK mvs@ kn@

19 months agoARP has a queue of packets that should be sent after name resolution.
bluhm [Wed, 5 Apr 2023 19:35:23 +0000 (19:35 +0000)]
ARP has a queue of packets that should be sent after name resolution.
ND6 did only hold a single packet.  Unify the logic and add a mbuf
hold queue to struct llinfo_nd6.  This is MP safe and queue limits
are tracked with atomic operations.  New function if_mqoutput() has
common code for ARP and ND6.  ln_saddr6 holds the source address
of the requesting packet.  That is easier than fiddling with mbuf
queue in nd6_ns_output().
OK kn@

19 months agoImport the first of the new libevent manual pages
schwarze [Wed, 5 Apr 2023 18:34:37 +0000 (18:34 +0000)]
Import the first of the new libevent manual pages
written by Ted Bullock <tbullock at comlore dot com>
in order to polish it in the tree.
Not yet linked to the build.

In particular, this documents the so far undocumented functions
event_base_new(3) and event_reinit(3) and provides lots of new
information regarding event_init(3) and event_base_free(3).

Also using input from nicm@, jmc@, and myself, OK nicm@ jmc@.

19 months agoEnable Force Unit Access (FUA) for write commands. This seems to fix
mglocker [Wed, 5 Apr 2023 17:23:30 +0000 (17:23 +0000)]
Enable Force Unit Access (FUA) for write commands.  This seems to fix
intermittent data corruptions which I faced.  The documentation says about
FUA for write commands:

"The Device Server shall write the logical blocks to the medium, and shall
not complete the command with GOOD status until all the logical blocks have
been written on the medium without error."

19 months agoAdd (inside #if 0 blocks) #define's and gpt_types[] entries for
krw [Wed, 5 Apr 2023 14:07:08 +0000 (14:07 +0000)]
Add (inside #if 0 blocks) #define's and gpt_types[] entries for
all the GPT partition types known to mankind. a.k.a. Wikipedia,
Linux, and various BSD's.

Makes it easier to discuss/add/remove/check GUID's known to
fdisk(8).

No functional change.

19 months agoIf ndp -d did not find a neigbor entry, it removed the cloning route
bluhm [Wed, 5 Apr 2023 13:56:41 +0000 (13:56 +0000)]
If ndp -d did not find a neigbor entry, it removed the cloning route
instead.  Comparing the arp(8) and ndp(8) code shows that the latter
has a fallthrough to delete.  Return an error also in this case.
OK kn@

19 months agoCall getuptime(9) once for consistency; OK bluhm
kn [Wed, 5 Apr 2023 13:56:31 +0000 (13:56 +0000)]
Call getuptime(9) once for consistency;  OK bluhm

19 months agoAdd a few missing braces
tb [Wed, 5 Apr 2023 11:31:38 +0000 (11:31 +0000)]
Add a few missing braces

ok jsing

19 months agoSet up the RSA's _method_mod_n before the initial blinding
tb [Wed, 5 Apr 2023 11:30:12 +0000 (11:30 +0000)]
Set up the RSA's _method_mod_n before the initial blinding

As observed by Bernd Edlinger, the main part of the RSA timing leak that was
recently made public is that the initial blinding isn't done with Montgomery
exponentiation but rather with plain exponentiation.

Pull up the initialization of the cached Montgomery context to ensure we use
Montgomery exponentiation. Do this for private_{de,en}crypt(). Interestingly,
the latter was fixed in OpenSSL a while ago by Andy Polyakov as part of the
"smooth CRT-RSA" addition.

If this code was anything but completely insane this would never have been
an issue in the first place. But it's libcrypto...

ok jsing

19 months agoSprinkle a few BTI instructions into the arm64 assembly files and pass
kettenis [Wed, 5 Apr 2023 11:07:40 +0000 (11:07 +0000)]
Sprinkle a few BTI instructions into the arm64 assembly files and pass
-mmark-bti-property to indicate those now have BTI support.

ok jsing@, deraadt@

19 months agobn_mod_sqrt: Improve a handful of comments and a printf
tb [Wed, 5 Apr 2023 11:03:11 +0000 (11:03 +0000)]
bn_mod_sqrt: Improve a handful of comments and a printf

19 months agoCall dwpcie_link_config() when initializing the RK3568 PCIe controllers.
kettenis [Wed, 5 Apr 2023 10:48:12 +0000 (10:48 +0000)]
Call dwpcie_link_config() when initializing the RK3568 PCIe controllers.
This makes sure the PCIe link runs at the maximum possible speed.

Prompted by a diff from dlg@, who also tested this alternative diff.

ok dlg@

19 months agoImprove regress coverage for BN_mod_sqrt()
tb [Wed, 5 Apr 2023 10:47:00 +0000 (10:47 +0000)]
Improve regress coverage for BN_mod_sqrt()

This now covers all the main branches of both the old and new
BN_mod_sqrt() implementation except for negative p.

19 months agoImplement software control for the internal delays of the RTL8211F PHY.
kettenis [Wed, 5 Apr 2023 10:45:07 +0000 (10:45 +0000)]
Implement software control for the internal delays of the RTL8211F PHY.
Since we need to retain the hardware/firmware configuration of the delays
in most existing hardware that uses rgephy(4) (such as PCIe NICs), add a
bew MIIF_SETDELAY flag that controls the software configuration of the
delays.

ok dlg@, jsg@

19 months agoCall getuptime(9) once for consistency, sync with ARP
kn [Wed, 5 Apr 2023 10:40:37 +0000 (10:40 +0000)]
Call getuptime(9) once for consistency, sync with ARP

Feedback OK bluhm

19 months agosync
jsg [Wed, 5 Apr 2023 10:34:36 +0000 (10:34 +0000)]
sync

19 months agobsd.port.mk: Fix documentation on PATCHORIG.
edd [Wed, 5 Apr 2023 09:46:27 +0000 (09:46 +0000)]
bsd.port.mk: Fix documentation on PATCHORIG.

The default recently changed to `.orig.port`.

OK sthen@, tb@, op@, thanks!

19 months agoSimplify mod_sqrt_test() a bit
tb [Wed, 5 Apr 2023 08:43:31 +0000 (08:43 +0000)]
Simplify mod_sqrt_test() a bit

19 months agoRefactor port definitions to also support service names like bgp.
claudio [Wed, 5 Apr 2023 08:37:21 +0000 (08:37 +0000)]
Refactor port definitions to also support service names like bgp.
OK tb@

19 months agoRename family with af to follow pfctl/parse.y a bit more.
claudio [Wed, 5 Apr 2023 08:04:28 +0000 (08:04 +0000)]
Rename family with af to follow pfctl/parse.y a bit more.
OK tb@

19 months agobn_mod_sqrt test: Use a #define rather than hard coded 100
tb [Wed, 5 Apr 2023 07:52:25 +0000 (07:52 +0000)]
bn_mod_sqrt test: Use a #define rather than hard coded 100

19 months agoAdd coverage for the truly non-deterministic path of Tonelli-Shanks
tb [Wed, 5 Apr 2023 07:17:44 +0000 (07:17 +0000)]
Add coverage for the truly non-deterministic path of Tonelli-Shanks

Regress coverage of all of BN_mod_sqrt() is still lacking after this.
This will improve in forthcoming commits.

19 months agoIntroduce variation in location of junked bytes; ok tb@
otto [Wed, 5 Apr 2023 06:25:38 +0000 (06:25 +0000)]
Introduce variation in location of junked bytes; ok tb@

19 months agoclockintr: add clockintr_cancel()
cheloha [Wed, 5 Apr 2023 00:23:06 +0000 (00:23 +0000)]
clockintr: add clockintr_cancel()

As the name suggests, clockintr_cancel() cancels any pending
expiration of the given clockintr.

I think we will need this in the near future.

19 months agoclockintr: add clockintr_cancel_locked()
cheloha [Tue, 4 Apr 2023 21:49:10 +0000 (21:49 +0000)]
clockintr: add clockintr_cancel_locked()

Move the CLST_PENDING check and TAILQ_REMOVE() in
clockintr_schedule_locked() into a dedicated function,
clockintr_cancel_locked().  clockintr_schedule_locked() no longer
implicitly cancels a pending clockintr: it is the caller's
responsibility to check for CLST_PENDING and cancel any pending
expiration before calling clockintr_schedule_locked().  We can skip
the CLST_PENDING check during the dispatch loop because we know for
certain the clockintr in question is pending.

This is more verbose but I think it is less surprising.  Both
functions do one thing.

19 months agoAdopt a more compact idiom when initializing gpt_types[]. Group
krw [Tue, 4 Apr 2023 21:43:06 +0000 (21:43 +0000)]
Adopt a more compact idiom when initializing gpt_types[]. Group
entries with attributes together.

No intentional functional change.

19 months agoRemove stylistic differences between arp(8) and ndp(8) delete()
bluhm [Tue, 4 Apr 2023 21:18:04 +0000 (21:18 +0000)]
Remove stylistic differences between arp(8) and ndp(8) delete()
function.  This makes it easier to spot real changes in behavior.
OK kn@

19 months agoA refactoring back in 2016 in which magic numbers where extracted into
anton [Tue, 4 Apr 2023 18:14:32 +0000 (18:14 +0000)]
A refactoring back in 2016 in which magic numbers where extracted into
named constants accidentally dropped an instruction causing detection of
eXtended operations (XOP) on AMD hardware to break.

ok miod@ tb@

19 months agoIn preparation for better documenting BIO info callbacks, improve the
schwarze [Tue, 4 Apr 2023 17:10:37 +0000 (17:10 +0000)]
In preparation for better documenting BIO info callbacks, improve the
description of BIO_ctrl(3) and its three siblings.  Given the vast range
of effects these functions can have, the text is unavoidably still
vague, but at least some information can be provided.

While here, fix one wrong parameter type and three inconsistent
parameter names in the SYNOPSIS.

19 months agoCleanup parse.y a bit. Move global defines a bit down. Move mrtdump and
claudio [Tue, 4 Apr 2023 16:01:54 +0000 (16:01 +0000)]
Cleanup parse.y a bit. Move global defines a bit down. Move mrtdump and
network rules up into the grammar and switch the order of restricted
to be more like the rest.
OK tb@

19 months agoClean bn_mod_sqrt up a little
tb [Tue, 4 Apr 2023 15:32:02 +0000 (15:32 +0000)]
Clean bn_mod_sqrt up a little

This makes it look a bit more like other tests and also prepares the
addition of further test cases and different tests.

19 months agoWhen sending IP packets to userland with divert-packet rules, the
bluhm [Tue, 4 Apr 2023 10:12:03 +0000 (10:12 +0000)]
When sending IP packets to userland with divert-packet rules, the
checksum may be wrong.  Locally generated packets diverted by pf
out rules may have no checksum due to to hardware offloading.
Calculate the checksum in that case.
OK mvs@ sashan@

19 months agoEnable guided disk encryption support on arm64
kn [Tue, 4 Apr 2023 08:39:40 +0000 (08:39 +0000)]
Enable guided disk encryption support on arm64

All board specific quirks inside the installer (and other bugs) relating to
root on softraid are fixed, so that install media with the new question
just works for plain as well as encrypted installs.

Tested on Pinebook Pro, Raspberry Pi 4b, SolidRun CEX7.

19 months agoMake root on softraid installations boot out of the box on Raspberry Pis
kn [Tue, 4 Apr 2023 08:31:35 +0000 (08:31 +0000)]
Make root on softraid installations boot out of the box on Raspberry Pis

Various files are put onto a pi's ESP, assuming root disk means boot disk,
which is not true for root on softraid(4).

Wrap the code in a loop over chunks (if any) or the single disk as before,
just like installboot(8) does.

OK mbuhl

19 months agoSynopsis Designware -> Synopsys DesignWare
jsg [Tue, 4 Apr 2023 00:38:37 +0000 (00:38 +0000)]
Synopsis Designware -> Synopsys DesignWare

19 months agoCompress euclid() a little
tb [Mon, 3 Apr 2023 21:43:43 +0000 (21:43 +0000)]
Compress euclid() a little

This function is spread out over way too many lines and has too much
repetition. Once this is made a little more compact, it becomes clearer
that this is a somewhat obfuscated version of binary gcd (it is not
constant time therefore cryptographically unsound. It is not used
internally). This will likely go away later.

ok jsing

19 months agoLink bn_gcd test to regress
tb [Mon, 3 Apr 2023 21:33:16 +0000 (21:33 +0000)]
Link bn_gcd test to regress

19 months agoAdd regress coverage for BN_gcd() and BN_gcd_ct()
tb [Mon, 3 Apr 2023 21:32:44 +0000 (21:32 +0000)]
Add regress coverage for BN_gcd() and BN_gcd_ct()

19 months agoFix stupid bug in previous.
miod [Mon, 3 Apr 2023 18:59:47 +0000 (18:59 +0000)]
Fix stupid bug in previous.

19 months agoclockintr: clockintr_cpu_init(): isolate struct clockintr_queue setup
cheloha [Mon, 3 Apr 2023 17:40:51 +0000 (17:40 +0000)]
clockintr: clockintr_cpu_init(): isolate struct clockintr_queue setup

We will always need to initialize the clockintr_queue struct.
However, the hardclock, schedclock, and statclock will not always be a
part of that struct.  Move the clockintr_establish() calls in
clockintr_cpu_init() away from the other initialization steps to make
the dependency relationship more obvious.  We need to intialize a
struct clockintr_queue before we can establish clock interrupts.

19 months agoacpibtn_notify: ignore duplicate ACPI lid transitions
millert [Mon, 3 Apr 2023 13:38:18 +0000 (13:38 +0000)]
acpibtn_notify: ignore duplicate ACPI lid transitions
A Dell Precision 5510 produces two _LID events when the lid is closed.
This results in acpibtn_notify() adding two sleep tasks.  The laptop
suspends and resumes successfully, but on resume the second sleep
task runs and it goes right back to sleep.  Making the lid transition
a no-op when the existing value matches new _LID value works around
the problem.  OK miod@ jcs@

19 months agoReduce indent in single_thread_check_locked() by inverting initial
claudio [Mon, 3 Apr 2023 11:57:50 +0000 (11:57 +0000)]
Reduce indent in single_thread_check_locked() by inverting initial
if () check which just returns.
OK mpi@

19 months agoStop writing pine64 firmware to disk
kn [Mon, 3 Apr 2023 10:51:50 +0000 (10:51 +0000)]
Stop writing pine64 firmware to disk

pine64 happens to be the first board "we ran on", as kettenis explains, and
this code tries to handle the situation of installing to the same disk the
installer booted from.

Similar boards like the Pinebook Pro don't get special treatment and work;
INSTALL.arm64 already explains how to flash required firmware onto disks or
install media -- Allwinner SoCs like the pine64 included.

Spotted through md_installboot() dd'ing blobs onto the root disk,
which does not fly with root on softraid and is in the way of arm64 getting
support for guided disk encryption.

Suggested by kettenis patrick
Feedback jsg patrick
OK patrick

19 months agoAdd first step of flowspec support. This adds the bits to establish a
claudio [Mon, 3 Apr 2023 10:48:00 +0000 (10:48 +0000)]
Add first step of flowspec support. This adds the bits to establish a
connection with SAFI 133. Right now any sent UPDATE with SAFI 133 is
simply ignored. At the moment SAFI 134 (flowspec for L3VPN) is unsupported.
OK tb@

19 months agoMove null check up and simplify process_escapes. Based on Coverity CID
dtucker [Mon, 3 Apr 2023 08:10:54 +0000 (08:10 +0000)]
Move null check up and simplify process_escapes.  Based on Coverity CID
291863 which points out we check the channel pointer for NULLness after
dereferencing it.  Move this to the start of the function, and while
there simplify initialization of efc a bit.  ok djm@

19 months agoClarify text for new -A slightly, GitHub issue 3508.
nicm [Mon, 3 Apr 2023 07:39:37 +0000 (07:39 +0000)]
Clarify text for new -A slightly, GitHub issue 3508.

19 months agoenable rkusbphy(4)
dlg [Mon, 3 Apr 2023 05:58:56 +0000 (05:58 +0000)]
enable rkusbphy(4)

19 months agotry using a standard phy drivers registered with ofw/fdt first.
dlg [Mon, 3 Apr 2023 01:57:41 +0000 (01:57 +0000)]
try using a standard phy drivers registered with ofw/fdt first.

this allows ehci to enable rkusbphy(4), which in means the port and
port gets turned onto the port.

tested on a radxa e25 and nanopi r5s without any usb or usb phy
support in the boot loader.

ok kettenis@

19 months agoadd support for enabling both the usb2 and usb3 phys.
dlg [Mon, 3 Apr 2023 01:55:00 +0000 (01:55 +0000)]
add support for enabling both the usb2 and usb3 phys.

the code tried enabling the 0th phy in the usb-phy proplist, which
is the usb2 phy, and if that didn't exist it would try usb3-phy in
the standard phys/phy-names properties. it now tries to enable the
usb2 and usb3 phys independently.

further, support using standard phy drivers registered with the
ofw/fdt code, not just the ones handled inside the xhci driver.

ok kettenis@