openbsd
21 months agoAdd short options for --foreground and --preserve-status
job [Tue, 10 Jan 2023 14:19:12 +0000 (14:19 +0000)]
Add short options for --foreground and --preserve-status

Align with upcoming POSIX spec: https://www.austingroupbugs.net/view.php?id=1586

OK jmc@

21 months agoImprove timestamp printing in filemode
job [Tue, 10 Jan 2023 13:26:34 +0000 (13:26 +0000)]
Improve timestamp printing in filemode

OK claudio@

21 months agorhe -> the from Crystal Kolipe
tb [Tue, 10 Jan 2023 12:47:19 +0000 (12:47 +0000)]
rhe -> the from Crystal Kolipe

21 months agopurge unhooked wx_syscall files
anton [Tue, 10 Jan 2023 12:19:18 +0000 (12:19 +0000)]
purge unhooked wx_syscall files

21 months agoRetire wx_syscall regress tests, they have been failing since the
anton [Tue, 10 Jan 2023 12:17:00 +0000 (12:17 +0000)]
Retire wx_syscall regress tests, they have been failing since the
introduction of mimmutable(2) and also needs to cope with xonly on some
architectures by now. There's already the syscallwx target in
regress/usr.bin/lastcomm which does the same thing but also ensures that
the expected code path is reached by looking at accounting records.

21 months agodisable jump tables by default on hppa because they are incompatible
deraadt [Tue, 10 Jan 2023 12:07:34 +0000 (12:07 +0000)]
disable jump tables by default on hppa because they are incompatible
with --execute-only in the linker
ok kettenis

21 months agocreate infrastructure so that jump tables on/off can be tweaked by an
deraadt [Tue, 10 Jan 2023 12:06:18 +0000 (12:06 +0000)]
create infrastructure so that jump tables on/off can be tweaked by an
architecture by changing JUMP_TABLES_DEFAULT
ok kettenis

21 months agoThe uvm_swap_data_lock mutex can now be taken without holding the kernel
kettenis [Tue, 10 Jan 2023 11:18:47 +0000 (11:18 +0000)]
The uvm_swap_data_lock mutex can now be taken without holding the kernel
lock.  So it needs IPL_MPFLOOR to prevent lock ordering issues.

ok jca@

21 months agoRewrite BN_lshift()
jsing [Tue, 10 Jan 2023 04:13:22 +0000 (04:13 +0000)]
Rewrite BN_lshift()

This improves readability and eliminates special handling for various
cases, making the code cleaner and closer to constant time. Basic
benchmarking shows a performance gain on modern 64 bit architectures.

ok tb@

21 months agoHide WAITPKG cpu feature from vmm(4) guests.
dv [Tue, 10 Jan 2023 01:09:14 +0000 (01:09 +0000)]
Hide WAITPKG cpu feature from vmm(4) guests.

Alder Lake and similar-era Intel platforms introduced new userland
wait instructions. Since vmm was passing this cpuid bit into guests,
some would attempt TPAUSE instructions and trigger invalid instruction
exceptions because VMX requires additional configuration to support
emulation.

This also adds WAITPKG to i386 and amd64 cpu feature identification.

Input from anton@, cheloha@, and guenther@. Tested by jmatthew@.

OK deraadt.

21 months agoi386: identifycpu(): only calibrate_cyclecounter() on primary CPU
cheloha [Tue, 10 Jan 2023 01:01:18 +0000 (01:01 +0000)]
i386: identifycpu(): only calibrate_cyclecounter() on primary CPU

On i386 during identifycpu(), we call calibrate_cyclecounter() for every
CPU in the system.  This is pointless: every new call clobbers the cpuspeed
measured during the prior call.  It is also extremely slow: every call to
calibrate_cyclecounter() takes about 1 second.

Instead, let's only call calibrate_cyclecounter() once, on the primary CPU.
Multiprocessor i386 machines will now boot much faster.

ok deraadt@

21 months agoi386: identifycpu(): don't print cpuspeed after calibrate_cyclecounter()
cheloha [Tue, 10 Jan 2023 00:49:45 +0000 (00:49 +0000)]
i386: identifycpu(): don't print cpuspeed after calibrate_cyclecounter()

The cpuspeed set during calibrate_cyclecounter() is a bogomips measurement.
It isn't an authoritative (nominal) frequency, so we shouldn't print it out
when identifying each CPU.  As an added bonus, this also removes some noise
when diffing i386 dmesgs.

ok deraadt@

21 months agoChange the __canonicalize_funcptr_for_compare() implementation to stop
kettenis [Mon, 9 Jan 2023 21:18:47 +0000 (21:18 +0000)]
Change the __canonicalize_funcptr_for_compare() implementation to stop
trying to read a branch instruction and decode it to extract the address
of the ld.so resolver function.  Instead, directly execute that branch
instruction.

This is effectively a C runtime ABI change.  In order to cross this if
you are building from source, make sure you install an updated ld.so
first.

ok deraadt@

21 months agoSet the default for machdep.lidaction to 1 like on amd64.
kettenis [Mon, 9 Jan 2023 20:32:21 +0000 (20:32 +0000)]
Set the default for machdep.lidaction to 1 like on amd64.

ok tobhe@, deraadt@

21 months agoImplement suspend on lid close.
kettenis [Mon, 9 Jan 2023 20:29:35 +0000 (20:29 +0000)]
Implement suspend on lid close.

ok tobhe@, deraadt@

21 months agoGenerate the "combreloc" scripts for the new linker script template as well.
kettenis [Mon, 9 Jan 2023 18:58:13 +0000 (18:58 +0000)]
Generate the "combreloc" scripts for the new linker script template as well.

ok deraadt@

21 months agotweak text for USE_NOEXECONLY
sthen [Mon, 9 Jan 2023 17:41:03 +0000 (17:41 +0000)]
tweak text for USE_NOEXECONLY

21 months agodocument USE_NOEXECONLY
sthen [Mon, 9 Jan 2023 17:17:55 +0000 (17:17 +0000)]
document USE_NOEXECONLY

21 months agoshorten SYNOPSIS from three versions to two (me) then one (ratchov),
jmc [Mon, 9 Jan 2023 17:13:46 +0000 (17:13 +0000)]
shorten SYNOPSIS from three versions to two (me) then one (ratchov),
plus all the cleanup that goes with;

ok ratchov

21 months agoDIAGNOSTIC is redundant with KASSERT, remove it. From Crystal Kolipe.
nicm [Mon, 9 Jan 2023 15:49:36 +0000 (15:49 +0000)]
DIAGNOSTIC is redundant with KASSERT, remove it. From Crystal Kolipe.

ok guenther

21 months agoAllwinner hardware sucks! The ARM generic timer on the A64 has a bug
kettenis [Mon, 9 Jan 2023 15:22:53 +0000 (15:22 +0000)]
Allwinner hardware sucks!  The ARM generic timer on the A64 has a bug
where the bottom 9 bits of the counter register can't be trusted if any of
the higher bits are rolling over.  This is an unpublished errata so the
details aren't known.  Adopt the same workaround that Linux has.

This will disable the userland timecounter support on hardware affected
by the hardware.  We will need a similar workaround in libc to restore
that functionality.

tested by semarie@
ok cheloha@

21 months agoriscv64 ld.so is ready to be xonly
deraadt [Mon, 9 Jan 2023 15:05:49 +0000 (15:05 +0000)]
riscv64 ld.so is ready to be xonly
ok kettenis

21 months agoAdjust the hppa linker scripts to order .rodata (and other sections
kettenis [Mon, 9 Jan 2023 14:40:48 +0000 (14:40 +0000)]
Adjust the hppa linker scripts to order .rodata (and other sections
classified as read-only) before .text.  This makes it possible to make
.text execute-only as it no longer contains the ELF program headers.

This is achieved by forking the ELF linker script template.  Adding another
level of conditionals to the existing ELF linker script template would be
utter madness.

ok deraadt@

21 months agoImplement --execute-only (and turn --no-execute-only from a no-op into an
kettenis [Mon, 9 Jan 2023 14:36:38 +0000 (14:36 +0000)]
Implement --execute-only (and turn --no-execute-only from a no-op into an
options that does the opposite).

Note that this option is likely to be ineffective without changes to the
linker scripts.  A change that adjusts the hppa linker scripts will follow
shortly.  Other architectures will need some work.

ok deraadt@

21 months agoWhoa, that clean target is insane. If someone does a make build,
deraadt [Mon, 9 Jan 2023 14:14:26 +0000 (14:14 +0000)]
Whoa, that clean target is insane.  If someone does a make build,
pf gets disabled.  Comment it out, that will need to be rethought.

21 months agoFix behaviour with \007 (used the wrong tree for last change).
nicm [Mon, 9 Jan 2023 14:12:41 +0000 (14:12 +0000)]
Fix behaviour with \007 (used the wrong tree for last change).

21 months agoRewrite the hppa assembly code to avoid reads from .text, by using the
kettenis [Mon, 9 Jan 2023 13:52:42 +0000 (13:52 +0000)]
Rewrite the hppa assembly code to avoid reads from .text, by using the
standard PIC magic.  This makes the code similar to what we already use
for rcrt0.o.  This makes it ready for execute-only.

Build C code using -fno-jump-tables to make it ready for execute-only.

ok deraadt@, miod@

21 months agoIn preparation for upcoming execute-only support, change the magic branch
kettenis [Mon, 9 Jan 2023 13:45:55 +0000 (13:45 +0000)]
In preparation for upcoming execute-only support, change the magic branch
instruction used by __canonicalize_funcptr_for_compare() from "bl" into "b".
This allows __canonicalize_funcptr_for_compare() to execute the branch
instead of decoding the instruction to find the address of _dl_bind().

This is the first step in the transition to a new ABI.  Once an updated
ld.so has been installed, we can change __canonicalize_funcptr_for_compare()
(which lives in libgcc) and rebuild everything with a new libgcc.  Only
then we can actually make ld.so executable-only.

ok deraadt@, miod@

21 months agoFix the syscallwx target which is affected by both mimmutable(2) and
anton [Mon, 9 Jan 2023 11:50:01 +0000 (11:50 +0000)]
Fix the syscallwx target which is affected by both mimmutable(2) and
xonly by using a new gadget routine written in assembler with the sole
purpose of issuing a syscall. Since it needs to be copied to wx memory,
place it in the rodata section.

21 months agoUse PROT_EXEC when servicing instruction faults.
miod [Mon, 9 Jan 2023 11:18:44 +0000 (11:18 +0000)]
Use PROT_EXEC when servicing instruction faults.
ok aoyama@

21 months agoyet another set of regression tests for pf(4). Unlike tests
sashan [Mon, 9 Jan 2023 10:21:40 +0000 (10:21 +0000)]
yet another set of regression tests for pf(4). Unlike tests
found in pf_forward the tests in pf_policy use local bound
traffic to provide simple testing of various pf features.
The initial commit brings few tests using icmp echo to
test anchor rules.

anton@ helped a lot to improve pf_policy/Makefile

OK anton@

21 months agoAccept \007 as terminator to OSC 10 or 11.
nicm [Mon, 9 Jan 2023 07:57:14 +0000 (07:57 +0000)]
Accept \007 as terminator to OSC 10 or 11.

21 months agoCorrect length of replies to primary and secondary DAs so as not to send
nicm [Mon, 9 Jan 2023 07:48:12 +0000 (07:48 +0000)]
Correct length of replies to primary and secondary DAs so as not to send
a stray trailing NUL byte. From Crystal Kolipe.

ok deraadt miod

21 months agoSanitize the inherited environment by removing LC_ALL, missed in previous.
anton [Mon, 9 Jan 2023 06:34:02 +0000 (06:34 +0000)]
Sanitize the inherited environment by removing LC_ALL, missed in previous.

21 months agoHandle possible PROT_EXEC fault if PROT_READ fails; needed to cope with
miod [Mon, 9 Jan 2023 06:04:14 +0000 (06:04 +0000)]
Handle possible PROT_EXEC fault if PROT_READ fails; needed to cope with
kern_exec.c 1.241

21 months agodrm/amd/pm: correct the fan speed retrieving in PWM for some SMU13 asics
jsg [Mon, 9 Jan 2023 04:32:29 +0000 (04:32 +0000)]
drm/amd/pm: correct the fan speed retrieving in PWM for some SMU13 asics

From Evan Quan
54b6a040f38075711751c61b2300a8ce7cb1741f in linux-6.1.y/6.1.4
e73fc71e8f015d61f3adca7659cb209fd5117aa5 in mainline linux

21 months agodrm/amd/pm: bump SMU13.0.0 driver_if header to version 0x34
jsg [Mon, 9 Jan 2023 04:30:22 +0000 (04:30 +0000)]
drm/amd/pm: bump SMU13.0.0 driver_if header to version 0x34

From Evan Quan
0b865bcd7a084e9cbf171ad3b240bf40058fd985 in linux-6.1.y/6.1.4
272b981416f8be0180c4d8066f90635fa7c1c501 in mainline linux

21 months agodrm/amd/pm: add missing SMU13.0.7 mm_dpm feature mapping
jsg [Mon, 9 Jan 2023 04:28:04 +0000 (04:28 +0000)]
drm/amd/pm: add missing SMU13.0.7 mm_dpm feature mapping

From Evan Quan
789c4804d7aed7094845da4a0ebf7099a503f8ba in linux-6.1.y/6.1.4
e0607c10ebf551a654c3577fc74b4bf5533e1cea in mainline linux

21 months agodrm/amd/pm: add missing SMU13.0.0 mm_dpm feature mapping
jsg [Mon, 9 Jan 2023 04:26:30 +0000 (04:26 +0000)]
drm/amd/pm: add missing SMU13.0.0 mm_dpm feature mapping

From Evan Quan
1cfd678e2f070fd2f005dc6e12c180ff1a1b5843 in linux-6.1.y/6.1.4
592cd24a08763975c75be850a7d4e461bfd353bf in mainline linux

21 months agodrm/i915/migrate: Account for the reserved_space
jsg [Mon, 9 Jan 2023 04:24:23 +0000 (04:24 +0000)]
drm/i915/migrate: Account for the reserved_space

From Chris Wilson
6e6d577cd90b27a98ce9f06ed96bca7b59d210f0 in linux-6.1.y/6.1.4
31a2e6cbe8a4eb0d1650fff4b77872b744e14a62 in mainline linux

21 months agodrm/i915: improve the catch-all evict to handle lock contention
jsg [Mon, 9 Jan 2023 04:22:46 +0000 (04:22 +0000)]
drm/i915: improve the catch-all evict to handle lock contention

From Matthew Auld
ea62bd769994d6f18bd265cc156e6182a288c880 in linux-6.1.y/6.1.4
3f882f2d4f689627c1566c2c92087bc3ff734953 in mainline linux

21 months agodrm/amdgpu: make display pinning more flexible (v2)
jsg [Mon, 9 Jan 2023 04:19:25 +0000 (04:19 +0000)]
drm/amdgpu: make display pinning more flexible (v2)

From Alex Deucher
52beaa0938ad33f3ee848c22935af967e3cce005 in linux-6.1.y/6.1.4
81d0bcf9900932633d270d5bc4a54ff599c6ebdb in mainline linux

21 months agodrm/amdgpu: handle polaris10/11 overlap asics (v2)
jsg [Mon, 9 Jan 2023 04:17:50 +0000 (04:17 +0000)]
drm/amdgpu: handle polaris10/11 overlap asics (v2)

From Alex Deucher
9724e6950ef902abd6abc5b5dfacca4b5125ba75 in linux-6.1.y/6.1.4
1d4624cd72b912b2680c08d0be48338a1629a858 in mainline linux

21 months agodrm/amd/display: Add DCN314 display SG Support
jsg [Mon, 9 Jan 2023 04:15:53 +0000 (04:15 +0000)]
drm/amd/display: Add DCN314 display SG Support

From Yifan Zhang
3038224f5617bb4628170b29661645138f884292 in linux-6.1.y/6.1.4
fe6872adb05e85bde38f2cdec01a0f4cfb826998 in mainline linux

21 months agodrm/i915/ttm: consider CCS for backup objects
jsg [Mon, 9 Jan 2023 04:13:33 +0000 (04:13 +0000)]
drm/i915/ttm: consider CCS for backup objects

From Matthew Auld
218f8fe668240f2ec95dcb000f61904dcdc83271 in linux-6.1.y/6.1.4
ad0fca2dceeab8fdd8e1135f4b4ef2dc46c2ead9 in mainline linux

21 months agodrm/i915/dsi: fix VBT send packet port selection for dual link DSI
jsg [Mon, 9 Jan 2023 04:11:31 +0000 (04:11 +0000)]
drm/i915/dsi: fix VBT send packet port selection for dual link DSI

From Mikko Kovanen
556a7e74af59048bf73777b25395cf90be9b377f in linux-6.1.y/6.1.4
f9cdf4130671d767071607d0a7568c9bd36a68d0 in mainline linux

21 months agodrm/connector: send hotplug uevent on connector cleanup
jsg [Mon, 9 Jan 2023 04:09:22 +0000 (04:09 +0000)]
drm/connector: send hotplug uevent on connector cleanup

From Simon Ser
d988f0bcf579b4bcb0b7aba217a882ec150bcc2a in linux-6.1.y/6.1.4
6fdc2d490ea1369d17afd7e6eb66fecc5b7209bc in mainline linux

21 months agodrm/amdgpu: fix mmhub register base coding error
jsg [Mon, 9 Jan 2023 04:07:06 +0000 (04:07 +0000)]
drm/amdgpu: fix mmhub register base coding error

From Yang Wang
51c107f91bf1d49fdd1538e46770e6f146f40267 in linux-6.1.y/6.1.4
347fafe0eb46df941965c355c77ce480e4d49f1f in mainline linux

21 months agodrm/amd/pm: correct SMU13.0.0 pstate profiling clock settings
jsg [Mon, 9 Jan 2023 04:04:57 +0000 (04:04 +0000)]
drm/amd/pm: correct SMU13.0.0 pstate profiling clock settings

From Evan Quan
ed00567b170fc461d8755003e5cf4e0b008aff90 in linux-6.1.y/6.1.4
32a7819ff8e25375c7515aaae5cfcb8c44a461b7 in mainline linux

21 months agodrm/amd/pm: update SMU13.0.0 reported maximum shader clock
jsg [Mon, 9 Jan 2023 04:03:10 +0000 (04:03 +0000)]
drm/amd/pm: update SMU13.0.0 reported maximum shader clock

From Evan Quan
9d455cb89dc576f752beebcadc823511882fb321 in linux-6.1.y/6.1.4
7a18e089eff02f17eaee49fc18641f5d16a8284b in mainline linux

21 months agodrm/amdgpu: skip mes self test after s0i3 resume for MES IP v11.0
jsg [Mon, 9 Jan 2023 04:01:17 +0000 (04:01 +0000)]
drm/amdgpu: skip mes self test after s0i3 resume for MES IP v11.0

From Tim Huang
a354a9e3fc3b5475b80395a3015644e26352223f in linux-6.1.y/6.1.4
8660495a9c5b9afeec4cc006b3b75178f0fb2f10 in mainline linux

21 months agodrm/amdgpu: skip MES for S0ix as well since it's part of GFX
jsg [Mon, 9 Jan 2023 03:59:28 +0000 (03:59 +0000)]
drm/amdgpu: skip MES for S0ix as well since it's part of GFX

From Alex Deucher
33a3b7fad8273e7bcbef0f456c2070be8adcad45 in linux-6.1.y/6.1.4
afa6646b1c5d3affd541f76bd7476e4b835a9174 in mainline linux

21 months agoflesh out ifiq_enqueue
dlg [Mon, 9 Jan 2023 03:39:14 +0000 (03:39 +0000)]
flesh out ifiq_enqueue

21 months agocount the number times a packet was dropped by bpf as fdrops.
dlg [Mon, 9 Jan 2023 03:37:44 +0000 (03:37 +0000)]
count the number times a packet was dropped by bpf as fdrops.

21 months agosetthrname() should return EINVAL, not ENAMETOOLONG, when the
guenther [Mon, 9 Jan 2023 02:12:13 +0000 (02:12 +0000)]
setthrname() should return EINVAL, not ENAMETOOLONG, when the
input is too long.

ok mpi@

21 months agodisklabel appeared in tahoe
jsg [Mon, 9 Jan 2023 00:56:36 +0000 (00:56 +0000)]
disklabel appeared in tahoe
ok krw@

21 months agorestore NetBSD RCS ID
daniel [Mon, 9 Jan 2023 00:22:47 +0000 (00:22 +0000)]
restore NetBSD RCS ID

Looks like this was removed in rev 1.85 without comment (which may have
been unintentional).

ok stsp@

21 months agoFix parsing of optional arguments so that and accept a - starting an
nicm [Sun, 8 Jan 2023 23:34:46 +0000 (23:34 +0000)]
Fix parsing of optional arguments so that and accept a - starting an
argument.

21 months agoHave client return 1 if process is interrupted to an input pane.
nicm [Sun, 8 Jan 2023 22:17:04 +0000 (22:17 +0000)]
Have client return 1 if process is interrupted to an input pane.

21 months agoRestore code to handle wcwidth failure so that unknown codepoints still
nicm [Sun, 8 Jan 2023 22:15:30 +0000 (22:15 +0000)]
Restore code to handle wcwidth failure so that unknown codepoints still
do the most likely right thing. GitHub issue 3427, patch based on an
diff from Jesse Luehrs in GitHub issue 3003.

21 months agoQuotes are now required in select-layout example.
nicm [Sun, 8 Jan 2023 21:00:01 +0000 (21:00 +0000)]
Quotes are now required in select-layout example.

21 months agovmd(8): add thread names to vm process.
dv [Sun, 8 Jan 2023 19:57:17 +0000 (19:57 +0000)]
vmd(8): add thread names to vm process.

ok guenther@.

21 months agosync
deraadt [Sun, 8 Jan 2023 18:02:56 +0000 (18:02 +0000)]
sync

21 months agoUse NULL instead 0 for pointer initialization.
mvs [Sun, 8 Jan 2023 10:26:36 +0000 (10:26 +0000)]
Use NULL instead 0 for pointer initialization.

21 months ago- tweak the text relating to -w
jmc [Sun, 8 Jan 2023 08:27:17 +0000 (08:27 +0000)]
- tweak the text relating to -w
- sync usage() and SYNOPSIS

ok ratchov

21 months agoAdd -w option to display variables periodically
ratchov [Sun, 8 Jan 2023 06:58:07 +0000 (06:58 +0000)]
Add -w option to display variables periodically

The purpose of -w is to monitor underruns without triggering long
kernel code-paths (ex. fork and exec of new audioctl process) that may
cause additional underruns than the ones being monitored.

ok chehola, edd

21 months agoDue to xonly on arm64 it is no longer possible to read the testfly routine.
anton [Sun, 8 Jan 2023 06:56:01 +0000 (06:56 +0000)]
Due to xonly on arm64 it is no longer possible to read the testfly routine.
Put it in the rodata section allowing it to be copied. Note that testfly is
never executed directly but only after placing it in a separate chunk of memory
allowing its permissions to be mutated.

21 months agocope with recent thread name changes
anton [Sun, 8 Jan 2023 06:55:18 +0000 (06:55 +0000)]
cope with recent thread name changes

21 months agoRename argument funcidx_swid to func_idx as it does not include any software id.
anton [Sun, 8 Jan 2023 06:54:51 +0000 (06:54 +0000)]
Rename argument funcidx_swid to func_idx as it does not include any software id.
No functional change.

21 months agoAdd getthrname(2) manpage
guenther [Sun, 8 Jan 2023 04:54:50 +0000 (04:54 +0000)]
Add getthrname(2) manpage

ok jmc@ schwarze@

21 months agosync
deraadt [Sat, 7 Jan 2023 19:56:38 +0000 (19:56 +0000)]
sync

21 months agoBring back a local copystr() declaration, as copy{in,out} still make us of it
miod [Sat, 7 Jan 2023 17:29:37 +0000 (17:29 +0000)]
Bring back a local copystr() declaration, as copy{in,out} still make us of it
but its body is in locore.

21 months agoRewrite/simplify BN_free().
jsing [Sat, 7 Jan 2023 16:17:29 +0000 (16:17 +0000)]
Rewrite/simplify BN_free().

ok tb@

21 months agoFlip BN_clear_free() and BN_free()
jsing [Sat, 7 Jan 2023 16:13:46 +0000 (16:13 +0000)]
Flip BN_clear_free() and BN_free()

All of our BIGNUMs are cleared when we free them - move the code to
BN_free() and have BN_clear_free() call BN_free(), rather than the other
way around.

ok tb@

21 months agoUse calloc() in BN_new(), rather than malloc() and then manually zeroing.
jsing [Sat, 7 Jan 2023 16:09:18 +0000 (16:09 +0000)]
Use calloc() in BN_new(), rather than malloc() and then manually zeroing.

ok tb@

21 months agoaccept --executable-only on aarch64, riscv64, and mips64 because the
deraadt [Sat, 7 Jan 2023 16:01:58 +0000 (16:01 +0000)]
accept --executable-only on aarch64, riscv64, and mips64 because the
linker is creating correct binaries.  There can also be problems with
compilers generating incorrect data-inside-text, but those (so far minor)
issues are being resolved seperately.
ok kettenis

21 months agosync
deraadt [Sat, 7 Jan 2023 15:20:27 +0000 (15:20 +0000)]
sync

21 months agoFix previous.
jsing [Sat, 7 Jan 2023 14:30:57 +0000 (14:30 +0000)]
Fix previous.

21 months agofix firmware filename typo in iwx(4) man page: ao -> a0
stsp [Sat, 7 Jan 2023 12:34:29 +0000 (12:34 +0000)]
fix firmware filename typo in iwx(4) man page: ao -> a0

21 months agoMake net80211 drop beacons received on secondary HT/VHT channels.
stsp [Sat, 7 Jan 2023 11:09:16 +0000 (11:09 +0000)]
Make net80211 drop beacons received on secondary HT/VHT channels.

Prevents iwm firmware panics and makes association work with 11ac APs
which transmit beacons on channels other than their primary channel.
We would use the wrong channel in such cases, and iwm would request
a bogus channel configuration, which made the firmware unhappy.

Tested by myself on iwm 8265 and florian on iwm 9260.
This issue did likely affect iwx devices, too.

ok mpi@

21 months agoThe PA-RISC architecture supports execute-only mappings by using a
kettenis [Sat, 7 Jan 2023 10:09:34 +0000 (10:09 +0000)]
The PA-RISC architecture supports execute-only mappings by using a
"remain at privilege level 3" gateway page.  Make use of this.

ok deraadt@, miod@

22 months agoThe maximum length of the value is extended to 64k bytes.
asou [Sat, 7 Jan 2023 06:40:21 +0000 (06:40 +0000)]
The maximum length of the value is extended to 64k bytes.

ok yasuoka

22 months agoAdd argument and return support for {get,set}thrname()
guenther [Sat, 7 Jan 2023 05:26:40 +0000 (05:26 +0000)]
Add argument and return support for {get,set}thrname()

22 months agoregen
guenther [Sat, 7 Jan 2023 05:25:39 +0000 (05:25 +0000)]
regen

22 months agoAdd {get,set}thrname(2) for putting thread names in the kernel and
guenther [Sat, 7 Jan 2023 05:24:58 +0000 (05:24 +0000)]
Add {get,set}thrname(2) for putting thread names in the kernel and
exposed in a new field returned by sysctl(KERN_PROC).  Update
pthread_{get,set}_name_np(3) to use the syscalls.  Show them, when
set, in ps -H and top -H output.

libc and libpthread minor bumps

ok mpi@, mvs@, deraadt@

22 months agotlsfuzzer: hook up new connection abort tests while skipping the NST
tb [Fri, 6 Jan 2023 19:25:20 +0000 (19:25 +0000)]
tlsfuzzer: hook up new connection abort tests while skipping the NST
tests for TLSv1.3 since that's not currently handled.

22 months agoUse copyin32() to fetch a faulting instruction rather than short-circuit it
miod [Fri, 6 Jan 2023 19:23:53 +0000 (19:23 +0000)]
Use copyin32() to fetch a faulting instruction rather than short-circuit it
with a comment saying that we really ought to use copyin* here.

22 months agoOops, forgot to cvs rm
miod [Fri, 6 Jan 2023 19:12:12 +0000 (19:12 +0000)]
Oops, forgot to cvs rm

22 months agoRemove copystr(9), unless used internally by copy{in,out}str.
miod [Fri, 6 Jan 2023 19:10:18 +0000 (19:10 +0000)]
Remove copystr(9), unless used internally by copy{in,out}str.

22 months agoReplace last user of copystr() with strlcpy(). NFCI
miod [Fri, 6 Jan 2023 19:08:36 +0000 (19:08 +0000)]
Replace last user of copystr() with strlcpy(). NFCI

22 months agoRemove no longer needed and quite worthless header.
miod [Fri, 6 Jan 2023 19:07:17 +0000 (19:07 +0000)]
Remove no longer needed and quite worthless header.

22 months agoRemove unused local variables as well as the dependency on <machine/nvm.h>.
miod [Fri, 6 Jan 2023 19:05:46 +0000 (19:05 +0000)]
Remove unused local variables as well as the dependency on <machine/nvm.h>.

22 months agoPF_ANCHOR_STACK_MAX is insufficient protection against stack overflow.
sashan [Fri, 6 Jan 2023 17:44:33 +0000 (17:44 +0000)]
PF_ANCHOR_STACK_MAX is insufficient protection against stack overflow.
On amd64 stack overflows for anchor rule with depth ~30. The tricky
thing is the 'safe' depth varies depending on kind of packet processed
by pf_match_rule(). For example for local outbound TCP packet stack
overflows when recursion if pf_match_rule() reaches depth 24.

Instead of lowering PF_ANCHOR_STACK_MAX to 20 and hoping it will
be enough on all platforms and for all packets I'd like to stop
calling pf_match_rule() recursively. This commit brings back
pf_anchor_stackframe array we used to have back in 2017. It also
revives patrick@'s idea to pre-allocate stack frame arrays
from per-cpu.

OK kn@

22 months agoRework the main <-> parser/filemode communication protocol a bit.
claudio [Fri, 6 Jan 2023 16:06:43 +0000 (16:06 +0000)]
Rework the main <-> parser/filemode communication protocol a bit.

Swap repo_id and filename to simplify the code in parser.c. In filemode
both repo_id and filename are ignored.
Additionally do not errx() in case of unknown file types. Instead send back
enough info that the code can move on.

OK tb@

22 months agoClean up struct nd_opts, use nd6_options() function local variables
kn [Fri, 6 Jan 2023 14:35:34 +0000 (14:35 +0000)]
Clean up struct nd_opts, use nd6_options() function local variables

nd_opts_search is really the next option, so call it next_opt.

nd_opts_done == 1 means next_opt == NULL, i.e. no more option to handle,
so zap the former and use the latter to stop.

Finally drop the useless struct members, all under _KERNEL.

OK claudio

22 months agoInline nd6_option() helper, remove indirections
kn [Fri, 6 Jan 2023 14:32:55 +0000 (14:32 +0000)]
Inline nd6_option() helper, remove indirections

Move the function body into the while loop, merge identical variables,
pull the `invalid' label out of the loop and straighten `skip' into the
`skip1' label.

Merging nd6_option() into nd6_options() is now much clearer after the
previous clean up.

nd_opts_{search,last,done} are now clearly "private" to n6_options() and
can be cleaned up from struct nd_opts next.

OK claudio

22 months agoClarify nd6_option() return semantics
kn [Fri, 6 Jan 2023 14:29:47 +0000 (14:29 +0000)]
Clarify nd6_option() return semantics

nd_opts_last is set only once in nd6_options() during struct init and
guaranteed non-NULL as it is set to the function's argument *opt which
is passed in as (struct_ptr + 1) in both callers.

nd6_option(), the internal helper, returns a pointer to the next option
or NULL, which means either "no option, ok" or "invalid option, fail".

Failure is signaled through nd_opts_last being NULL after nd6_option()
returned, which only happens if nd6_option() zeroed the whole *ndopts.

Move the two cases under mnemonic labels and zap the now obviously
redundant bzero() call in nd6_options().

OK claudio

22 months agoSimplify nd6_options() initialise logic
kn [Fri, 6 Jan 2023 14:24:36 +0000 (14:24 +0000)]
Simplify nd6_options() initialise logic

nd_opts_{search,last,done} are exlusively used in the internal option
handling machinery;  the only two nd6_options() callers only use
nd_opts_{src,tgt}_lladdr.

nd6_options() always zeroes and initialises the caller's struct nd_opts.
If icmp6len is zero, i.e. if there are no ICMP6 header options left,
everything inside *ndopts is zero, except nd_opts_done=1 which is not
used by the callers.

Set the internal nd_opts_{search,last,done} members only when needed.

OK claudio

22 months agoMerge common code into new nd6_dad_destroy()
kn [Fri, 6 Jan 2023 14:17:15 +0000 (14:17 +0000)]
Merge common code into new nd6_dad_destroy()

The current code wrt. stopping DAD for and removing a particular IP from
the list is flawed.

Introduce a single nd6_dad_destroy() to the cleanup, so that there's
only one place to fix.

This is just a mechanical deduplication without significant behaviour
change;  in case a duplicated address was found, RTM_CHGADDRATTR now goes
out before cleanup, which should be no problem.

The nd6_dad_create() pendant could be done as well, but the end of
nd6_dad_start() is currently the only place where a new IP/DAD entry is
set up, so little gain besides function name symmetry.

OK claudio

22 months agosync with rpki-client 'more dastardly white spaces' commit
tb [Fri, 6 Jan 2023 13:26:57 +0000 (13:26 +0000)]
sync with rpki-client 'more dastardly white spaces' commit