openbsd
18 months agoclockintr, ddb(4): label non-pending clock interrupts "idle"
cheloha [Sat, 22 Apr 2023 23:51:27 +0000 (23:51 +0000)]
clockintr, ddb(4): label non-pending clock interrupts "idle"

"idle" is more obvious than "est" and requires no knowledge of the
implementation.

18 months agoCall pfkeyv2_sysctl_policydumper() with shared netlock. It performs
mvs [Sat, 22 Apr 2023 20:51:56 +0000 (20:51 +0000)]
Call pfkeyv2_sysctl_policydumper() with shared netlock. It performs
read-olny access to netlock protected data, so the radix tree will
not be modified during spd_table_walk() run.

Also change netlock assertion within spd_table_add() and
ipsec_delete_policy() to exclusive. These are correlating functions
which modifies radix tree, so make us sure spd_table_walk() run with
shared netlock is safe.

Feedback and ok by bluhm@

18 months agoDocument the change in default to comma plus space but leave out the
tb [Sat, 22 Apr 2023 20:51:26 +0000 (20:51 +0000)]
Document the change in default to comma plus space but leave out the
compat nonsense

18 months agoFix UTF-8 issuer printing
tb [Sat, 22 Apr 2023 20:50:26 +0000 (20:50 +0000)]
Fix UTF-8 issuer printing

If no field separator is specified, default to using the comma plus space
separation, unless the compat flag is set.

Fixes an a bug with printing issuers and other things that contain UTF-8

Reported by Jean-Luc Duprat
The very simple fix ix is a joint effort by Henson and Levitte
Fixes libressl/portable issue #845

ok jsing

18 months agovmd(8): fix vm send/receive due to invalid hva's.
dv [Sat, 22 Apr 2023 19:47:35 +0000 (19:47 +0000)]
vmd(8): fix vm send/receive due to invalid hva's.

Moving some of the virtio devices to zero-copy approaches required
tracking the host-side virtual address for the gpa of virtqueues.
Upon a send/receive they are invalid as the restoring system will
most likely use a different address space layout.

Recompute the hva's on receive and NULL them on send.

ok mlarkin@

18 months agoRename the XCR0_* #defines to XFEATURE_* and add the new supervisor-state
guenther [Sat, 22 Apr 2023 18:27:28 +0000 (18:27 +0000)]
Rename the XCR0_* #defines to XFEATURE_* and add the new supervisor-state
features: while all are appropriate for xsaves/xrstors, the
supervisor-state features aren't for xcr0 but rather for the new XSS_MSR,
making the current names kinda confusing.

Add #defines for masking bits for xcr0 vs XSS.

Add and report the new XSAVE_XFD xsave subfeature bit.

ok mlarkin@

18 months agoTeach the disassembler about xrstors, xsavec, and xsaves
guenther [Sat, 22 Apr 2023 18:26:17 +0000 (18:26 +0000)]
Teach the disassembler about xrstors, xsavec, and xsaves

ok mlarkin@

18 months agoImprove bn_montgomery_multiply_words()
jsing [Sat, 22 Apr 2023 14:31:44 +0000 (14:31 +0000)]
Improve bn_montgomery_multiply_words()

Pull a number of invariants into variables, which avoids repeated loading
from memory on architectures where sufficient registers are available.
Also keep track of the per-iteration carry in a variable, rather than
unnecessarily reading from and writing to memory.

This gives a reasonable performance gain on some architectures (e.g. armv7)

18 months agoProvide initial regress for BN_{asc,dec,hex}2bn()/BN_bn2{dec,hex}()
jsing [Sat, 22 Apr 2023 14:03:03 +0000 (14:03 +0000)]
Provide initial regress for BN_{asc,dec,hex}2bn()/BN_bn2{dec,hex}()

18 months agoreduce the delays used in the mii/mdio bus ops
dlg [Sat, 22 Apr 2023 06:36:35 +0000 (06:36 +0000)]
reduce the delays used in the mii/mdio bus ops

this produces a significant speed up.

say you're reading 40ish mib counters off a port on switch chip,
where each counter read relies on multiple mdio operations. it took
well over a second to read the counters off a port in my my initial
version. after optimising the switch reads i got that down to a bit
under a second. after this change in dwqe i can read counters off
5 ports in about 0.03 seconds.

ok patrick@

18 months agouse if_baudrate and if_link_state for mac config, not mii media values
dlg [Sat, 22 Apr 2023 05:01:44 +0000 (05:01 +0000)]
use if_baudrate and if_link_state for mac config, not mii media values

the phy code sets if_baudrate and if_link_state, so the information
needed to config the mac on the chip is there anyway. it also has
the benefit that the driver doesnt have to understand every type
of media (eg, 1000baseTX vs 1000baseSX) because they're both the
same speed and that's what matters when configuring the chip and
the clocks etc.

this is a step toward being able to use a fixed-link node in the
device tree instead of a phy, as is found on the banana pi bpi-r2
pro on the gmac connected to a switch chip.

18 months agorevert vlan(4) inherits TSO flags
dlg [Sat, 22 Apr 2023 04:39:46 +0000 (04:39 +0000)]
revert vlan(4) inherits TSO flags

tb reports amd64 RAMDISK doesn't build with it.

also, vlan_flags_from_parent doesn't look right right. it iterates
over ifnetlist, which is all interfaces in the system, but appears
to assume they're all vlan interfaces and so uses a vlan_softc *
to inspect their if_softc pointers.

18 months agocms_io: sort includes
tb [Fri, 21 Apr 2023 20:36:07 +0000 (20:36 +0000)]
cms_io: sort includes

18 months agocms_io: reverse polarity of an if statement to unindent
tb [Fri, 21 Apr 2023 20:33:37 +0000 (20:33 +0000)]
cms_io: reverse polarity of an if statement to unindent

18 months agocms_io: Remove a stupid else branch
tb [Fri, 21 Apr 2023 20:30:53 +0000 (20:30 +0000)]
cms_io: Remove a stupid else branch

If you can initialize with functions, you can also initialize with
constants...

18 months agoRewrap some lines. No binary change
tb [Fri, 21 Apr 2023 20:08:23 +0000 (20:08 +0000)]
Rewrap some lines. No binary change

18 months agoUnwrap a line
tb [Fri, 21 Apr 2023 19:08:47 +0000 (19:08 +0000)]
Unwrap a line

18 months agoclockintr: prepare to hoist clockqueue_init() out of clockintr_cpu_init()
cheloha [Fri, 21 Apr 2023 16:35:20 +0000 (16:35 +0000)]
clockintr: prepare to hoist clockqueue_init() out of clockintr_cpu_init()

Reorganize the initialization block in clockintr_cpu_init() so that it
doesn't break when clockqueue_init() is called separately:

- If CQ_INTRCLOCK is not set, this is the first clockintr_cpu_init()
  call and we can install the intrclock given as argument.

- If any of the internal clock interrupt handles are NULL, this is the
  first clockintr_cpu_init() call and we need to establish them.

18 months agoclockintr: refactor clockintr_queue initialization into clockqueue_init()
cheloha [Fri, 21 Apr 2023 15:49:37 +0000 (15:49 +0000)]
clockintr: refactor clockintr_queue initialization into clockqueue_init()

We need to be able to initialize a given struct clockintr_queue before
clockintr_cpu_init() is called.  This will allow the primary CPU to
establish clock interrupts on other CPUs' queues before those CPUs
have finished booting.

So, move the clockintr_queue structure initialization code out of
clockintr_cpu_init() into a new function, clockqueue_init().
clockqueue_init() sets CQ_INIT the first time it is called.
Subsequent calls do nothing.

18 months agoclockintr_cpu_init: avoid CQ_INIT flag when scheduling cq_hardclock
cheloha [Fri, 21 Apr 2023 15:33:00 +0000 (15:33 +0000)]
clockintr_cpu_init: avoid CQ_INIT flag when scheduling cq_hardclock

The meaning of the CQ_INIT flag is about to change.  Soon, we won't be
able to use it to decide whether a given clockintr_cpu_init() call is
the first on a given CPU.

Instead, use the value of cl_expiration.  If it's zero, we know this
is the first clockintr_cpu_init() call on this CPU.

18 months agovlan(4) inherits TSO flags
jan [Fri, 21 Apr 2023 14:31:41 +0000 (14:31 +0000)]
vlan(4) inherits TSO flags

tested by Hrvoje Popovski

with tweaks from bluhm and claudio

encouraged from deraadt
ok bluhm

18 months agomg: fix space_to_tabstop
op [Fri, 21 Apr 2023 14:14:13 +0000 (14:14 +0000)]
mg: fix space_to_tabstop

Since the import of mg in the tree, space_to_tabstop used curbp->w_doto
(the byte offset in the current line) as mean to deduce the current
column for indentation.  This is wrong because it doesn't account for
tab, control characters and octets > 127 (which are all rendered with
more than one column.)  Use instead getcolpos().

ok tb@

18 months agoDelete incomplete and unreferenced 'miniroot' entries from
krw [Fri, 21 Apr 2023 14:09:52 +0000 (14:09 +0000)]
Delete incomplete and unreferenced 'miniroot' entries from
arm64 and macppc disktab.

18 months agomg: allow to change the tab width
op [Fri, 21 Apr 2023 13:39:36 +0000 (13:39 +0000)]
mg: allow to change the tab width

This makes the tab width customizable per-buffer.  The new function
`set-tab-width' changes it for the current buffer or the default value
for new buffers if called with a prefix argument (or from the startup
file.)

The default tab width is still 8 column.

Together with the newly resurrected no-tab-mode, allows to use mg for a
variety of programming languages and coding styles.

Note that it's not possible to call set-tab-width with auto-execute in
the startup file due to limitations in how auto-execute and the parser
work.

ok tb@

18 months agoIf gapdummy.c is compiled with -fcf-protection=branch, clang 13
bluhm [Fri, 21 Apr 2023 13:24:20 +0000 (13:24 +0000)]
If gapdummy.c is compiled with -fcf-protection=branch, clang 13
creates and additional section .note.gnu.property.  With that the
linker creates a section .plt in gap.o.  In the end, a .plt section
is also present in the kernel.  There it does not make sense.  As
a quick fix explcitly disable cf protection when compiling gapdummy.c
to gapdummy.o.  There is no code to protect anyway.
OK deraadt@

18 months agos2i_ASN1_INTEGER: make error conditions more explicit, a few more tweaks
tb [Fri, 21 Apr 2023 13:08:16 +0000 (13:08 +0000)]
s2i_ASN1_INTEGER: make error conditions more explicit, a few more tweaks

18 months agos2i_ASN1_INTEGER.3: minor fixes
tb [Fri, 21 Apr 2023 12:28:47 +0000 (12:28 +0000)]
s2i_ASN1_INTEGER.3: minor fixes

Fix botched Xr and be more precise about errors by being less precise.
Add a BUGS section.

18 months agoAdjust ext community handling to support the generic transitive communities
claudio [Fri, 21 Apr 2023 10:49:01 +0000 (10:49 +0000)]
Adjust ext community handling to support the generic transitive communities
introduced with flowspec.
OK tb@

18 months agoAdjust ext community handling to support the generic transitive communities
claudio [Fri, 21 Apr 2023 10:48:33 +0000 (10:48 +0000)]
Adjust ext community handling to support the generic transitive communities
introduced with flowspec.
OK tb@

18 months agoMissing space noticed by Pablo Mendez Hernandez
claudio [Fri, 21 Apr 2023 10:47:07 +0000 (10:47 +0000)]
Missing space noticed by Pablo Mendez Hernandez

18 months agoSync common code with bgpctl with the version from there.
claudio [Fri, 21 Apr 2023 09:28:14 +0000 (09:28 +0000)]
Sync common code with bgpctl with the version from there.
OK tb@

18 months agoImplement flowspec add and delete to add/remove flowspec rules dynamically.
claudio [Fri, 21 Apr 2023 09:12:41 +0000 (09:12 +0000)]
Implement flowspec add and delete to add/remove flowspec rules dynamically.
OK tb@

18 months agoUncomment and document X.509 verifier error codes
tb [Fri, 21 Apr 2023 06:45:56 +0000 (06:45 +0000)]
Uncomment and document X.509 verifier error codes

These are in actual use, so their meaning should be documented.
The remaining commented codes are unused outside of x509_txt.c
except for X509_V_ERR_INVALID_NON_CA which looks used at first
glance, but it is actually in an unreachable path of the legacy
verifier.

18 months agoRemove some (soon to be) outdated documentation
tb [Fri, 21 Apr 2023 06:34:37 +0000 (06:34 +0000)]
Remove some (soon to be) outdated documentation

The documentation of the BN_MOD_CTX has been out of sync with reality
for decades. The structure is now opaque, so its members should not be
documented this way. They internals aren't important for the rest of
the page.

BN_MOD_CTX_init() will soon be removed. It's useless unless you like
leaks.

18 months agoremove duplicate include
jsg [Fri, 21 Apr 2023 06:19:40 +0000 (06:19 +0000)]
remove duplicate include
ok otto@

18 months agoRemove the now unused x509_enum.c
tb [Fri, 21 Apr 2023 06:14:42 +0000 (06:14 +0000)]
Remove the now unused x509_enum.c

18 months agoMove the CRL reason method into x509_bitst.c
tb [Fri, 21 Apr 2023 06:11:56 +0000 (06:11 +0000)]
Move the CRL reason method into x509_bitst.c

The CRL extension handler is completely misplaced in x509_enum.c.
Move it to x509_bitst.c until we find a better home for it. This
way it is next to the other two extension methods that have the
extra usr_data contortion.

18 months agoMove i2s_ASN1_ENUMERATED_TABLE() next to i2s_ASN1_ENUMERATED()
tb [Fri, 21 Apr 2023 06:07:10 +0000 (06:07 +0000)]
Move i2s_ASN1_ENUMERATED_TABLE() next to i2s_ASN1_ENUMERATED()

These functions probably belong into asn1/ but they definitely don't
belong into separate files.

18 months agoTweak whitespace gone wrong
tb [Fri, 21 Apr 2023 06:00:24 +0000 (06:00 +0000)]
Tweak whitespace gone wrong

18 months agoStop using ENUMERATED_NAMES
tb [Fri, 21 Apr 2023 05:56:51 +0000 (05:56 +0000)]
Stop using ENUMERATED_NAMES

This is a public alias for the also public BIT_STRING_BITNAME. The
ENUMERATED_NAMES type is used exactly twice, namely on two lines in this
file. This is silly.

18 months agodrm/amd/pm: correct SMU13.0.7 max shader clock reporting
jsg [Fri, 21 Apr 2023 03:49:31 +0000 (03:49 +0000)]
drm/amd/pm: correct SMU13.0.7 max shader clock reporting

From Horatio Zhang
1f93ed9a684173bbe2cff58cdf135f8ea53156f2 in linux-6.1.y/6.1.25
85e0689eb6b10cd3b2fb455d1b3f4d4d0b13ff78 in mainline linux

18 months agodrm/amd/pm: correct SMU13.0.7 pstate profiling clock settings
jsg [Fri, 21 Apr 2023 03:47:24 +0000 (03:47 +0000)]
drm/amd/pm: correct SMU13.0.7 pstate profiling clock settings

From Horatio Zhang
8464a01508f40a5a65db2036b7137618ee195307 in linux-6.1.y/6.1.25
f06b8887e3ef4f50098d3a949aef392c529c831a in mainline linux

18 months agodrm/amdgpu/gfx: set cg flags to enter/exit safe mode
jsg [Fri, 21 Apr 2023 03:45:40 +0000 (03:45 +0000)]
drm/amdgpu/gfx: set cg flags to enter/exit safe mode

From Jane Jian
8c1e247907b999fbd3bbcb0ad2074949fb0f55ae in linux-6.1.y/6.1.25
e06bfcc1a1c41bcb8c31470d437e147ce9f0acfd in mainline linux

18 months agodrm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs
jsg [Fri, 21 Apr 2023 03:44:04 +0000 (03:44 +0000)]
drm/amdgpu: Force signal hw_fences that are embedded in non-sched jobs

From YuBiao Wang
b4efb6af93ca755f5469114adfd7f26bb944962c in linux-6.1.y/6.1.25
033c56474acf567a450f8bafca50e0b610f2b716 in mainline linux

18 months agodrm/amdgpu: add mes resume when do gfx post soft reset
jsg [Fri, 21 Apr 2023 03:42:20 +0000 (03:42 +0000)]
drm/amdgpu: add mes resume when do gfx post soft reset

From Tong Liu01
df27bcd0cf2b365d78f3875404de2ffb98651768 in linux-6.1.y/6.1.25
4eb0b49a0ad3e004a6a65b84efe37bc7e66d560f in mainline linux

18 months agodrm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F
jsg [Fri, 21 Apr 2023 03:40:34 +0000 (03:40 +0000)]
drm: panel-orientation-quirks: Add quirk for Lenovo Yoga Book X90F

From Hans de Goede
1fe2ed70c054b141550d397685ca4c32a321c0ae in linux-6.1.y/6.1.25
03aecb1acbcd7a660f97d645ca6c09d9de27ff9d in mainline linux

18 months agodrm/i915/dsi: fix DSS CTL register offsets for TGL+
jsg [Fri, 21 Apr 2023 03:36:03 +0000 (03:36 +0000)]
drm/i915/dsi: fix DSS CTL register offsets for TGL+

From Jani Nikula
8d901a336302324742bd800f8402d3c0e781c8ff in linux-6.1.y/6.1.25
6b8446859c971a5783a2cdc90adf32e64de3bd23 in mainline linux

18 months agodrm/amd/display: Pass the right info to drm_dp_remove_payload
jsg [Fri, 21 Apr 2023 03:33:39 +0000 (03:33 +0000)]
drm/amd/display: Pass the right info to drm_dp_remove_payload

From Wayne Lin
779fd2a575cc30182589e4e1da9905f20a27374a in linux-6.1.y/6.1.25
b8ca445f550a9a079134f836466ddda3bfad6108 in mainline linux

18 months agosync
deraadt [Fri, 21 Apr 2023 03:26:50 +0000 (03:26 +0000)]
sync

18 months agoclockintr_cpu_init: fix clockintr staggering
cheloha [Fri, 21 Apr 2023 03:03:50 +0000 (03:03 +0000)]
clockintr_cpu_init: fix clockintr staggering

Use reset_cq_intrclock as a stand-in for the CQ_INTRCLOCK flag when
deciding whether to stagger clockintr expirations across CPUs.

18 months agoclockintr: add clockqueue_reset_intrclock()
cheloha [Fri, 21 Apr 2023 02:41:06 +0000 (02:41 +0000)]
clockintr: add clockqueue_reset_intrclock()

If a call to clockintr_advance(), clockintr_cancel(), or
clockintr_schedule() changes which clockintr on a given queue is
expiring soonest, we need to rearm the queue's intrclock according
to that most imminent expiration.

Add clockqueue_reset_intrclock() and use it during the aforementioned
scheduling operations if the caller is running on the queue's
controlling CPU.

Scheduling operations are not currently run while CQ_INTRCLOCK is set,
so this patch changes no behavior yet.

clockqueue_reset_intrclock() is only part of the story.  At some point
we will also need to add IPIs to every architecture to handle the case
when the caller is not running on a queue's controlling CPU.

18 months agoadd -pweneighbor.
asou [Fri, 21 Apr 2023 01:15:48 +0000 (01:15 +0000)]
add -pweneighbor.

ok deraadt@

18 months agoDrop error variable and return directly; OK mvs tb
kn [Fri, 21 Apr 2023 00:41:13 +0000 (00:41 +0000)]
Drop error variable and return directly;  OK mvs tb

18 months agoI departed from RZV (open since may 2022)
kn [Fri, 21 Apr 2023 00:37:10 +0000 (00:37 +0000)]
I departed from RZV (open since may 2022)

18 months agoCall sysctl_source() with shared netlock. It performs read-only
mvs [Thu, 20 Apr 2023 21:43:17 +0000 (21:43 +0000)]
Call sysctl_source() with shared netlock. It performs read-only
access to netlock protected data.

ok kn@ bluhm@

18 months agoremove a stray macro, and fix SEE ALSO;
jmc [Thu, 20 Apr 2023 20:33:55 +0000 (20:33 +0000)]
remove a stray macro, and fix SEE ALSO;

18 months agoRevert the previous commit. The raw devices don't exist when this runs
kettenis [Thu, 20 Apr 2023 19:42:52 +0000 (19:42 +0000)]
Revert the previous commit.  The raw devices don't exist when this runs
and the block devices work just fine.

18 months agoadd viogpu, a VirtIO GPU driver
jcs [Thu, 20 Apr 2023 19:28:30 +0000 (19:28 +0000)]
add viogpu, a VirtIO GPU driver

works enough to get a console on qemu with more work to come from
others

feedback from miod
ok patrick

18 months agoFix Dt and Xr
tb [Thu, 20 Apr 2023 18:54:47 +0000 (18:54 +0000)]
Fix Dt and Xr

18 months agoFlip the default of explicitText to UTF8String
tb [Thu, 20 Apr 2023 18:29:08 +0000 (18:29 +0000)]
Flip the default of explicitText to UTF8String

While it may have been reasonable to use VisibleString back when this
code was written, it's an anachronism nowadays. In particular, configuring
BoringSSL reports that they have seen malformed certificates with exactly
the issue caused by this unfortuante default.

Reported by Alex Gaynor in OpenSSL issue 20772

ok jsing

18 months agosync
tb [Thu, 20 Apr 2023 16:21:38 +0000 (16:21 +0000)]
sync

18 months agoLink s2i_ASN1_INTEGER.3 to build
tb [Thu, 20 Apr 2023 16:19:43 +0000 (16:19 +0000)]
Link s2i_ASN1_INTEGER.3 to build

18 months agoAdd documentation for s2i_ASN1_INTEGER and related functions
tb [Thu, 20 Apr 2023 16:15:29 +0000 (16:15 +0000)]
Add documentation for s2i_ASN1_INTEGER and related functions

These functions convert strings to internal objects and vice versa.
This is a best effort, probably with a lot of room for improvement,
which can happen in tree if anyone cares. It's better than nothing.
Nothing in turn would be significantly better than the utter garbage
a related project has managed to land as part of their efforts towards
significant documentation improvements in a recent major relase.

This leaves a dangling reference to the misnamed X509V3_METHOD_get_nid(3)
which I may or may not fill in the future.

I am unsure about the HISTORY section's precision, but that's what I got
from cvs history. All these functions are about a quarter century old
(and it shows), so I don't think it matters very much.

18 months agoRework the way transit provider AID masks are built and sent to the RDE.
claudio [Thu, 20 Apr 2023 15:44:45 +0000 (15:44 +0000)]
Rework the way transit provider AID masks are built and sent to the RDE.
ASPA provider AS sets can include optional limitations to inet/inet6 these
limits are represented in the TAS_AID bit masks (2bits per AS).
Introduce a TAS_AID_SIZE() makro that returns the size in bytes of this
bit mask (rounded to the next uint32_t).
Without this change aspa objects with AID specific elements trigger a
fatal error condition when the config is loaded.
OK tb@ job@

18 months agoConsistent casing
job [Thu, 20 Apr 2023 15:12:19 +0000 (15:12 +0000)]
Consistent casing

18 months agoASPAs solely containing providers limited to one AFI, imply AS 0 for the other AFI
job [Thu, 20 Apr 2023 15:05:44 +0000 (15:05 +0000)]
ASPAs solely containing providers limited to one AFI, imply AS 0 for the other AFI

OK claudio@

18 months agoclockintr: eliminate CL_SCHEDCLOCK flag
cheloha [Thu, 20 Apr 2023 14:51:28 +0000 (14:51 +0000)]
clockintr: eliminate CL_SCHEDCLOCK flag

The CL_SCHEDCLOCK flag is set when schedhz is non-zero.  It's
redundant.  We can just check the value of schedhz directly.

18 months agoImplement bgpctl show flowspec and bgpctl flowspec flush.
claudio [Thu, 20 Apr 2023 14:01:50 +0000 (14:01 +0000)]
Implement bgpctl show flowspec and bgpctl flowspec flush.

This uses the flowspec.c file from bgpd and implements the output
for flowspec only for the text printer for now. That code uses a lot
of code from printconf.c
OK tb@

18 months agoImplement IMSG_CTL_SHOW_FLOWSPEC and IMSG_FLOWSPEC_FLUSH and add bits for
claudio [Thu, 20 Apr 2023 12:53:27 +0000 (12:53 +0000)]
Implement IMSG_CTL_SHOW_FLOWSPEC and IMSG_FLOWSPEC_FLUSH and add bits for
IMSG_FLOWSPEC_ADD and IMSG_FLOWSPEC_REMOVE received from bgpctl via SE.
OK tb@

18 months agoDocument flowspec in bgpd.conf.5
claudio [Thu, 20 Apr 2023 12:44:28 +0000 (12:44 +0000)]
Document flowspec in bgpd.conf.5
Input and OK jmc@ tb@

18 months agoMove ring buffer allocation to before calling uhidev_open(), otherwise
brynet [Thu, 20 Apr 2023 10:49:57 +0000 (10:49 +0000)]
Move ring buffer allocation to before calling uhidev_open(), otherwise
it might be NULL in uhid_intr.

fixes "b_to_q: tty has no clist" panic hit by namn@

tested by thfr@ and namn@

ok anton@

18 months agoExercise d2i_IPAddrBlocks() and X509v3_addr_subset() a little bit
tb [Thu, 20 Apr 2023 07:39:17 +0000 (07:39 +0000)]
Exercise d2i_IPAddrBlocks() and X509v3_addr_subset() a little bit

18 months agoclockintr_cpu_init: mask CQ_INTRCLOCK while advancing schedule
cheloha [Thu, 20 Apr 2023 00:24:11 +0000 (00:24 +0000)]
clockintr_cpu_init: mask CQ_INTRCLOCK while advancing schedule

Allowing the intrclock to fire in the midst of clockintr_cpu_init()
would complicate the function a lot.  However, in a future patch we
will need to enable intrclock operations in clockintr_advance(),
clockintr_cancel(), and clockintr_schedule().

We can avoid this conflict by masking CQ_INTRCLOCK while we're
updating the internal clockintrs in clockintr_cpu_init().  When we no
longer need clockintr_cpu_init(), this workaround will disappear.

18 months agomove kernel lock into multicast ioctl handlers; OK mvs
kn [Wed, 19 Apr 2023 20:03:51 +0000 (20:03 +0000)]
move kernel lock into multicast ioctl handlers;  OK mvs

18 months agoFix missing whitespace in bgpd(8) output
job [Wed, 19 Apr 2023 19:26:26 +0000 (19:26 +0000)]
Fix missing whitespace in bgpd(8) output

18 months agoForce a standard umask before adding/deleting packages. If not done and
sthen [Wed, 19 Apr 2023 18:07:43 +0000 (18:07 +0000)]
Force a standard umask before adding/deleting packages. If not done and
the user has a restrictive mask, various items (new directories, @sample'd
files, /var/db/pkg entries, mandoc databases) end up not readable.

feedback/ok espie@

18 months agoProtect rtable_setsource() and rtable_getsource() with exclusive
bluhm [Wed, 19 Apr 2023 17:42:47 +0000 (17:42 +0000)]
Protect rtable_setsource() and rtable_getsource() with exclusive
and shared netlock respectively.
OK kn@ mvs@

18 months agoFix botched line wrap
tb [Wed, 19 Apr 2023 16:36:34 +0000 (16:36 +0000)]
Fix botched line wrap

18 months agoImplement support for PT_OPENBSD_NOBTCFI in lld(1). This can be set using
kettenis [Wed, 19 Apr 2023 16:04:33 +0000 (16:04 +0000)]
Implement support for PT_OPENBSD_NOBTCFI in lld(1).  This can be set using
the -z nobtcfi option.

ok deraadt@

18 months agoAdd a new PT_OPENBSD_NOBTCFI "segment type" to indicate that the kernel
kettenis [Wed, 19 Apr 2023 15:37:36 +0000 (15:37 +0000)]
Add a new PT_OPENBSD_NOBTCFI "segment type" to indicate that the kernel
should not enforce branch target control flow integrety for a binary.
This works analoguous to PT_OPENBSD_WXNEEDED in that we will set it on
binaries that don't have the necessary landing pads (yet).  The kernel
will enforce branch target CFI by default in the near future!

This is a better match for what we want to achieve than the GNU property
note mechanism that the Linux folks came up with.  We can still use the
GNU property notes for diagnostic purposes so we won't disable their
generation in the toolchain.  But ports will need to pass an explicit
-Wl,-z,nobtcfi option to disable branch target CFI.

Like with PT_OPENBSD_WXNEEDED we convert the presence of PT_OPENBSD_NOBTCFI
into a flag in struct exec_package.  From there MD code can pick it up
and set a struct process flag or take action in setregs().

ok deraadt@

18 months agointerop: work around extreme REGRESS_SKIP_SLOW slowness
tb [Wed, 19 Apr 2023 15:34:23 +0000 (15:34 +0000)]
interop: work around extreme REGRESS_SKIP_SLOW slowness

A few years back beck introduced REGRESS_SKIP_SLOW dances with the idea
that this should speed up the interop tests for us devs because this also
checked interop between opensslX and opensslY, which we don't particularly
care about. This never really worked. On a mac m1 mini the result is this:

REGRESS_SKIP_SLOW unset
    9m56.69s real     3m42.24s user     3m00.70s system
REGRESS_SKIP_SLOW=yes
   11m04.61s real     7m29.61s user     1m40.29s system

The problem is that REGRESS_SKIP_SLOW simply wasn't designed to handle
the huge number of tests we have here. There are many nested .for loops
resulting in several thousand tests. Each test has a name of length ~80.
REGRESS_SKIP_SLOW concatenates them into a several hundred kilobytes
long string in REGRESS_SKIP_TARGETS, iterates over all regress targets and
tests with ".if ${REGRESS_SKIP_TARGETS:M${RT}}" if it should skip them.
This means that during a regress run, make spends a lot of time linearly
scanning a huge string.

I ran into this when I added OpenSSL 3.0 tests to the already existing
1.0.2 and 1.1 tests with the result that with REGRESS_SLOW_TARGTS set
it took the better part of an hour while without it it took about 15 min.

The hack here is simply to avoid using REGRESS_SLOW_TARGTES here and
handle the situation differently.

patch, REGRESS_SKIP_SLOW=yes
    5m42.32s real     2m09.98s user     1m45.21s system

The real solution would be to fix this in bsd.regress.mk, which someone
who understands make well is very welcome to do. For now, I'm happy with
this.

Debugged with jsing a few months ago

18 months agoReshuffle the flowrule yacc rules to be in a more logical and alphabetical
claudio [Wed, 19 Apr 2023 15:27:46 +0000 (15:27 +0000)]
Reshuffle the flowrule yacc rules to be in a more logical and alphabetical
order.

18 months agoclockintr: rename CL_CPU_* flags to CQ_* flags
cheloha [Wed, 19 Apr 2023 14:30:35 +0000 (14:30 +0000)]
clockintr: rename CL_CPU_* flags to CQ_* flags

The CL_CPU_* flags were originally so-named because they were set from
clockintr_cpu_init(), which was itself named before I had named the
clockintr_queue struct.  It makes more for the flag namespace to match
the struct namespace, so CQ_* is a better flag prefix than CL_CPU_*.

While we're at it, move the CQ_* flag definitions up so they
immediately follow the clockintr_queue structure definition in
sys/clockintr.h.

18 months agoremove duplicate includes
jsg [Wed, 19 Apr 2023 13:33:37 +0000 (13:33 +0000)]
remove duplicate includes

18 months agoAdd workaround for introduction of flowrib and re_rib() functional change.
claudio [Wed, 19 Apr 2023 13:25:07 +0000 (13:25 +0000)]
Add workaround for introduction of flowrib and re_rib() functional change.

18 months agoImplement a way to announce flowspec rules without hitting Adj-RIB-In
claudio [Wed, 19 Apr 2023 13:23:33 +0000 (13:23 +0000)]
Implement a way to announce flowspec rules without hitting Adj-RIB-In
and Loc-RIB. Flowspec objects are collected in a single flowrib RIB
and then directly distributed into the various Adj-RIB-Outs.
For this to work add a bypass in the filter logic (flowspec AFI/SAFI
are currently accepted without any rule). The filter language lacks
a way to allow prefixes based on AFI/SAFI which is the minimum needed.
OK tb@

18 months agoremove duplicate includes
jsg [Wed, 19 Apr 2023 12:58:15 +0000 (12:58 +0000)]
remove duplicate includes

18 months agoremove duplicate include
jsg [Wed, 19 Apr 2023 12:34:23 +0000 (12:34 +0000)]
remove duplicate include
feedback tb@

18 months agoremove duplicate includes
jsg [Wed, 19 Apr 2023 12:30:09 +0000 (12:30 +0000)]
remove duplicate includes
ok tb@

18 months agoRemove obsolete/unused disktab entries for install media
krw [Wed, 19 Apr 2023 11:20:03 +0000 (11:20 +0000)]
Remove obsolete/unused disktab entries for install media
that are no longer built.

ok miod@

18 months agoRename Hex array to hex_digits.
jsing [Wed, 19 Apr 2023 11:14:04 +0000 (11:14 +0000)]
Rename Hex array to hex_digits.

ok tb@

18 months agoMove the BN_bn2bin()/BN_bin2bn() family to bn_convert.c
jsing [Wed, 19 Apr 2023 11:12:43 +0000 (11:12 +0000)]
Move the BN_bn2bin()/BN_bin2bn() family to bn_convert.c

18 months agoReorder functions.
jsing [Wed, 19 Apr 2023 11:05:11 +0000 (11:05 +0000)]
Reorder functions.

No functional change.

18 months agoMove BN_options() from bn_convert.c to bn_lib.c
jsing [Wed, 19 Apr 2023 10:54:49 +0000 (10:54 +0000)]
Move BN_options() from bn_convert.c to bn_lib.c

18 months agounifdef BN_RECURSION
jsing [Wed, 19 Apr 2023 10:51:22 +0000 (10:51 +0000)]
unifdef BN_RECURSION

This removes a bunch of incomplete and scary code, which potentially leaks
secrets and is not constant time. A performance gain is achieved on arm64
for sizes that we care about, while a minimal decrease in performance is
noted for larger sizes on some other platforms.

While we will potentially reimplement Karatsuba (or Toom-Cook) at a later
date, it will be easier and safer to do it from a clean slate.

ok tb@

18 months agoRemove usage of fatalx() in here. This code will be shared with bgpctl.
claudio [Wed, 19 Apr 2023 09:31:58 +0000 (09:31 +0000)]
Remove usage of fatalx() in here. This code will be shared with bgpctl.
In flowspec_cmp() make sure a deterministic sort is possible. Most error
cases are unreachable if flowspec NLRI are validated first (flowspec_valid).
In flowspec_valid() replace the assert like check with an error return.
OK tb@

18 months agoAdd minimal support for flowspec in the table-mp MRT format.
claudio [Wed, 19 Apr 2023 09:03:00 +0000 (09:03 +0000)]
Add minimal support for flowspec in the table-mp MRT format.
In general people should use table-v2 which handles flowspec just fine.
OK tb@

18 months agoAdd handling for flowspec in the update path.
claudio [Wed, 19 Apr 2023 08:30:37 +0000 (08:30 +0000)]
Add handling for flowspec in the update path.

Flowspec has no nexthop so adjust up_prep_adjout() to handle a NULL nexthop.
Add the MP_REACH encoding in up_generate_mp_reach for flowspec.
OK tb@

18 months agoImplement code to pass the flowspec config over to the RDE. The parent
claudio [Wed, 19 Apr 2023 07:12:22 +0000 (07:12 +0000)]
Implement code to pass the flowspec config over to the RDE. The parent
process tracks which prefixes are added / removed and issues the
corresponding imsg calls.
Right now the RDE does nothing with the received information.
OK tb@

18 months agoExtend the pt_entry api to handle flowspec.
claudio [Wed, 19 Apr 2023 07:09:47 +0000 (07:09 +0000)]
Extend the pt_entry api to handle flowspec.
Introduce pt_get_flow() and pt_add_flow() to lookup and insert flowspec
objects. Add pt_getflowspec() which works somewhat similar to pt_getaddr()
to extract the flowspec NLRI from a pt_entry.
Make pt_getaddr() to return the destination prefix of the flowspec rule and
handle flowspec in pt_write().
OK tb@