openbsd
2 years agoMove some MI pieces out of suspend_mp/resume_mp
deraadt [Sun, 13 Feb 2022 15:56:55 +0000 (15:56 +0000)]
Move some MI pieces out of suspend_mp/resume_mp
ok kettenis

2 years agoThe Apple M1 SoC has two mechanism for doing IPIs. The first method uses
kettenis [Sun, 13 Feb 2022 15:54:07 +0000 (15:54 +0000)]
The Apple M1 SoC has two mechanism for doing IPIs.  The first method uses
the interrupt controller, the second method used implementation-specific
CPU registers.  The M1 Pro/Max SoCs use a modified interrupt controller
that no longer provides the first method.  So switch to the second method
in preparation for adding M1 Pro/Max support to OpenBSD.  As a bonus this
mechanism seems to be faster (which may be why Apple calls these "fast"
IPIs).

ok patrick@

2 years agoUse knote_modify() and knote_process() in obvious places.
visa [Sun, 13 Feb 2022 13:05:51 +0000 (13:05 +0000)]
Use knote_modify() and knote_process() in obvious places.

2 years agoAdd helper functions for f_modify and f_process to condense code
visa [Sun, 13 Feb 2022 13:03:02 +0000 (13:03 +0000)]
Add helper functions for f_modify and f_process to condense code

These new functions, knote_modify() and knote_process(), implement
the logic that is common to most f_modify and f_process instances.

The code is inlined so as to not add yet another call frame on the
already towering stack of kqueue functions. Also, the _fn versions
allow direct calling of an event function when there is only one
filter type to handle.

2 years agoRename knote_modify() to knote_assign()
visa [Sun, 13 Feb 2022 12:58:46 +0000 (12:58 +0000)]
Rename knote_modify() to knote_assign()

This avoids verb overlap with f_modify.

2 years agoSKEEYSEED -> SKEYSEED
mbuhl [Sun, 13 Feb 2022 12:26:54 +0000 (12:26 +0000)]
SKEEYSEED -> SKEYSEED

2 years agoSome PCIe devices on the M1 and M1 Pro/Max need to be explicitly powered on
kettenis [Sun, 13 Feb 2022 12:02:21 +0000 (12:02 +0000)]
Some PCIe devices on the M1 and M1 Pro/Max need to be explicitly powered on
(most notably the WiFi chip).  This is done through a GPIO controlled by
the SMC.  Add support for this and make sure we wait for the 100ms required
by the PCIe standard when we use that GPIO to turn on power.  This makes sure
these devices are available even if U-Boot doesn't turn them on for us.

ok patrick@

2 years agoAdd basic GPIO support.
kettenis [Sun, 13 Feb 2022 11:58:53 +0000 (11:58 +0000)]
Add basic GPIO support.

ok patrick@

2 years agoAdd /usr/local/share/examples/login.conf.d to the default hierarchy.
ajacoutot [Sun, 13 Feb 2022 00:02:16 +0000 (00:02 +0000)]
Add /usr/local/share/examples/login.conf.d to the default hierarchy.

ok sthen@ espie@ deraadt@

2 years agouse new libtls signer api
eric [Sat, 12 Feb 2022 18:22:04 +0000 (18:22 +0000)]
use new libtls signer api

ok tb@

2 years agowsdisplay checks are no longer needed here
deraadt [Sat, 12 Feb 2022 16:26:57 +0000 (16:26 +0000)]
wsdisplay checks are no longer needed here

2 years agowsdisplay checks are no longer needed here
deraadt [Sat, 12 Feb 2022 16:25:42 +0000 (16:25 +0000)]
wsdisplay checks are no longer needed here

2 years agoadd MP stubs
deraadt [Sat, 12 Feb 2022 16:22:40 +0000 (16:22 +0000)]
add MP stubs

2 years agofor non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef
deraadt [Sat, 12 Feb 2022 16:22:03 +0000 (16:22 +0000)]
for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef

2 years agoReduce code duplication in pipe event filters
visa [Sat, 12 Feb 2022 14:07:26 +0000 (14:07 +0000)]
Reduce code duplication in pipe event filters

Use the f_event callback for checking event state within the pipe
event filters. This enables the same f_modify and f_process functions
to handle the different filter types.

OK anton@

2 years agoAdd test coverage for OBJ_txt2obj()/OBJ_obj2txt() with no_name == 0.
jsing [Sat, 12 Feb 2022 12:42:19 +0000 (12:42 +0000)]
Add test coverage for OBJ_txt2obj()/OBJ_obj2txt() with no_name == 0.

2 years agoswitch to using the common code in BaseState
espie [Sat, 12 Feb 2022 09:46:19 +0000 (09:46 +0000)]
switch to using the common code in BaseState

(BaseState is a "light weight" base class for State, that does the
common stuff like printing out stuff pkg-style, or exec'ing commands
and reporting exit/signal status, but without needing to create an
object--necessarily--or without the extra option handling code.

2 years agoAvoid potential single byte overread in asn1_parse2().
jsing [Sat, 12 Feb 2022 03:07:24 +0000 (03:07 +0000)]
Avoid potential single byte overread in asn1_parse2().

A fix for this was previously commited in r1.32, however while this added
a bounds check the logic means we still fall through and perform the
overread. Fix the logic such that we only log the error if the bounds check
fails. While here, flip the test around such that we check for validity then
print (which is more readable and matches earlier code).

ok inoguchi@ tb@

2 years agoRevise for OBJ_obj2txt() OID arc limits.
jsing [Sat, 12 Feb 2022 03:02:47 +0000 (03:02 +0000)]
Revise for OBJ_obj2txt() OID arc limits.

2 years agoLimit OID text conversion to 64 bits per arc.
jsing [Sat, 12 Feb 2022 03:01:59 +0000 (03:01 +0000)]
Limit OID text conversion to 64 bits per arc.

The current implementation uses an unsigned long, then switches to BN once
the arc exceeds its size. However, the complexity of BN_bn2dec() is
quadratic in the length of number being converted. This means that OIDs
with excessively large arcs take a lot of computation to convert to text.

While the X.660 specification states that arcs are unbounded, in reality
they are not overly large numbers - 640K^W64 bits ought to be enough for
any arc. Remove BN entirely, switch from unsigned long to uin64_t and fail
if an arc exceeds this size.

Identified via oss-fuzz timeouts - should fix #41028 and #44372.

ok tb@

2 years agoFix length check of IP addresses for name constraints
tb [Fri, 11 Feb 2022 17:41:55 +0000 (17:41 +0000)]
Fix length check of IP addresses for name constraints

An IP address in a name constraint is actually an IP address concatenated
with a netmask, so it is twice as long as usual.

This fixes a third bug introduced in r1.3 and reported by Volker Schlecht

ok jsing

2 years agoAdd missing error check for a2i_GENERAL_NAME()
tb [Fri, 11 Feb 2022 17:39:36 +0000 (17:39 +0000)]
Add missing error check for a2i_GENERAL_NAME()

Fixes a segfault reported by Volker Schlecht.

ok jsing

2 years agoFix a double free in v2i_NAME_CONSTRAINTS()
tb [Fri, 11 Feb 2022 17:37:54 +0000 (17:37 +0000)]
Fix a double free in v2i_NAME_CONSTRAINTS()

a2i_GENERAL_NAME() modifies and returns the out argument that was
passed in unless out == NULL, in which case it returns something
freshly allocated. Thus, in v2i_GENERAL_NAME_ex() we must only free
ret if out == NULL so v2i_NAME_CONSTRAINTS() can free correctly.

Issue reported by Volker Schlecht

ok jsing

2 years agoadjust bsd.port.mk(5) manual for change to login.conf.d file handling
sthen [Fri, 11 Feb 2022 17:19:59 +0000 (17:19 +0000)]
adjust bsd.port.mk(5) manual for change to login.conf.d file handling

2 years agospace needed between arg and punctuation;
jmc [Fri, 11 Feb 2022 17:09:39 +0000 (17:09 +0000)]
space needed between arg and punctuation;

2 years agoTest OBJ_obj2nid() with an undefined (NID_undef) object.
jsing [Fri, 11 Feb 2022 16:39:50 +0000 (16:39 +0000)]
Test OBJ_obj2nid() with an undefined (NID_undef) object.

2 years agoMake OBJ_obj2nid() work correctly with NID_undef.
jsing [Fri, 11 Feb 2022 16:39:16 +0000 (16:39 +0000)]
Make OBJ_obj2nid() work correctly with NID_undef.

Currently OBJ_obj2nid() with NID_undef returns NID_ccitt - this is due to
doing a lookup on an empty value and having NID_undef conflict with an
uninitialised NID value.

Somewhat based on OpenSSL 0fb99904809.

ok tb@

2 years agoAdd initial regress for objects.
jsing [Fri, 11 Feb 2022 16:34:23 +0000 (16:34 +0000)]
Add initial regress for objects.

2 years agotr(1): rename lookup tables
cheloha [Fri, 11 Feb 2022 16:09:21 +0000 (16:09 +0000)]
tr(1): rename lookup tables

The lookup tables in tr(1) are called "string1" and "string2".  This is
misleading:

- They aren't C strings, they are lookup tables.

- The names "string1" and "string2" don't hint at what their contents
  actually mean.  The meaning of a given table changes with tr(1)'s
  operating mode.  There are five different modes.

It would be considerably easier to see what is happening at a glance
if the tables were named for their corresponding byte transformation.

So instead of two tables named "string1" and "string2" we'll have
three tables named "delete", "squeeze", and "translate".  In addition,
the "string" passed to the setup() function will be called a "table".

With this patch the code in main() is way easier to understand.
Hopefully this makes subsequent patches easier to review.

Thread: https://marc.info/?l=openbsd-tech&m=164355980600901&w=2

No complaints on tech@ after over a week.

2 years agobe more consistent in packing-list usage
espie [Fri, 11 Feb 2022 15:49:25 +0000 (15:49 +0000)]
be more consistent in packing-list usage

remove a bunch of stuff that's redundant with update-plist(1) in the
update-plist target description, but instead also points at SUBST_VARS
for the default handling of substituted variables by update-plist.

2 years agouse packing-list consistently
espie [Fri, 11 Feb 2022 15:36:40 +0000 (15:36 +0000)]
use packing-list consistently

2 years agoFix typo in comment for f_favail.
millert [Fri, 11 Feb 2022 15:11:35 +0000 (15:11 +0000)]
Fix typo in comment for f_favail.
From Alf Schlichting

2 years agoIt's fw_update's job to say what went wrong.
florian [Fri, 11 Feb 2022 12:58:18 +0000 (12:58 +0000)]
It's fw_update's job to say what went wrong.
input jca
OK kmos sthen deraadt kn

2 years agodescribe LOGIN_CONF, help from espie
sthen [Fri, 11 Feb 2022 12:42:24 +0000 (12:42 +0000)]
describe LOGIN_CONF, help from espie

2 years agoBackout previous "Unwire with map lock held" (commitid: eQBvWUwShD91dN9Z)
kn [Fri, 11 Feb 2022 12:06:48 +0000 (12:06 +0000)]
Backout previous "Unwire with map lock held" (commitid: eQBvWUwShD91dN9Z)

WITNESS builds broke^W^Wkernels panic on boot as reported by anton and bluhm.
Booting bsd.mp in single-user mode inside VMM shows:

root on sd0a (5f9e458ed30b39ab.a) swap on sd0b dump on sd0b
Enter pathname of shell or RETURN for sh:
witness: lock order reversal:
 1st 0xfffffd801f8ce468 vmmaplk (&map->lock)
 2nd 0xfffffd801b8162c0 inode (&ip->i_lock)
lock order "&ip->i_lock"(rrwlock) -> "&map->lock"(rwlock) first seen at:
#0  rw_enter_read+0x38
#1  uvmfault_lookup+0x8a
#2  uvm_fault_check+0x32
#3  uvm_fault+0xfb
#4  kpageflttrap+0x12c
#5  kerntrap+0x91
#6  alltraps_kern_meltdown+0x7b
#7  copyout+0x53
#8  ffs_read+0x1f6
#9  VOP_READ+0x41
#10 vn_rdwr+0xa1
#11 vmcmd_map_readvn+0xa0
#12 exec_process_vmcmds+0x88
#13 sys_execve+0x732
#14 start_init+0x26f
#15 proc_trampoline+0x1c
lock order data w1 -> w2 missing
# exit
kernel: protection fault trap, code=0
Stopped at      witness_checkorder+0x312:       movl    0x10(%r14),%ecx

gkoehler reported faults on poisened addresses on macppc dual G5.

2 years agoBackout previous "Assert vm map locks" (commitid: sRNBfzX2dJrxFDmb)
kn [Fri, 11 Feb 2022 09:25:04 +0000 (09:25 +0000)]
Backout previous "Assert vm map locks" (commitid: sRNBfzX2dJrxFDmb)

WITNESS builds broke as reported by anton and bluhm:

root on sd0a (5ec49b3ad23eb2d4.a) swap on sd0b dump on sd0b
kernel: protection fault trap, code=0
Stopped at      witness_checkorder+0x4ec:       movl    0x10(%r12),%ecx

https://syzkaller.appspot.com/bug?id=be02b290a93c648986c35370a271aad4135a5044
https://syzkaller.appspot.com/text?tag=CrashLog&x=136e9aa4700000

2 years agoReplace manual !klist_empty()+knote() with KNOTE().
visa [Fri, 11 Feb 2022 07:28:29 +0000 (07:28 +0000)]
Replace manual !klist_empty()+knote() with KNOTE().

OK mpi@

2 years agoCheck klist emptiness instead of NULL pointer in KNOTE()
visa [Fri, 11 Feb 2022 07:27:07 +0000 (07:27 +0000)]
Check klist emptiness instead of NULL pointer in KNOTE()

All callers of KNOTE() supply a non-NULL klist argument. Replace the
NULL pointer check with klist emptiness check as a small optimization.

OK mpi@

2 years agoInline klist_empty() for more economic machine code.
visa [Fri, 11 Feb 2022 07:25:50 +0000 (07:25 +0000)]
Inline klist_empty() for more economic machine code.

OK mpi@

2 years agothe sleep_clocks() hook is not needed because the architectures which
deraadt [Fri, 11 Feb 2022 01:55:12 +0000 (01:55 +0000)]
the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook

2 years agoLock the pkg db while running
afresh1 [Fri, 11 Feb 2022 00:46:58 +0000 (00:46 +0000)]
Lock the pkg db while running

At least when not running in the installer.

Suggestions from espie@
Works for me sthen@
fine deraadt@

2 years agoAlways initialize delim before passing to hpdelim2 which might not set it.
dtucker [Fri, 11 Feb 2022 00:43:56 +0000 (00:43 +0000)]
Always initialize delim before passing to hpdelim2 which might not set it.
Found by the Valgrind tests on github, ok deraadt@

2 years agosleep_cpu/resume_cpu are part of an earlier MI split attempt
deraadt [Fri, 11 Feb 2022 00:43:27 +0000 (00:43 +0000)]
sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis

2 years agoCasting a char pointer to struct ctf_header causes bus error on
bluhm [Thu, 10 Feb 2022 23:40:09 +0000 (23:40 +0000)]
Casting a char pointer to struct ctf_header causes bus error on
sparc64.  Use memcpy() to align the data.
found by regress/usr.bin/ctfdump; OK mpi@

2 years agoUse fdisk's -b to create boot partitions instead of -e scripts.
krw [Thu, 10 Feb 2022 20:07:47 +0000 (20:07 +0000)]
Use fdisk's -b to create boot partitions instead of -e scripts.

Build, boot and install tested by bluhm@

ok bluhm@

2 years agoFix regress after crl_print() addition so anton doesn't have to complain
tb [Thu, 10 Feb 2022 19:16:44 +0000 (19:16 +0000)]
Fix regress after crl_print() addition so anton doesn't have to complain
tomorrow morning

2 years agoImprove free inodes check from fs.f_favail > 0 to fs.f_free > 0.
tb [Thu, 10 Feb 2022 18:58:46 +0000 (18:58 +0000)]
Improve free inodes check from fs.f_favail > 0 to fs.f_free > 0.

suggested by millert

2 years agosync
deraadt [Thu, 10 Feb 2022 17:58:31 +0000 (17:58 +0000)]
sync

2 years agoFix serial number printing in crl_print() for large serials.
claudio [Thu, 10 Feb 2022 17:33:28 +0000 (17:33 +0000)]
Fix serial number printing in crl_print() for large serials.
Create a common x509_convert_seqnum() function to convert the various
ASN1_INTEGERs into hexnumbers and use this for mft and crl handling.
With and OK tb@, also OK job@

2 years agolook for the login class in both login.conf and login.conf.d/${class}
robert [Thu, 10 Feb 2022 16:57:33 +0000 (16:57 +0000)]
look for the login class in both login.conf and login.conf.d/${class}

ok aja@

2 years agoDuplicate "park disk" code, so that the SUSPEND case can be MI, it is only
deraadt [Thu, 10 Feb 2022 16:41:51 +0000 (16:41 +0000)]
Duplicate "park disk" code, so that the SUSPEND case can be MI, it is only
HIBERNATE that needs to be in MD code.
ok gkoehler

2 years agoEnable receive checksum offloading on ixl(4) network interfaces.
bluhm [Thu, 10 Feb 2022 16:22:00 +0000 (16:22 +0000)]
Enable receive checksum offloading on ixl(4) network interfaces.
from jan@; test and OK dlg@

2 years agoImplement some code to print crls with -f.
claudio [Thu, 10 Feb 2022 15:33:47 +0000 (15:33 +0000)]
Implement some code to print crls with -f.
For this introduce x509_get_time() that converts a ASN1_TIME to time_t.
Also move time2str() to print.c where it makes more sense.
This needs more work but that will happen in tree.
OK tb@

2 years agoUse fdisk's -b to create boot partitions instead of -e scripts.
krw [Thu, 10 Feb 2022 15:12:57 +0000 (15:12 +0000)]
Use fdisk's -b to create boot partitions instead of -e scripts.

Build, boot and install tested by bluhm@

ok bluhm@

2 years agoDo not verify the cert or CA for a relay using opportunistic TLS.
millert [Thu, 10 Feb 2022 14:59:35 +0000 (14:59 +0000)]
Do not verify the cert or CA for a relay using opportunistic TLS.
If a relay is not explicitly configured to use TLS but the remote
side supports STARTTLS, we will try to use it.  However, in this
case we should not verify the cert or CA (which may be self-signed).
This restores the relay behavior before the switch to libtls was made.
There is no change if the relay is explicitly configured to use TLS.
OK eric@

2 years agolook(1): use a stricter pledge(2) in lieu of unveil(2)
cheloha [Thu, 10 Feb 2022 14:55:43 +0000 (14:55 +0000)]
look(1): use a stricter pledge(2) in lieu of unveil(2)

We're only reading one file here, so unveil(2) is overkill.  We can
achieve the same effect with just pledge(2):

- Start with an initial pledge(2) of "stdio rpath" at the top of main().
  We know we need to read a file at this point but don't yet know which
  one.

- Drop the pledge(2) down to "stdio" after we open(2) and fstat(2) the
  chosen file.

- Dropping "rpath" obviates unveil(2).

Thread: https://marc.info/?l=openbsd-tech&m=164437072017248&w=2

ok millert@

2 years agoUpdate Devel::PPPort in base from version 3.57 to 3.64. Our clang
bluhm [Thu, 10 Feb 2022 14:37:42 +0000 (14:37 +0000)]
Update Devel::PPPort in base from version 3.57 to 3.64.  Our clang
13.0.0 produces thousands of -Wcompound-token-split-by-macro warnings
wir older ppport.h header files.  They are especially frequent in
the ports tree.  After this update we can use perl -MDevel::PPPort
-e'Devel::PPPort::WriteFile' to regenerate the ppport.h files.  Then
we have a version that is recent enough to build all ports and does
not spit out tons of warnings.
discussed with espie@ sthen@; OK afresh1@

2 years agounveil _PATH_LOGIN_CONF_D
robert [Thu, 10 Feb 2022 13:06:46 +0000 (13:06 +0000)]
unveil _PATH_LOGIN_CONF_D

2 years agointroduce support for storing capability databases in /etc/login.conf.d;
robert [Thu, 10 Feb 2022 13:06:07 +0000 (13:06 +0000)]
introduce support for storing capability databases in /etc/login.conf.d;

anytime a class is looked up, the /etc/login.conf.d/${class} file will be
checked first for a matching class definition; this will allow us to easily
add custom login classes from packages

ok millert@

2 years agoOnly show the 'not enough inodes' warning if the filesystem reports more
tb [Thu, 10 Feb 2022 11:14:04 +0000 (11:14 +0000)]
Only show the 'not enough inodes' warning if the filesystem reports more
than zero free inodes. btrfs always reports zero inodes, so on linux
distros like fedora, users will always see the not enough space warning,
which it is a bit ugly.

fine with claudio

2 years agoFree s->last_mod before overwriting it with a new last_mod.
tb [Thu, 10 Feb 2022 11:11:22 +0000 (11:11 +0000)]
Free s->last_mod before overwriting it with a new last_mod.

ok claudio

2 years agoFree conn->last_modified before overwriting it with strdup().
tb [Thu, 10 Feb 2022 11:10:40 +0000 (11:10 +0000)]
Free conn->last_modified before overwriting it with strdup().
If it was set, this would leak 30 bytes.

ok claudio

2 years agoAssert vm map locks
kn [Thu, 10 Feb 2022 10:15:35 +0000 (10:15 +0000)]
Assert vm map locks

Introduce vm_map_assert_{wrlock,rdlock,anylock,unlocked}() in rwlock(9)
fashion and back up function comments about locking assumptions with proper
assertions.

Also add new comments/assertions based on code analysis and sync with
NetBSD as much as possible.

vm_map_lock() and vm_map_lock_read() are used for exclusive and shared
access respectively;  currently no code path is purely protected by
vm_map_lock_read() alone, i.e. functions called with a read lock held by the
callee are also called with a write lock elsewhere.

Thus only vm_map_assert_{wrlock,anylock}() are used as of now.

This should help with unlocking UVM related syscalls

Tested as part of a larger diff through
- amd64 package bulk build by naddy
- amd64, arm64, powerpc64 base builds and regress by bluhm
- amd64 and sparc64 base builds and regress by me

Input mpi
Feedback OK kettenis

2 years agoUnwire with map lock held
kn [Thu, 10 Feb 2022 10:14:02 +0000 (10:14 +0000)]
Unwire with map lock held

uvm_unmap_remove() effectively requires its caller to lock the vm map.

Even though uvm_map_teardown() is only called after a map's last reference
is dropped and is thus safe from other threads accessing the map, grab the
map's lock in uvm_map_teardown() to satify upcoming lock assertions in
uvm_unmap_remove().

Tested as part of a larger diff through
- amd64 package bulk builds by naddy
- amd64, arm64, powerpc64 base builds and regress by bluhm
- amd64 and sparc64 base builds and regress by me

Feedback mpi
OK kettenis

2 years agoIf running with ASAN, mark test_with{,out}_bzero() with the
tb [Thu, 10 Feb 2022 08:39:32 +0000 (08:39 +0000)]
If running with ASAN, mark test_with{,out}_bzero() with the
no_sanitize_address attribute. ASAN doesn't seem to be able
to understand these lowlevel gymnastics with sigaltstack()
and segfaults in __intercept_memem().

This allows LibreSSL and other portable projects that use this
test run tests with ASAN enabled.

Issue reported and workaround suggested by Ilya Shipitsin

Paraphrasing millert: it's a little ugly but it's only a regress.

2 years agoEmbed klist head in acpi_softc to avoid explicit malloc.
visa [Thu, 10 Feb 2022 07:39:20 +0000 (07:39 +0000)]
Embed klist head in acpi_softc to avoid explicit malloc.

OK kettenis@

2 years ago#ifdef the SUSPEND ioctl block
deraadt [Thu, 10 Feb 2022 06:52:13 +0000 (06:52 +0000)]
#ifdef the SUSPEND ioctl block

2 years agoAdd stubs for macppc suspend
gkoehler [Thu, 10 Feb 2022 05:48:02 +0000 (05:48 +0000)]
Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build.  zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().

2 years agorevert for imminent OpenSSH release, which wil ship with scp in RCP mode.
djm [Thu, 10 Feb 2022 04:12:38 +0000 (04:12 +0000)]
revert for imminent OpenSSH release, which wil ship with scp in RCP mode.

> revision 1.106
> date: 2021/10/15 14:46:46;  author: deraadt;  state: Exp;  lines: +13 -9;  commitid: w5n9B2RE38tFfggl;
> openbsd 7.0 release shipped with the (hopefully last) scp that uses RCP
> protocol for copying.  Let's get back to testing the SFTP protocol.

This will be put back once the OpenSSH release is done.

2 years agobring back a local change to use DC_FP_START()/DC_FP_END() in
jsg [Thu, 10 Feb 2022 01:50:19 +0000 (01:50 +0000)]
bring back a local change to use DC_FP_START()/DC_FP_END() in
update_bw_bounding_box() lost in drm 5.15 update

should avoid 'SSE FP exception trap' infrequently seen on boot
with renoir and cezanne

problem reported by beck@ and claudio@

2 years agoDon't unregister firmware if we can't fetch the SHA256.sig
afresh1 [Thu, 10 Feb 2022 00:29:32 +0000 (00:29 +0000)]
Don't unregister firmware if we can't fetch the SHA256.sig

Also avoid trying to download it multiple times if it fails,
which makes error reporting much nicer.

Noticed by and OK semarie@

2 years agothis is now in apm.c
deraadt [Wed, 9 Feb 2022 23:55:57 +0000 (23:55 +0000)]
this is now in apm.c

2 years agonot ready for suspend
deraadt [Wed, 9 Feb 2022 23:55:33 +0000 (23:55 +0000)]
not ready for suspend

2 years ago*** empty log message ***
deraadt [Wed, 9 Feb 2022 23:54:55 +0000 (23:54 +0000)]
*** empty log message ***

2 years agoMove x86-only stubs used by kern/subr_suspend.c into dev/acpi/acpi_x86.c
deraadt [Wed, 9 Feb 2022 23:54:32 +0000 (23:54 +0000)]
Move x86-only stubs used by kern/subr_suspend.c into dev/acpi/acpi_x86.c
for sharing between i386 and amd64.
ok mlarkin kettenis

2 years agoadd Surface Go 3 hid to acpibat(4)
dv [Wed, 9 Feb 2022 16:10:05 +0000 (16:10 +0000)]
add Surface Go 3 hid to acpibat(4)

Microsoft decided to break with basic ACPI standards with the Go 3.
In this case, they don't expose the battery in a standard way, so
acpibat(4) needs to look for the special Microsoft hid.

From mlarkin@, ok kettenis@

2 years agoadd newline to acpitz(4) attach condition
dv [Wed, 9 Feb 2022 16:03:53 +0000 (16:03 +0000)]
add newline to acpitz(4) attach condition

ok miod@

2 years agoFix the -f option when passed multiple files.
millert [Wed, 9 Feb 2022 15:53:35 +0000 (15:53 +0000)]
Fix the -f option when passed multiple files.
Found by robert@

2 years agolet pfattach() to also initialize pf_default_rule_new to avoid
sashan [Wed, 9 Feb 2022 11:42:58 +0000 (11:42 +0000)]
let pfattach() to also initialize pf_default_rule_new to avoid
div-by-zero in pf_purge()

Reported-by: syzbot+e720e3bab51366d7b667@syzkaller.appspotmail.com
OK deraadt@

2 years agoenable hw vlan tag handling in the rx path too.
dlg [Wed, 9 Feb 2022 11:12:21 +0000 (11:12 +0000)]
enable hw vlan tag handling in the rx path too.

also tested on both x86 and sparc64.

2 years agoAdd iic_is_compatible() for matching I2C devices
visa [Wed, 9 Feb 2022 07:58:24 +0000 (07:58 +0000)]
Add iic_is_compatible() for matching I2C devices

When using device trees, the ia_name field of struct i2c_attach_args
points to the first string of the device node's "compatible" array.
However, in many cases it would be preferable to use the last, most
general "compatible" entry as a device matching criterion.

Enable more flexible device matching by permitting ia_name to point to
the raw "compatible" data which is a concatenation of NUL-terminated
strings. I2C bus code will supply the data and set ia_name and
ia_namelen. I2C device drivers will use iic_is_compatible() to check
matches. This method is also backwards compatible with the old, direct
use of ia_name.

Prompted by a related patch from kettenis@.

OK kettenis@

2 years agosilence "function declaration isn't a prototype" warning by changing
tb [Wed, 9 Feb 2022 07:48:15 +0000 (07:48 +0000)]
silence "function declaration isn't a prototype" warning by changing
int foo() to int foo(void)

2 years agoIncrease armv7 ramdisk size to avoid errors in installer.
visa [Wed, 9 Feb 2022 07:28:54 +0000 (07:28 +0000)]
Increase armv7 ramdisk size to avoid errors in installer.

OK deraadt@

2 years agodrm/amd: avoid suspend on dGPUs w/ s2idle support when runtime PM enabled
jsg [Wed, 9 Feb 2022 04:31:46 +0000 (04:31 +0000)]
drm/amd: avoid suspend on dGPUs w/ s2idle support when runtime PM enabled

From Mario Limonciello
8a15ac1786c92dce6ecbeb4e4c237f5f80c2c703 in linux 5.15.y/5.15.22
e55a3aea418269266d84f426b3bd70794d3389c8 in mainline linux

2 years agodrm/i915/overlay: Prevent divide by zero bugs in scaling
jsg [Wed, 9 Feb 2022 04:29:02 +0000 (04:29 +0000)]
drm/i915/overlay: Prevent divide by zero bugs in scaling

From Dan Carpenter
5cba71707f0a7fe19fa1feaf25a4c094876c2db1 in linux 5.15.y/5.15.22
90a3d22ff02b196d5884e111f39271a1d4ee8e3e in mainline linux

2 years agodrm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels
jsg [Wed, 9 Feb 2022 04:25:22 +0000 (04:25 +0000)]
drm/amd/display: Force link_rate as LINK_RATE_RBR2 for 2018 15" Apple Retina panels

From Aun-Ali Zaidi
2093ecf557e733f995c7db6df716c91c43923972 in linux 5.15.y/5.15.22
30fbce374745a9c6af93c775a5ac49a97f822fda in mainline linux

2 years agodrm/amd/display: watermark latencies is not enough on DCN31
jsg [Wed, 9 Feb 2022 04:22:32 +0000 (04:22 +0000)]
drm/amd/display: watermark latencies is not enough on DCN31

From Paul Hsieh
7ff0ed88e4eb6bd7ccd7cf422ab855032ed0528c in linux 5.15.y/5.15.22
f5fa54f45ab41cbb1f99b1208f49554132ffb207 in mainline linux

2 years agodrm/amd/pm: correct the MGpuFanBoost support for Beige Goby
jsg [Wed, 9 Feb 2022 04:19:11 +0000 (04:19 +0000)]
drm/amd/pm: correct the MGpuFanBoost support for Beige Goby

From Evan Quan
4f4c77ad5a13ac39d38cc3f1b963e85ecf9d528f in linux 5.15.y/5.15.22
3ec5586b4699cfb75cdfa09425e11d121db40773 in mainline linux

2 years agodrm/i915/adlp: Fix TypeC PHY-ready status readout
jsg [Wed, 9 Feb 2022 04:16:26 +0000 (04:16 +0000)]
drm/i915/adlp: Fix TypeC PHY-ready status readout

From Imre Deak
39ac3945d966168bdede467446dec45cee3382bb in linux 5.15.y/5.15.22
3c6f13ad723e7206f03bb2752b01d18202b7fc9d in mainline linux

2 years agodrm/i915: Disable DSB usage for now
jsg [Wed, 9 Feb 2022 04:13:39 +0000 (04:13 +0000)]
drm/i915: Disable DSB usage for now

From Ville Syrjala
d63d077fc44645d51df7e9007df87853f5c13e4c in linux 5.15.y/5.15.22
99510e1afb4863a225207146bd988064c5fd0629 in mainline linux

2 years agoenable hardware vlan tagging.
dlg [Wed, 9 Feb 2022 03:22:50 +0000 (03:22 +0000)]
enable hardware vlan tagging.

tested on sparc64 and x86

2 years agocat(1): drop "rpath" promise in no-file case
cheloha [Wed, 9 Feb 2022 01:58:57 +0000 (01:58 +0000)]
cat(1): drop "rpath" promise in no-file case

If we're only working with the standard input we don't need "rpath".

Tweaked by mestre@.

Thread: https://marc.info/?l=openbsd-tech&m=163941848104274&w=2

No objections on tech@ after several weeks.

2 years agocat(1): refactor cook_args()/raw_args() into single function, cat_file()
cheloha [Wed, 9 Feb 2022 01:56:28 +0000 (01:56 +0000)]
cat(1): refactor cook_args()/raw_args() into single function, cat_file()

- Combine the open/close portions of cook_args()/raw_args() into a single
  function, cat_file().

- Push the flag-checking conditional in main() down into cat_file().

- Pull the argv loop in cat_file() up into main().

These changes -- especially pulling the argv look up into main() --
will allow us to drop the "rpath" promise in a single spot in a
subsequent patch.

Tweaked by mestre@.  Descriptor leak in earlier version spotted by
Matthew Martin.

Thread: https://marc.info/?l=openbsd-tech&m=163941848104274&w=2

No objections on tech@ after several weeks.

2 years agooops, a typo snuck in
deraadt [Tue, 8 Feb 2022 23:19:47 +0000 (23:19 +0000)]
oops, a typo snuck in

2 years agoPlug a long standing leak in libtls CRL handling
tb [Tue, 8 Feb 2022 19:13:50 +0000 (19:13 +0000)]
Plug a long standing leak in libtls CRL handling

X509_STORE_add_crl() does not take ownership of the CRL, it bumps its
refcount. So nulling out the CRL from the stack will leak it.

Issue reported by KS Sreeram, thanks!

ok jsing

2 years agoPlug leaks reported by Ilya Shipitsin
tb [Tue, 8 Feb 2022 19:06:56 +0000 (19:06 +0000)]
Plug leaks reported by Ilya Shipitsin

2 years agoPlug a number of leaks reported by Ilya Shipitsin
tb [Tue, 8 Feb 2022 19:00:36 +0000 (19:00 +0000)]
Plug a number of leaks reported by Ilya Shipitsin

2 years agoIn the first example, use "mandoc -a" directly rather "mandoc -l".
schwarze [Tue, 8 Feb 2022 18:23:11 +0000 (18:23 +0000)]
In the first example, use "mandoc -a" directly rather "mandoc -l".

It feels more natural to me to use -a directly when asking mandoc(1)
to use a pager.  The reason that "mandoc -l" does exactly the same
as "mandoc -a" is that "mandoc" is essentially "man -lc", so the -a
implied by -l negates the -c and the -l has no effect because it is
already the default for mandoc(1).

The more usual command for doing the same is "man -l foo.1 bar.1 ..."
but that's off-topic for the mandoc(1) manual page.

Patch on tech@ from Anders Damsgaard <anders at adamsgaard dot dk>.

2 years agoDo not /0 if timeout[PFTM_INTERVAL] manages to become zero
deraadt [Tue, 8 Feb 2022 18:08:33 +0000 (18:08 +0000)]
Do not /0 if timeout[PFTM_INTERVAL] manages to become zero
crash noticed by gnezdo, a seperate commit will fix the identified
cause, but being careful at this point is a good idea.
ok sashan

2 years agoGarbage collect the unused hash and print kp->pubkey_hash instead of NULL.
tb [Tue, 8 Feb 2022 18:05:57 +0000 (18:05 +0000)]
Garbage collect the unused hash and print kp->pubkey_hash instead of NULL.
Make sure kp is freed also on error.

ok jsing