openbsd
2 years agoCall if_put(9) after we finish with `ia' within ip_getmoptions().
mvs [Wed, 25 May 2022 19:48:46 +0000 (19:48 +0000)]
Call if_put(9) after we finish with `ia' within ip_getmoptions().

if_put(9) call means we finish work with `ifp' and it could be destroyed.
`ia' is the pointer to 'in_ifaddr' data belongs to `ifp', so we need to
release corresponding `ifp' after we finish deal with `ia'.

`if_addrlist' list destruction and ip_getmoptions() are serialized with
kernel and net locks so this is not critical, but looks inconsistent.

ok bluhm@

2 years agoRevert the .rodata.cst4 change: results in incorrect value read
guenther [Wed, 25 May 2022 17:32:36 +0000 (17:32 +0000)]
Revert the .rodata.cst4 change: results in incorrect value read

2 years agoRemove an unnecessary XXX comment. The suggested check is part of
tb [Wed, 25 May 2022 17:10:30 +0000 (17:10 +0000)]
Remove an unnecessary XXX comment. The suggested check is part of
extract_min_max().

2 years agoAdjust code after adding an extra argument to community_ext_add
claudio [Wed, 25 May 2022 16:56:04 +0000 (16:56 +0000)]
Adjust code after adding an extra argument to community_ext_add

2 years agoPrint ASnumbers in asplain format and stop using the old asdot format.
claudio [Wed, 25 May 2022 16:21:11 +0000 (16:21 +0000)]
Print ASnumbers in asplain format and stop using the old asdot format.
While there clean up some draft comments with their RFC number.
The detection for 4-byte ASPATH attributes is a bit sloppy but since
all resonable BGP versions use 4-byte ASnumbers now we default to them
unless we know it is a 2-byte encoding.
Kill it with fire. deraadt@ & job@ OK sthen@

2 years agoFix non-transitive extended community handling.
claudio [Wed, 25 May 2022 16:03:34 +0000 (16:03 +0000)]
Fix non-transitive extended community handling.
First of all the detection logic was totally wrong. Then filter out
non-transitive extended communities when received from an ebgp peer.
Also cleanup the type handling of ext-communities. Mainly to not have
to handle the transitive vs non-transitive versions the type is masked
with EXT_COMMUNITY_VALUE before doing the switch case for the various
types.
With this my test using ext-communities works.
OK tb@

2 years agoAdd RFC 9234 "BGP Role" support
job [Wed, 25 May 2022 14:26:27 +0000 (14:26 +0000)]
Add RFC 9234 "BGP Role" support

With and OK claudio@

2 years agodrm/dp/mst: fix a possible memory leak in fetch_monitor_name()
jsg [Wed, 25 May 2022 12:37:23 +0000 (12:37 +0000)]
drm/dp/mst: fix a possible memory leak in fetch_monitor_name()

From Hangyu Hua
deec86168170d085d4f91445c1f72a900ed02372 in linux 5.15.y/5.15.42
6e03b13cc7d9427c2c77feed1549191015615202 in mainline linux

2 years agodrm/i915/dmc: Add MMIO range restrictions
jsg [Wed, 25 May 2022 12:33:48 +0000 (12:33 +0000)]
drm/i915/dmc: Add MMIO range restrictions

From Anusha Srivatsa
aaf0f01d074d6fd39ec1b01477f69cd688bf6c9d in linux 5.15.y/5.15.42
54395a33718af1c04b5098203335b25382291a16 in mainline linux

2 years agodrm/amd: Don't reset dGPUs if the system is going to s2idle
jsg [Wed, 25 May 2022 12:29:12 +0000 (12:29 +0000)]
drm/amd: Don't reset dGPUs if the system is going to s2idle

From Mario Limonciello
9d3ec4e5bf032f53137e11075846cec9c474ce4b in linux 5.15.y/5.15.42
7123d39dc24dcd21ff23d75f46f926b15269b9da in mainline linux

2 years agoRevert "drm/i915/opregion: check port number bounds for SWSCI display power state"
jsg [Wed, 25 May 2022 12:25:25 +0000 (12:25 +0000)]
Revert "drm/i915/opregion: check port number bounds for SWSCI display power state"

From Greg Thelen
11e6a90ffd6294083b808d34ccc5a5ea18ed603e in linux 5.15.y/5.15.42

2 years agoAs with if_em.c r1.350, and for the same reasons (arm64 systems with non
jmatthew [Wed, 25 May 2022 09:49:17 +0000 (09:49 +0000)]
As with if_em.c r1.350, and for the same reasons (arm64 systems with non
cache coherent PCIe), map the rx and tx rings coherent.

tested by kevlo@ on rockpro64
ok dlg@

2 years agorevert previous; it was broken (spotted by Theo)
djm [Wed, 25 May 2022 06:03:44 +0000 (06:03 +0000)]
revert previous; it was broken (spotted by Theo)

2 years agomarvell,armada-3700-ahci seems to work.
dlg [Wed, 25 May 2022 03:03:58 +0000 (03:03 +0000)]
marvell,armada-3700-ahci seems to work.

ok kettenis@ patrick@

2 years agomake SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via
djm [Wed, 25 May 2022 00:31:13 +0000 (00:31 +0000)]
make SSHBUF_DBG/SSHBUF_TELL (off by default and only enabled via
#define) dump to stderr rather than stdout

2 years agoDelete superfluous/duplicated #includes
guenther [Tue, 24 May 2022 22:36:58 +0000 (22:36 +0000)]
Delete superfluous/duplicated #includes

2 years agoGive internal 'botch' labels a '.L' prefix to remove them from the
guenther [Tue, 24 May 2022 22:35:27 +0000 (22:35 +0000)]
Give internal 'botch' labels a '.L' prefix to remove them from the
symbol table

ok kettenis@ miod@

2 years agoAddress the clang 13 "changed binding to STB_WEAK" warning on arm64:
guenther [Tue, 24 May 2022 22:34:02 +0000 (22:34 +0000)]
Address the clang 13 "changed binding to STB_WEAK" warning on arm64:
add _?ENTRY_NB to asm.h, switch libc's asm bits to the generic
DEFS.h, and use ENTRY_NB as necessary.

Also, give sizes to the htonl/htons symbols and mark them as weak.

ok kettenis@ miod@

2 years agoClean up ASN1_item_sign_ctx() a little
tb [Tue, 24 May 2022 20:20:19 +0000 (20:20 +0000)]
Clean up ASN1_item_sign_ctx() a little

Instead of inl, outl, and outll, use in_len, out_len, and buf_out_len.
Use the appropriate types for them. Check return values properly, check
for overflow. Remove some unnecessary casts and add some for readability.
Use asn1_abs_set_unused_bits() instead of inlining it.

This removes the last direct consumer of ASN1_STRING_FLAG_BITS_LEFT
outside of asn1/a_bitstr.c. The flag is still mentioned in x509/x509_addr.c
but that will hopefully go away soon.

tweaks/ok jsing

2 years agoSimplify ec_asn1_group2curve()
tb [Tue, 24 May 2022 20:06:32 +0000 (20:06 +0000)]
Simplify ec_asn1_group2curve()

Don't try to reuse curve->seed to avoid an allocation. Free it
unconditionally and copy over the group->seed if it's available.
Use asn1_abs_set_unused_bits() instead of inlining it.

ok jsing

2 years agoStraightforward conversion of ecdh_cms_encrypt() to
tb [Tue, 24 May 2022 20:00:15 +0000 (20:00 +0000)]
Straightforward conversion of ecdh_cms_encrypt() to
asn1_abs_set_unused_bits()

ok jsing

2 years agoRewrite X509_PUBKEY_set0_param() to use asn1_abs_set_unused_bits()
tb [Tue, 24 May 2022 19:59:14 +0000 (19:59 +0000)]
Rewrite X509_PUBKEY_set0_param() to use asn1_abs_set_unused_bits()

This streamlines the logic and uses ASN1_STRING_set0() and
asn1_abs_set_unused_bits() instead of inlining them.

ok jsing

2 years agoUse asn1_abs_set_unused_bits() in asn1_str2type()
tb [Tue, 24 May 2022 19:56:13 +0000 (19:56 +0000)]
Use asn1_abs_set_unused_bits() in asn1_str2type()

ok jsing

2 years agofdisk(8) no longer uses the partition table it finds in
krw [Tue, 24 May 2022 17:29:02 +0000 (17:29 +0000)]
fdisk(8) no longer uses the partition table it finds in
/usr/mdec/mbr. Make the partition table all zeros and
see if any hidden uses fall out.

ok deraadt@

2 years agoSet the correct alignment on __jmpxor (.align's meaning is MD!)
guenther [Tue, 24 May 2022 17:21:17 +0000 (17:21 +0000)]
Set the correct alignment on __jmpxor (.align's meaning is MD!)
Put .L_setjmp_magic in the correct ELF section for duplicate suppression
Rename the "botch" label to delete it from the symbol table

ok kettenis@ miod@

2 years agoDelete superfluous/duplicated #includes
guenther [Tue, 24 May 2022 17:20:23 +0000 (17:20 +0000)]
Delete superfluous/duplicated #includes

2 years agoAdd END() tags to give these functions sizes in the ELF symbol table
guenther [Tue, 24 May 2022 17:19:46 +0000 (17:19 +0000)]
Add END() tags to give these functions sizes in the ELF symbol table

ok kettenis@ miod@

2 years agoAddress the clang 13 "changed binding to STB_WEAK" warning on arm (32bit):
guenther [Tue, 24 May 2022 17:15:22 +0000 (17:15 +0000)]
Address the clang 13 "changed binding to STB_WEAK" warning on arm (32bit):
 * add _?ENTRY_NB to arm/asm.h
 * make sure ld.so's arm asm bits see the same includes as libc
 * switch libc's arm bits to the generic DEFS.h
 * switch arm ASM bits from ENTRY to ENTRY_NB as necessary

ok kettenis@ miod@

2 years agofix some dobeep_msgs calls
op [Tue, 24 May 2022 16:42:19 +0000 (16:42 +0000)]
fix some dobeep_msgs calls

dobeep_msgs isn't printf-like: it just prints the two arguments
separated by a space.  When it was introduced, some calls from ewprintf
were incorrectly translated and the "%s" remained.

ok florian@

2 years agoautomatically delete trailing whitespaces on RET in c-mode and
op [Tue, 24 May 2022 16:24:31 +0000 (16:24 +0000)]
automatically delete trailing whitespaces on RET in c-mode and
auto-indent-mode (only after computing the auto indent.)

tested also by Mikhail (thanks!).  ok tb@

2 years agoWhile not strictly required clear all pfds in the poll loop and not just
claudio [Tue, 24 May 2022 09:22:45 +0000 (09:22 +0000)]
While not strictly required clear all pfds in the poll loop and not just
once at the start.
OK tb@

2 years agoIntroduce MAX_HTTP_REQUESTS and MAX_RSYNC_REQUESTS.
claudio [Tue, 24 May 2022 09:20:49 +0000 (09:20 +0000)]
Introduce MAX_HTTP_REQUESTS and MAX_RSYNC_REQUESTS.
These just replace MAX_CONNECTIONS and MAX_RSYNC_PROCESSES to be more unified.
OK tb@

2 years agoRecent changes to truncate(2) swapped the ordering of some validations
anton [Tue, 24 May 2022 05:14:30 +0000 (05:14 +0000)]
Recent changes to truncate(2) swapped the ordering of some validations
causing EACCESS as opposed of ESDIR to be returned while trying to
truncate a directory as a user lacking write permissions to the same
directory. As this behavior is reasonable, change the truncate directory
from /etc/ to /tmp which makes the test pass both as root and non-root.

2 years agoNeither macppc nor the retired loongson have any remaining useful
krw [Mon, 23 May 2022 16:58:10 +0000 (16:58 +0000)]
Neither macppc nor the retired loongson have any remaining useful
information in /usr/mdec/mbr. Stop telling fdisk(8) that macppc
and loongson HAS_MBR, and don't bother including the file in the
base set.

macppc build/install tests and ok gkoehler@
loongson is gone deraadt@

2 years agoRespect RLIMIT_FSIZE when extending a file via truncat(2)/ftruncate(2).
millert [Mon, 23 May 2022 15:17:11 +0000 (15:17 +0000)]
Respect RLIMIT_FSIZE when extending a file via truncat(2)/ftruncate(2).
This refactors the commin parts of sys_truncate() and sys_ftruncate()
into dotruncate().  If the new size of the file is larger than the
RLIMIT_FSIZE limit _and_ the file is being extended, not truncated,
return EFBIG.  Adapted from a diff by Piotr Durlej.
With help from and OK by deraadt@ guenther@.

2 years agoImprove #ifdefs for STACK_OF() helpers.
tb [Mon, 23 May 2022 14:10:18 +0000 (14:10 +0000)]
Improve #ifdefs for STACK_OF() helpers.

Discussed with claudio

2 years agowhitespaces found when I went checking for something else
deraadt [Mon, 23 May 2022 13:40:11 +0000 (13:40 +0000)]
whitespaces found when I went checking for something else

2 years agoThere is no need to be quiet by default anymore and also stdout is
claudio [Mon, 23 May 2022 13:39:14 +0000 (13:39 +0000)]
There is no need to be quiet by default anymore and also stdout is
perfectly fine. So switch the stats output at the end of the run to
simply use printtf(3) and no longer depend on -v flag.
OK tb@

2 years agoadd support for the ehci controller on marvell 3720 boards.
dlg [Mon, 23 May 2022 11:37:22 +0000 (11:37 +0000)]
add support for the ehci controller on marvell 3720 boards.

the marvell controllers have two quirks compared to standard ehci
controllers, but they're small enough that they can be dealt with
here rather than creating a specific glue driver (like imxehci has).

the first quirk is that the ehci registers are offset in the window
advertised by the device tree. this is handled by having ehci_fdt
always present a bus space subregion to ehci, and defaults the
offset to 0. marvell controllers provide the right offset into their
register window so the subregion code can find the right place for
ehci to operate on.

the other quirk is that marvell controllers need to be forced to
host mode with the extra EHCI_USBMODE register.

this makes ehci work on espressobins and gl-mv1000 boards.

tested by me and dtucker@
ok kettenis@ patrick@

2 years agoIn pf the kernel paniced if IP options in packet within ICMP payload
bluhm [Mon, 23 May 2022 11:17:35 +0000 (11:17 +0000)]
In pf the kernel paniced if IP options in packet within ICMP payload
were truncated.  Drop such packets instead.
Reported-by: syzbot+91abd3aa2fdfe900f9ce@syzkaller.appspotmail.com
OK sashan@ claudio@

2 years agoFix white space.
bluhm [Mon, 23 May 2022 09:54:18 +0000 (09:54 +0000)]
Fix white space.

2 years agoConvert KVA allocation to km_alloc(9).
kettenis [Sun, 22 May 2022 16:54:17 +0000 (16:54 +0000)]
Convert KVA allocation to km_alloc(9).

ok visa@

2 years agoLock kernel in nfsrv_rcv() because NFS subsystem is not MP-safe yet.
visa [Sun, 22 May 2022 04:52:17 +0000 (04:52 +0000)]
Lock kernel in nfsrv_rcv() because NFS subsystem is not MP-safe yet.

Tested in snaps for a week.

OK bluhm@

2 years agoConvert KVA allocation to km_alloc(9).
kettenis [Sat, 21 May 2022 23:43:31 +0000 (23:43 +0000)]
Convert KVA allocation to km_alloc(9).

ok mpi@

2 years agoDocument rc_exec.
ajacoutot [Sat, 21 May 2022 14:11:39 +0000 (14:11 +0000)]
Document rc_exec.

2 years agoRepair a leak of a FILE. The FILE contains a fd via fdopen(), the
deraadt [Sat, 21 May 2022 13:54:19 +0000 (13:54 +0000)]
Repair a leak of a FILE.  The FILE contains a fd via fdopen(), the
handling of the fd is correct, so this temporary fdopen now must use
a dup() so we can fclose().
ok otto

2 years agoRemove some unhelpful comments and spell NULL correctly.
jsing [Sat, 21 May 2022 13:21:42 +0000 (13:21 +0000)]
Remove some unhelpful comments and spell NULL correctly.

2 years agoFactor out ASN1_ITYPE_EXTERN handling.
jsing [Sat, 21 May 2022 13:16:19 +0000 (13:16 +0000)]
Factor out ASN1_ITYPE_EXTERN handling.

Factor out the ef->asn1_ex_d2i() callback handling - this allows us to pull
out all of the related variables into a self-contained function.

ok tb@

2 years ago${rcexec} -> rc_exec
ajacoutot [Sat, 21 May 2022 12:42:21 +0000 (12:42 +0000)]
${rcexec} -> rc_exec

2 years agoUse 'at' for ASN1_TEMPLATE variable names rather than 'tt'.
jsing [Sat, 21 May 2022 11:21:31 +0000 (11:21 +0000)]
Use 'at' for ASN1_TEMPLATE variable names rather than 'tt'.

Also use array indexes for it->templates, rather than trying to be extra
clever in for loops (suggested by tb@ during a review).

No functional change.

ok tb@

2 years agoRemove _ex_ from all of the internal function names.
jsing [Sat, 21 May 2022 11:12:03 +0000 (11:12 +0000)]
Remove _ex_ from all of the internal function names.

It no longer makes sense to have "extended" versions of functions
internally.

No functional change.

ok tb@

2 years agoReplace the $rcexec variable by an rc_exec function.
ajacoutot [Sat, 21 May 2022 10:50:09 +0000 (10:50 +0000)]
Replace the $rcexec variable by an rc_exec function.
It is much cleaner to the eyes and makes more sense from a functionnal point of
view.
This will allow to extend rc_exec with other functionnalities (like upcoming
rc_startdir).
Bonus point: daemon_logger will now work with manually crafted rc_start
functions.

This will require a mechanical change from ${rcexec} to rc_exec in rc.d scripts.
ports will be fixed right after this commit but we will keep compatibility to
give a chance to people to fix their custom scripts.

positive tests from a few
ok robert@

2 years agoNo need for true(1).
ajacoutot [Sat, 21 May 2022 10:10:45 +0000 (10:10 +0000)]
No need for true(1).

2 years agorepair a few more backwards compares that create headaches
deraadt [Sat, 21 May 2022 01:21:29 +0000 (01:21 +0000)]
repair a few more backwards compares that create headaches
ok millert

2 years agosystem(3) should ignore SIGINT and SIGQUIT until the shell exits.
millert [Sat, 21 May 2022 00:53:53 +0000 (00:53 +0000)]
system(3) should ignore SIGINT and SIGQUIT until the shell exits.
This got broken when system.c was converted from signal(3) to sigaction(2).
Also add SIGINT and SIGQUIT to the set of blocked signals and unblock
them in the parent after the signal handlers are installed.
Based on a diff from Leon Fischer.  OK deraadt@

2 years agovmm: remove spinout paranoia
dv [Fri, 20 May 2022 22:42:09 +0000 (22:42 +0000)]
vmm: remove spinout paranoia

Move all the spinout counters for ipis (enable/disable vmm, remote
vmcs clear) behind MP_LOCKDEBUG.

All three areas (vmm_start, vmm_stop, vmx_remote_vmclear) migrate
to infinite busy waits.

tested by and ok mlarkin@

2 years agovmm: load the vmcs before reading vcpu registers
dv [Fri, 20 May 2022 22:14:19 +0000 (22:14 +0000)]
vmm: load the vmcs before reading vcpu registers

The vmm(4) ioctl for reading a vcpu's registers didn't flush and
load the vmcs before issuing vmread instructions. This adds a flag
to vcpu_readregs_vmx to signal if the vmcs needs to be synchronized
before attempting the reads. (This is the same approach used for
vcpu_writeregs_vmx function.)

This fixes `vmctl send` on Intel hosts using vmd(8).

While here, I noticed the vcpu_writeregs_vmx function doesn't
properly set the vmcs state variable to VMCS_CLEARED after running
a vmclear instruction. This can cause errors on vm re-entry.

ok mlarkin@

2 years agouse correct logging or error calls
dv [Fri, 20 May 2022 22:06:47 +0000 (22:06 +0000)]
use correct logging or error calls

ftruncate sets errno, so use fatal() and not fatalx().

Checking for under-reads of read(2) isn't going to set errno so
use errx().

ok abieber@

2 years agoas promised, extend the precaching using quirks stems extension.
espie [Fri, 20 May 2022 20:31:38 +0000 (20:31 +0000)]
as promised, extend the precaching using quirks stems extension.

(as it happens, some py-sip thingy got the treatment so I could test
that the code does something) !

2 years agoAdd expected failures for octeon and riscv64.
mbuhl [Fri, 20 May 2022 20:08:43 +0000 (20:08 +0000)]
Add expected failures for octeon and riscv64.

2 years agoRe-classify the roff(7) \r (reverse line feed) escape sequence
schwarze [Fri, 20 May 2022 13:06:26 +0000 (13:06 +0000)]
Re-classify the roff(7) \r (reverse line feed) escape sequence
from "ignore" to "unsupported" because when an input file uses it,
mandoc(1) is likely to significantly misformat the output,
usually showing parts of the output in a different order
than the author intended.

2 years agoTest the handling of some additional one-character escape sequences
schwarze [Fri, 20 May 2022 12:30:33 +0000 (12:30 +0000)]
Test the handling of some additional one-character escape sequences
that take no argument and are ignored: \% \& \^ \a \d \t \u \{ \| \}
No change to parsing or formatting needed.

2 years agofold some of the useful "obsolete" information into the main text
espie [Fri, 20 May 2022 10:39:24 +0000 (10:39 +0000)]
fold some of the useful "obsolete" information into the main text

2 years agoAdd RFC 7318
job [Fri, 20 May 2022 10:38:39 +0000 (10:38 +0000)]
Add RFC 7318

2 years agoNew ldapsearch does not support -h and -p for host and port, but
bluhm [Fri, 20 May 2022 09:46:47 +0000 (09:46 +0000)]
New ldapsearch does not support -h and -p for host and port, but
accepts -H ldapuri.  Use startup and cleanup framework.  Pidfile
does not work anymore, use pkill ldapd.  Delete deactivated and
failing cpan test.

2 years agoDrop *out == NULL check in ASN1_STRING_to_UTF8()
tb [Fri, 20 May 2022 08:04:21 +0000 (08:04 +0000)]
Drop *out == NULL check in ASN1_STRING_to_UTF8()

Unfortunately, several things in the ecosystem depend on the existing
API behavior of being able to pass in an uninitialized pointer on the
stack: haproxy, grpc, mongo-tools and others show up on the first two
pages of Debian codesearch.

ok jsing

2 years agoDon't pass uninitialized pointer to ASN1_STRING_to_UTF8()
tb [Fri, 20 May 2022 08:00:05 +0000 (08:00 +0000)]
Don't pass uninitialized pointer to ASN1_STRING_to_UTF8()

Exposed by recent rewrite of ASN1_STRING_to_UTF8(). Found via grep
after fixing CID 352831.

ok jsing

2 years agoDon't pass uninitialized pointer to ASN1_STRING_to_UTF8()
tb [Fri, 20 May 2022 07:58:54 +0000 (07:58 +0000)]
Don't pass uninitialized pointer to ASN1_STRING_to_UTF8()

Exposed by recent rewrite of ASN1_STRING_to_UTF8().

CID 352831

ok jsing

2 years agoRename hid_none to hid_all as it represents all possible hid kinds by
anton [Fri, 20 May 2022 05:03:45 +0000 (05:03 +0000)]
Rename hid_none to hid_all as it represents all possible hid kinds by
now.

2 years agouhid_maxrepid() is currently not able to observe all report IDs as it
anton [Fri, 20 May 2022 05:02:47 +0000 (05:02 +0000)]
uhid_maxrepid() is currently not able to observe all report IDs as it
passes hid_none as the wanted hid kind to hid_start_parse(). This
becomes a problem for descriptors with multiple report IDs per
collection. Therefore change the semantics of the hid_none kind to let
it represents all possible kinds.

Gets rid of "uhidev_intr: bad repid" console spam as reported by sthen@
on bugs@.

Have been in snaps for a week.

2 years agoReorder functions within file.
jsing [Thu, 19 May 2022 19:45:18 +0000 (19:45 +0000)]
Reorder functions within file.

Order functions by use, moving public API to the bottom and utility
functions to the top. This makes the code more logical/readable, plus we
can remove all except one of the static function prototypes.

No functional change.

2 years agoRewrite the asn1_template_*() functions with CBS.
jsing [Thu, 19 May 2022 19:31:39 +0000 (19:31 +0000)]
Rewrite the asn1_template_*() functions with CBS.

Rewrite the asn1_template_*() functions with CBS, readable variable names
and free then alloc.

This was the last caller of asn1_check_eoc() and asn1_check_tag(), hence
remove them and rename the _cbs suffixed versions in their place.

ok tb@

2 years agofollowing the fixed parsing direction of roff_expand() in roff.c rev. 1.260,
schwarze [Thu, 19 May 2022 16:15:35 +0000 (16:15 +0000)]
following the fixed parsing direction of roff_expand() in roff.c rev. 1.260,
some diagnostics now appear in a more reasonable order, too

2 years agoAdjust a column number in an error message
schwarze [Thu, 19 May 2022 16:07:02 +0000 (16:07 +0000)]
Adjust a column number in an error message
after the roff_expand() reorganization in roff.c rev. 1.260.

The new parsing direction has two effects:
1. Correct output when a line contains more than one expanding
escape sequence that has a side effect.
2. Column numbers in diagnostic messages now report the changed
column numbers after any expansions left of them have taken place;
in the past, column numbers refered to the original input line.

Arguably, item 2 was a bit better in its old state, but slightly
less helpful diagnostics are a small price to pay for correct
output.  Besides, when the expansion of user-defined strings or
macros is involved, in many cases, mandoc(1) is already unable to
report meaningful line and column numbers, so item 2 is not a
noteworthy regression.  The effort and code complication for fixing
that would probably be excessive, in particular since well-written
manual pages are not supposed to use such features in the first place.

2 years agofix a wrong column number that got fixed as a side effect
schwarze [Thu, 19 May 2022 15:42:14 +0000 (15:42 +0000)]
fix a wrong column number that got fixed as a side effect
of the roff_expand() reorganization in roff.c rev. 1.260

2 years agoremove a bogus warning that went away as a side effect
schwarze [Thu, 19 May 2022 15:33:54 +0000 (15:33 +0000)]
remove a bogus warning that went away as a side effect
of the roff_expand() reorganization in roff.c rev. 1.260

2 years agoMake roff_expand() parse left-to-right rather than right-to-left.
schwarze [Thu, 19 May 2022 15:17:50 +0000 (15:17 +0000)]
Make roff_expand() parse left-to-right rather than right-to-left.
Some escape sequences have side effects on global state, implying
that the order of evaluation matters.  For example, this fixes the
long-standing bug that "\n+x\n+x\n+x" after ".nr x 0 1" used to
print "321"; now it correctly prints "123".

Right-to-left parsing was convenient because it implicitly handled
nested escape sequences.  With correct left-to-right parsing, nesting
now requires an explicit implementation, here solved as follows:
1. Handle nested expanding escape sequences iteratively.
When finding one, expand it, then retry parsing the enclosing escape
sequence from the beginning, which will ultimately succeed as soon
as it no longer contains any nested expanding escape sequences.
2. Handle nested non-expanding escape sequences recursively.
When finding one, the escape sequence parser calls itself to find
the end of the inner sequence, then continues parsing the outer
sequence after that point.

This requires the mandoc_escape() function to operate in two different
modes.  The roff(7) parser uses it in a mode where it generates
diagnostics and may return an expansion request instead of a parse
result.  All other callers, in particular the formatters, use it
in a simpler mode that never generates diagnostics and always returns
a definite parsing result, but that requires all expanding escape
sequences to already have been expanded earlier.  The bulk of the
code is the same for both modes.
Since this required a major rewrite of the function anyway, move
it into its own new file roff_escape.c and out of the file mandoc.c,
which was misnamed in the first place and lacks a clear focus.

As a side benefit, this also fixes a number of assertion failures
that tb@ found with afl(1), for example "\n\\\\*0", "\v\-\\*0",
and "\w\-\\\\\$0*0".

As another side benefit, it also resolves some code duplication
between mandoc_escape() and roff_expand() and centralizes all
handling of escape sequences (except for expansion) in roff_escape.c,
hopefully easing maintenance and feature improvements in the future.

While here, also move end-of-input handling out of the complicated
function roff_expand() and into the simpler function roff_parse_comment(),
making the logic easier to understand.

Since this is a major reorganization of a central component of
mandoc(1), stability of the program might slightly suffer for a few
weeks, but i believe that's not a problem at this point of the
release cycle.  The new code already satisfies the regression suite,
but more tweaking and regression testing to further improve the
handling of various escape sequences will likely follow in the near
future.

2 years agoimprove a comment explaining a particularly nasty hack; no code change
schwarze [Thu, 19 May 2022 14:47:47 +0000 (14:47 +0000)]
improve a comment explaining a particularly nasty hack; no code change

2 years agoRemove unused macro (log_debuginfo)
claudio [Thu, 19 May 2022 13:12:35 +0000 (13:12 +0000)]
Remove unused macro (log_debuginfo)

2 years agoNow MULTIPROCESSOR kernel boots with CPU modules installed in
aoyama [Thu, 19 May 2022 12:55:59 +0000 (12:55 +0000)]
Now MULTIPROCESSOR kernel boots with CPU modules installed in
arbitrary slots.

Plamen Mihaylov's LUNA-88K2 originally has 2 CPU modules in slot #0
and #2, but MULTIPROCESSOR kernel panics because they are not placed
in contiguous slots.  This diff fixes it.

Original diff from miod@, tested by Plamen Mihaylov and me.

2 years agodocument what this file stands for
espie [Thu, 19 May 2022 09:20:31 +0000 (09:20 +0000)]
document what this file stands for

2 years agoDocument that imsg_add(3) frees its msg argument on failure.
stsp [Thu, 19 May 2022 08:05:23 +0000 (08:05 +0000)]
Document that imsg_add(3) frees its msg argument on failure.

ok op@ claudio@

2 years agoAdjust or remove some stale comments
tb [Thu, 19 May 2022 07:33:02 +0000 (07:33 +0000)]
Adjust or remove some stale comments

2 years agoAdd missing space between No macro and "authority".
tb [Thu, 19 May 2022 07:04:41 +0000 (07:04 +0000)]
Add missing space between No macro and "authority".

2 years agoDeal with STACK_OF divergence between LibreSSL and OpenSSL
tb [Thu, 19 May 2022 06:39:21 +0000 (06:39 +0000)]
Deal with STACK_OF divergence between LibreSSL and OpenSSL

2 years agoRewrite mft.c and roa.c with ASN.1 templates
tb [Thu, 19 May 2022 06:37:51 +0000 (06:37 +0000)]
Rewrite mft.c and roa.c with ASN.1 templates

The ASN.1 templates are a rather direct translation of the ASN.1 in the
relevant RFCs and they allow deserializing the Manifest and ROA eContent
in a single step instead of numerous opaque d2i_ASN1_SEQUENCE_ANY() calls.
Once the eContent is deserialized, we can walk the structs, validate it
as before and populate the internal data structures.

Positive feedback job
ok claudio

2 years agoNot so recent evolution of the PowerPC and POWER architectures have defined
miod [Thu, 19 May 2022 05:43:48 +0000 (05:43 +0000)]
Not so recent evolution of the PowerPC and POWER architectures have defined
exception addresses past EXC_LAST, making its definition wrong.

Replace it with EXC_END, which points to the end of hardware exception
addresses, and adjust logic accordingly.

ok kettenis@

2 years agoRevert "drm/amd/pm: keep the BACO feature enabled for suspend"
jsg [Thu, 19 May 2022 04:09:36 +0000 (04:09 +0000)]
Revert "drm/amd/pm: keep the BACO feature enabled for suspend"

From Alex Deucher
0fad10b263a33492107d62caa460d5e4c717ce29 in linux 5.15.y/5.15.41
a56f445f807b0276fc0660c330bf93a9ea78e8ea in mainline linux

2 years agoForce maximum payload size to 128 bytes for AR816X/AR817x as it triggers
kevlo [Thu, 19 May 2022 00:52:37 +0000 (00:52 +0000)]
Force maximum payload size to 128 bytes for AR816X/AR817x as it triggers
dma write error rendering the network unusable.

Bug reported and patch tested by Scott C. MacCallum.

2 years agodocument what PLIST_REPOSITORY does a bit better
espie [Wed, 18 May 2022 10:04:47 +0000 (10:04 +0000)]
document what PLIST_REPOSITORY does a bit better

2 years agoRemove #ifdef DDB specific includes, added in 1.968 but related code bits
miod [Wed, 18 May 2022 06:02:33 +0000 (06:02 +0000)]
Remove #ifdef DDB specific includes, added in 1.968 but related code bits
removed in 1.970.

ok bluhm@

2 years agoRefactor asn1_d2i_ex_primitive()
jsing [Tue, 17 May 2022 19:09:16 +0000 (19:09 +0000)]
Refactor asn1_d2i_ex_primitive()

Split the object content handling off into asn1_d2i_ex_primitive_content(),
move the handling ov V_ASN1_ANY into asn1_d2i_ex_any() and move the MSTRING
handling into asn1_d2i_ex_mstring(). This way we parse the header once
(rather than twice for ANY and MSTRING), then process the content, while
also avoiding complex special cases in a single code path.

ok tb@

2 years agodocument /etc/login.conf.d/
jmc [Tue, 17 May 2022 16:50:30 +0000 (16:50 +0000)]
document /etc/login.conf.d/
help robert ajacoutot

ok ajacoutot

2 years agoditch most of the obsolete stuff
espie [Tue, 17 May 2022 15:18:43 +0000 (15:18 +0000)]
ditch most of the obsolete stuff
there are still a few odds and ends which should make their way to the
rest of the manpage eventually (or to the faq), useful information that's
not immediately available elsewhere

2 years agoMove towards OpenIKED 7.1
tobhe [Tue, 17 May 2022 14:49:22 +0000 (14:49 +0000)]
Move towards OpenIKED 7.1

2 years agoRefactor ASN.1 template functions before rewriting.
jsing [Tue, 17 May 2022 12:23:52 +0000 (12:23 +0000)]
Refactor ASN.1 template functions before rewriting.

Change asn1_template_ex_d2i() so that we short circuit in the no explicit
tagging case.

Split out the SET OF/SEQUENCE OF handling from asn1_template_noexp_d2i()
into a asn1_template_stack_of_d2i() function and simplify the remaining
code.

ok tb@

2 years agoUse a higher match priority such that mvclock(4) wins from syscon(4).
kettenis [Tue, 17 May 2022 10:09:40 +0000 (10:09 +0000)]
Use a higher match priority such that mvclock(4) wins from syscon(4).

ok patrick@, dtucker@

2 years agoExpose asn1_abs_set_unused_bits() in asn1_locl.h
tb [Tue, 17 May 2022 09:17:20 +0000 (09:17 +0000)]
Expose asn1_abs_set_unused_bits() in asn1_locl.h

Should have been part of a previous commit.

ok jsing

2 years agoRewrite make_addressRange() using CBS
tb [Tue, 17 May 2022 08:00:51 +0000 (08:00 +0000)]
Rewrite make_addressRange() using CBS

Factor the trimming of the end and the counting of unused bits into
helper functions and reuse an ASN.1 bit string API to set the unused
bits and the ASN1_STRING_FLAG_BITS_SET. With a couple of explanatory
comments it becomes much clearer what the code is actually doing and
why.

ok jsing

2 years agoSimplify make_addressPrefix()
tb [Tue, 17 May 2022 07:50:59 +0000 (07:50 +0000)]
Simplify make_addressPrefix()

In order to set the BIT STRING containing an address prefix, use existing
helper functions from the ASN.1 code instead of redoing everything by
hand. Make the function single exit and rename a few variables to make
it clearer what is being done.

ok jsing