openbsd
2 years agoNothing depends on archdep.h pulling in other #includes anymore,
guenther [Mon, 31 Jan 2022 05:44:13 +0000 (05:44 +0000)]
Nothing depends on archdep.h pulling in other #includes anymore,
so delete the #includes and hide the RELOC_* functions that are
only used by lib/csu behind "#ifdef RCRT0"

matches the others and it's hard to see how it will fail

2 years agoInline RELOC_* into boot_md.c and simplify the code based on what
guenther [Mon, 31 Jan 2022 05:43:22 +0000 (05:43 +0000)]
Inline RELOC_* into boot_md.c and simplify the code based on what
we can verify at build time.  Track dt_pltgot as an Elf_Addr instead
of an Elf_Addr* to eliminat casts on both setting and using.  Set
RELATIVE_RELOC so the ld.so Makefile can verify that it has just
the relocation types we expect.

Nothing depends on archdep.h pulling in other #includes anymore, so delete
the #includes and hide the RELOC_* functions that are only used by lib/csu
behind "#ifdef RCRT0"

Tested with full build.

2 years ago+kstat_destroy
dlg [Mon, 31 Jan 2022 05:29:22 +0000 (05:29 +0000)]
+kstat_destroy

2 years agoadd kstat_remove so you can tear the struct apart before kstat_destroy
dlg [Mon, 31 Jan 2022 05:09:17 +0000 (05:09 +0000)]
add kstat_remove so you can tear the struct apart before kstat_destroy

2 years agorevert fb size workaround from amdgpu_gmc.c rev 1.3
jsg [Mon, 31 Jan 2022 05:04:23 +0000 (05:04 +0000)]
revert fb size workaround from amdgpu_gmc.c rev 1.3

djm@ confirms the recently committed 5.5.18 change
'drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2'
to use the right register for GMC9 DCN2 (RENOIR, GREEN_SARDINE) is
enough on t14 gen 2 amd.

2 years agounstub append_oa_sample()
jsg [Mon, 31 Jan 2022 02:21:36 +0000 (02:21 +0000)]
unstub append_oa_sample()

2 years agoUpdate libexpat to 2.4.4. This fixes CVE-2022-23852 and CVE-2022-23990.
bluhm [Mon, 31 Jan 2022 00:21:53 +0000 (00:21 +0000)]
Update libexpat to 2.4.4.  This fixes CVE-2022-23852 and CVE-2022-23990.
Relevant for OpenBSD are security fixes #550 #551 and other changes
#553 (missing in change log).  No library bump necessary.
OK millert@

2 years agounstub intel_gt_get_awake_time()
jsg [Sun, 30 Jan 2022 23:19:26 +0000 (23:19 +0000)]
unstub intel_gt_get_awake_time()

2 years agopush stub down in __await_execution()
jsg [Sun, 30 Jan 2022 23:18:20 +0000 (23:18 +0000)]
push stub down in __await_execution()

functions in this file want to reach into the implementation of
irq work which for us isn't a llist but rather a task

2 years agoAdd aplnco(4), a driver for the Numerically-controlled oscillator (NCO)
kettenis [Sun, 30 Jan 2022 22:24:41 +0000 (22:24 +0000)]
Add aplnco(4), a driver for the Numerically-controlled oscillator (NCO)
clock that drives the audio clocks on Apple silicon.

ok patrick@

2 years agoAdd tascodec(4), a driver for the TI TAS2770/TAS5770 digital audio
kettenis [Sun, 30 Jan 2022 21:40:50 +0000 (21:40 +0000)]
Add tascodec(4), a driver for the TI TAS2770/TAS5770 digital audio
amplifier codec found on Apple M1 Macs.

ok patrick@, ratchov@

2 years agoAdd test coverage for tls_signer when used with a TLS server.
jsing [Sun, 30 Jan 2022 18:44:45 +0000 (18:44 +0000)]
Add test coverage for tls_signer when used with a TLS server.

In this configuration the tls_signer is provided with the server
certificate and private key, while the TLS server is configured with a
sign callback and is only provided with the certificate.

2 years agoAdd initial regress for tls_signer.
jsing [Sun, 30 Jan 2022 18:38:41 +0000 (18:38 +0000)]
Add initial regress for tls_signer.

2 years agoAdd missing NULL check.
martijn [Sun, 30 Jan 2022 13:27:39 +0000 (13:27 +0000)]
Add missing NULL check.

OK benno@

2 years agoWhen walking a pf table, we only are supposed to return IPv4 addresses.
martijn [Sun, 30 Jan 2022 13:26:14 +0000 (13:26 +0000)]
When walking a pf table, we only are supposed to return IPv4 addresses.
If a table has mixed IPv4 and IPv6 addresses and we walk over it an IPv6
address could be returned if it followed an IPv4 address, causing an
error.

Found by florian@
OK florian@ millert@

2 years agoLocalize variables used only in functions
afresh1 [Sun, 30 Jan 2022 02:39:19 +0000 (02:39 +0000)]
Localize variables used only in functions

Somehow I missed some

2 years agoClean up exit codes
afresh1 [Sat, 29 Jan 2022 22:43:50 +0000 (22:43 +0000)]
Clean up exit codes

Being different didn't help me figure out what was going wrong anyway.

Suggested by deraadt@

2 years agortwn and urtwn firmware got better licenses and moved to base
afresh1 [Sat, 29 Jan 2022 22:33:43 +0000 (22:33 +0000)]
rtwn and urtwn firmware got better licenses and moved to base

2 years ago"Unregister" installed firmware that isn't in the SHA256.sig
afresh1 [Sat, 29 Jan 2022 22:32:02 +0000 (22:32 +0000)]
"Unregister" installed firmware that isn't in the SHA256.sig

We assume in this case that the firmware's license was improved and
it moved to be distributed in the base system.  If we find that situation
remove the package registration but leave the firmware files.

2 years agoftplist management moves to a different IP. It would be nice if this
deraadt [Sat, 29 Jan 2022 20:17:58 +0000 (20:17 +0000)]
ftplist management moves to a different IP.  It would be nice if this
could operate in parallel to a few different IPs, but such code has
not been written yet.

2 years agoPut the leaf and subleaf input values (from rax/rcx) into local variables,
guenther [Sat, 29 Jan 2022 19:23:02 +0000 (19:23 +0000)]
Put the leaf and subleaf input values (from rax/rcx) into local variables,
truncating them to 32bit as documented by the SDM and verified on an Intel
CPU in a Lenovo T510.  Use that in the clamping logic and all the tests,
adjusting DPRINTF() format strings to match.

ok mlarkin@

2 years agodrm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2
jsg [Sat, 29 Jan 2022 12:43:21 +0000 (12:43 +0000)]
drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2

From Harry Wentland
7b6577cf9fe48d24d82df9362a077396a9d5cb27 in linux 5.15.y/5.15.18
dc5d4aff2e99c312df8abbe1ee9a731d2913bc1b in mainline linux

2 years agodrm/amd/display: reset dcn31 SMU mailbox on failures
jsg [Sat, 29 Jan 2022 12:40:27 +0000 (12:40 +0000)]
drm/amd/display: reset dcn31 SMU mailbox on failures

From Mario Limonciello
f71c91ed1d4b4bfbbb55327b04dcc32b2d970f62 in linux 5.15.y/5.15.18
83293f7f3d15fc56e86bd5067a2c88b6b233ac3a in mainline linux

2 years agodrm/i915: Flush TLBs before releasing backing store
jsg [Sat, 29 Jan 2022 12:37:08 +0000 (12:37 +0000)]
drm/i915: Flush TLBs before releasing backing store

From Tvrtko Ursulin
8a17a077e7e9ecce25c95dbdb27843d2d6c2f0f7 in linux 5.15.y/5.15.18
7938d61591d33394a21bdd7797a245b65428f44c in mainline linux

2 years agoFix macro name in comment.
aoyama [Sat, 29 Jan 2022 06:25:33 +0000 (06:25 +0000)]
Fix macro name in comment.

ok visa@

2 years agoUse local symbols in libkern mips64 assembly routines.
visa [Sat, 29 Jan 2022 05:47:36 +0000 (05:47 +0000)]
Use local symbols in libkern mips64 assembly routines.

OK miod@

2 years agoAdd limits.h for INT_MAX in tls_signer.c
inoguchi [Sat, 29 Jan 2022 02:03:19 +0000 (02:03 +0000)]
Add limits.h for INT_MAX in tls_signer.c

ok jsing@ tb@

2 years agohead(1): refactor main loop
cheloha [Sat, 29 Jan 2022 00:19:04 +0000 (00:19 +0000)]
head(1): refactor main loop

The main loop here is horribly obfuscated.  In particular, the path
through the loop to exit(3) is very complex.

Refactor the open/read/write/close portions of the loop out of main()
into a separate function, head_file().

The result is a lot easier to understand at a glance.  In particular,
the path to the end of main() is now dead simple.

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

ok millert@

2 years agorev(1): refactor main loop
cheloha [Sat, 29 Jan 2022 00:11:54 +0000 (00:11 +0000)]
rev(1): refactor main loop

The main loop here is obfuscated.

Refactor the open/read/write/close portion of the loop out of main ()
and into a new function, rev_file().  Move "multibyte" out into global
storage.

The result is much easier to understand at a glance.

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

ok millert@

2 years agotouch(1): don't leak file descriptor if futimens(2) fails
cheloha [Sat, 29 Jan 2022 00:06:26 +0000 (00:06 +0000)]
touch(1): don't leak file descriptor if futimens(2) fails

This conditional chain short-circuits if futimens(2) fails, leaving the
file descriptor open.  We need to evaluate each system call in the chain
separately to ensure we attempt to close(2) the descriptor.

With input from guenther@ and millert@.

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

ok millert@, probably ok guenther@

2 years agoGive ddb more access to registers on macppc, powerpc64
gkoehler [Fri, 28 Jan 2022 18:37:40 +0000 (18:37 +0000)]
Give ddb more access to registers on macppc, powerpc64

Edit db_regs[] in db_trace.c on both powerpc and powerpc64, so ddb can
access $r14, $r15, $r16, $dar, $dsisr.

Only for powerpc: change db_trap_glue to copy all registers to and
from ddb_regs (it was skipping some); change db_set_single_step and
db_clear_single_step to flip the correct bit of srr1; delete
FIXUP_PC_AFTER_BREAK, which was off by 1 instruction.

"ddb{1}> s" on my PowerMac7,3 (dual G5 at 2700 MHz) began to panic
like, "*cpu0: mutex 0xa7d0a0 not held in tc_update_timekeep".  Add an
arbitrary delay(100) after sending PPC_IPI_DDB; I want cpu0 to get the
ipi before it can see db_active == 1 and skip acquiring a mutex.

ok kettenis@

2 years agoRemove unused guarded read and write routines.
visa [Fri, 28 Jan 2022 16:20:09 +0000 (16:20 +0000)]
Remove unused guarded read and write routines.

No objection from miod@

2 years agoProperly handle .mft files as intended by the RFC. Instead of always
claudio [Fri, 28 Jan 2022 15:30:23 +0000 (15:30 +0000)]
Properly handle .mft files as intended by the RFC. Instead of always
selecting the newest file this opens both the new (from rrdp or rsync)
and old (valid) MFT. It then compares the manifest number and based on
that the 'newer' MFT is selected.
The MFT file and hash check is also changed to always try both locations
and selecting whatever matches up with the hash. The selction is passed
back to the the main process and used later on to open exactly the same
file as was checked against the hash.
The MFT parsing code has been split up into multiple steps so that the
files can be parsed, compared and then fully validated.
In most cases this makes no difference but it prevents replay attacks
using old but still valid files.
With and OK tb@

2 years agoDo not skip .rrdp cache cleanup if rrdp is off (option -R). The sync
claudio [Fri, 28 Jan 2022 14:11:27 +0000 (14:11 +0000)]
Do not skip .rrdp cache cleanup if rrdp is off (option -R). The sync
via rsync alters the cache and rrdp can only recover by downloading
a snapshot. By doing the cleanup here it will make sure this happens.
Noticed by job@
OK tb@

2 years agoError check for sk_push in libssl
inoguchi [Fri, 28 Jan 2022 13:14:48 +0000 (13:14 +0000)]
Error check for sk_push in libssl

CID 118976 118979

ok tb@

2 years agoError check for sk_push in libssl
inoguchi [Fri, 28 Jan 2022 13:11:56 +0000 (13:11 +0000)]
Error check for sk_push in libssl

CID 24838

comment and ok tb@

2 years agoOnly memcpy() into imsg->data if datalen is not 0. Passing a NULL pointer
claudio [Fri, 28 Jan 2022 10:41:44 +0000 (10:41 +0000)]
Only memcpy() into imsg->data if datalen is not 0. Passing a NULL pointer
to memcpy() is UB no matter if len is 0.
Reported by fouzhe on openbgpd-portable github page.
OK tb@

2 years agoMust use unsigned 1 here since modern compilers can't shift a signed 1 by 31.
claudio [Fri, 28 Jan 2022 10:37:23 +0000 (10:37 +0000)]
Must use unsigned 1 here since modern compilers can't shift a signed 1 by 31.
OK tb@ kettenis@

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 07:11:14 +0000 (07:11 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 06:33:26 +0000 (06:33 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 06:18:41 +0000 (06:18 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 05:54:02 +0000 (05:54 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 05:24:15 +0000 (05:24 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 05:15:05 +0000 (05:15 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

2 years agoUpdate comment: struct link_map is defined in <link_elf.h>
guenther [Fri, 28 Jan 2022 05:01:28 +0000 (05:01 +0000)]
Update comment: struct link_map is defined in <link_elf.h>

noted by miod

2 years agoWhen it's the possessive of 'it', it's spelled "its", without the
guenther [Fri, 28 Jan 2022 04:59:15 +0000 (04:59 +0000)]
When it's the possessive of 'it', it's spelled "its", without the
apostrophe.

one from miod, other by "never just one" vibe

2 years agoExpose tls_signer_error()
jsing [Fri, 28 Jan 2022 03:46:46 +0000 (03:46 +0000)]
Expose tls_signer_error()

Add tls_signer_error to Symbols.list - this was missed during the last
libtls minor bump and can ride along.

ok deraadt@

2 years agodrm/radeon: fix error handling in radeon_driver_open_kms
jsg [Thu, 27 Jan 2022 23:26:35 +0000 (23:26 +0000)]
drm/radeon: fix error handling in radeon_driver_open_kms

From Christian Koenig
f22f67b43775fffb09f371ea861779cdbbb763ec in linux 5.15.y/5.15.17
4722f463896cc0ef1a6f1c3cb2e171e949831249 in mainline linux

2 years agodrm/i915/display/ehl: Update voltage swing table
jsg [Thu, 27 Jan 2022 23:23:27 +0000 (23:23 +0000)]
drm/i915/display/ehl: Update voltage swing table

From Jose Roberto de Souza
077fe9d865604fcab3238afeaa7408cc1635bc39 in linux 5.15.y/5.15.17
ef3ac01564067a4337bb798b8eddc6ea7b78fd10 in mainline linux

2 years agodrm/amdgpu: don't do resets on APUs which don't support it
jsg [Thu, 27 Jan 2022 23:19:39 +0000 (23:19 +0000)]
drm/amdgpu: don't do resets on APUs which don't support it

From Alex Deucher
c3a9e0e701dfd087b0044c3598bffe880262c066 in linux 5.15.y/5.15.17
e8309d50e97851ff135c4e33325d37b032666b94 in mainline linux

2 years agodrm/amd/display: Fix the uninitialized variable in enable_stream_features()
jsg [Thu, 27 Jan 2022 23:14:21 +0000 (23:14 +0000)]
drm/amd/display: Fix the uninitialized variable in enable_stream_features()

From Yizhuo Zhai
3bf997ec299cdf7280b2039806e5e1d847df111a in linux 5.15.y/5.15.17
0726ed3065eeb910f9cea0c933bc021a848e00b3 in mainline linux

2 years agoamdgpu/pm: Make sysfs pm attributes as read-only for VFs
jsg [Thu, 27 Jan 2022 23:12:15 +0000 (23:12 +0000)]
amdgpu/pm: Make sysfs pm attributes as read-only for VFs

From Marina Nikolic
e4066c05d3327b530bb00d11d3492bac1e69982d in linux 5.15.y/5.15.17
11c9cc95f818f0f187e9b579a7f136f532b42445 in mainline linux

2 years agodrm/amdgpu: fixup bad vram size on gmc v8
jsg [Thu, 27 Jan 2022 23:10:02 +0000 (23:10 +0000)]
drm/amdgpu: fixup bad vram size on gmc v8

From Zongmin Zhou
493b87970061f044c5cf795cfd1d679d114844ed in linux 5.15.y/5.15.17
11544d77e3974924c5a9c8a8320b996a3e9b2f8b in mainline linux

2 years agodrm/amd/amdgpu: fix gmc bo pin count leak in SRIOV
jsg [Thu, 27 Jan 2022 23:07:51 +0000 (23:07 +0000)]
drm/amd/amdgpu: fix gmc bo pin count leak in SRIOV

From Jingwen Chen
305f07b93d34d292432251e9963bf232db38d67a in linux 5.15.y/5.15.17
948e7ce01413b71395723aaf846015062aea3a43 in mainline linux

2 years agodrm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV
jsg [Thu, 27 Jan 2022 23:05:39 +0000 (23:05 +0000)]
drm/amd/amdgpu: fix psp tmr bo pin count leak in SRIOV

From Jingwen Chen
8662d0c6a36807093aed34b17b930484fd4bf22f in linux 5.15.y/5.15.17
85dfc1d692c9434c37842e610be37cd4ae4e0081 in mainline linux

2 years agodrm/amdkfd: Fix error handling in svm_range_add
jsg [Thu, 27 Jan 2022 23:03:40 +0000 (23:03 +0000)]
drm/amdkfd: Fix error handling in svm_range_add

From Felix Kuehling
4a635b9d5ba5f691e378f7ec20e11b7b04f07a45 in linux 5.15.y/5.15.17
726be40607264b180a2b336c81e1dcff941de618 in mainline linux

2 years agodrm/amd/display: add else to avoid double destroy clk_mgr
jsg [Thu, 27 Jan 2022 23:01:23 +0000 (23:01 +0000)]
drm/amd/display: add else to avoid double destroy clk_mgr

From Martin Leung
58d33532664c1580beeb127ffe771a7739fb63d3 in linux 5.15.y/5.15.17
11dff0e871037a6ad978e52f826a2eb7f5fb274a in mainline linux

2 years agodrm/amdgpu/display: set vblank_disable_immediate for DC
jsg [Thu, 27 Jan 2022 22:58:56 +0000 (22:58 +0000)]
drm/amdgpu/display: set vblank_disable_immediate for DC

From Alex Deucher
f94cf1cb17963905910c2adc332ebb9e44e7fa4b in linux 5.15.y/5.15.17
92020e81ddbeac351ea4a19bcf01743f32b9c800 in mainline linux

2 years agodrm/amd/display: check top_pipe_to_program pointer
jsg [Thu, 27 Jan 2022 22:56:43 +0000 (22:56 +0000)]
drm/amd/display: check top_pipe_to_program pointer

From Yang Li
1fffa8ffd62fc511d4447b793641252c4743e81c in linux 5.15.y/5.15.17
a689e8d1f80012f90384ebac9dcfac4201f9f77e in mainline linux

2 years agodrm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L
jsg [Thu, 27 Jan 2022 22:52:54 +0000 (22:52 +0000)]
drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L

From Hans de Goede
c350fcc74035f48ee5a7226faee7079dd0ce9565 in linux 5.15.y/5.15.17
bc30c3b0c8a1904d83d5f0d60fb8650a334b207b in mainline linux

2 years agodrm/amd/display: Fix out of bounds access on DNC31 stream encoder regs
jsg [Thu, 27 Jan 2022 22:50:24 +0000 (22:50 +0000)]
drm/amd/display: Fix out of bounds access on DNC31 stream encoder regs

From Nicholas Kazlauskas
89166801f80dc64083212eef1308bfc62f6844f1 in linux 5.15.y/5.15.17
d374d3b493215d637b9e7be12a93f22caf4c1f97 in mainline linux

2 years agodrm/amd/display: Fix bug in debugfs crc_win_update entry
jsg [Thu, 27 Jan 2022 22:46:54 +0000 (22:46 +0000)]
drm/amd/display: Fix bug in debugfs crc_win_update entry

From Wayne Lin
6dcc6706dab10744d277bdc2613fb135c6a632dd in linux 5.15.y/5.15.17
4bef85d4c9491415b7931407b07f24841c1e0390 in mainline linux

2 years agodrm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms()
jsg [Thu, 27 Jan 2022 22:44:38 +0000 (22:44 +0000)]
drm/radeon/radeon_kms: Fix a NULL pointer dereference in radeon_driver_open_kms()

From Zhou Qingyang
e833ef0b545e1a5b3eaf00af391c4fd1fb47ffd8 in linux 5.15.y/5.15.17
ab50cb9df8896b39aae65c537a30de2c79c19735 in mainline linux

2 years agodrm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode()
jsg [Thu, 27 Jan 2022 22:41:01 +0000 (22:41 +0000)]
drm/amdgpu: Fix a NULL pointer dereference in amdgpu_connector_lcd_native_mode()

From Zhou Qingyang
1e22b51876fa786c0b972e327ffb5cc686873cd1 in linux 5.15.y/5.15.17
b220110e4cd442156f36e1d9b4914bb9e87b0d00 in mainline linux

2 years agodrm/dp: Don't read back backlight mode in drm_edp_backlight_enable()
jsg [Thu, 27 Jan 2022 22:37:14 +0000 (22:37 +0000)]
drm/dp: Don't read back backlight mode in drm_edp_backlight_enable()

From Lyude Paul
56339a5546a7f66333f9d3c55e3fd1424caa4879 in linux 5.15.y/5.15.17
646596485e1ed2182adf293dfd5aec4a96c46330 in mainline linux

2 years agodrm: fix null-ptr-deref in drm_dev_init_release()
jsg [Thu, 27 Jan 2022 22:13:24 +0000 (22:13 +0000)]
drm: fix null-ptr-deref in drm_dev_init_release()

From Wang Hai
52e1bf49e3e25358519719284028334cb31ab543 in linux 5.15.y/5.15.17
acf20ed020ffa4d6cc8347e8d356509b95df3cbe in mainline linux

2 years agodrm/ttm: Put BO in its memory manager's lru list
jsg [Thu, 27 Jan 2022 22:10:11 +0000 (22:10 +0000)]
drm/ttm: Put BO in its memory manager's lru list

From xinhui pan
0da09030aae4a3c9de4699e7ce71085639f8c378 in linux 5.15.y/5.15.17
781050b0a3164934857c300bb0bc291e38c26b6f in mainline linux

2 years agosort includes as usual
tb [Thu, 27 Jan 2022 20:31:21 +0000 (20:31 +0000)]
sort includes as usual

2 years agoDo not depend on engine.h pulling in err.h and evp.h
tb [Thu, 27 Jan 2022 20:30:29 +0000 (20:30 +0000)]
Do not depend on engine.h pulling in err.h and evp.h

2 years agoCast to unsigned integer before overflow can happen.
bluhm [Thu, 27 Jan 2022 18:28:44 +0000 (18:28 +0000)]
Cast to unsigned integer before overflow can happen.
found by kubsan; joint work with tobhe@; OK miod@

2 years agocad(4): Mention PolarFire SoC.
visa [Thu, 27 Jan 2022 17:36:22 +0000 (17:36 +0000)]
cad(4): Mention PolarFire SoC.

2 years agocad(4): Disable unused priority queues
visa [Thu, 27 Jan 2022 17:34:51 +0000 (17:34 +0000)]
cad(4): Disable unused priority queues

The GEMs on the PolarFire Soc implement four Rx queues and four
Tx queues for prioritizing traffic. All the queues are in a pseudo
active state after reset. The driver uses only queues with index 0.
Disable the rest to avoid DMA errors.

Tested on a SiFive FU740 by jca@, Microchip PolarFire SoC and
Xilinx Zynq-7000 by me.

2 years agoUpdate awk to Dec 8, 2021 version.
millert [Thu, 27 Jan 2022 16:58:37 +0000 (16:58 +0000)]
Update awk to Dec 8, 2021 version.
Fixes error handling in closefile() and closeall(). Long standing
warnings had been made fatal and some fatal errors went undetected.

2 years agoNuke single use function PRT_fix_BN() and just use the ATA/ATAPI LBA -> CHS
krw [Thu, 27 Jan 2022 16:26:32 +0000 (16:26 +0000)]
Nuke single use function PRT_fix_BN() and just use the ATA/ATAPI LBA -> CHS
conversion formula

LBA = (C × HPC + H) × SPT + (S − 1)

instead of the equivalent tortuous arithmetic used in PRT_fix_BN().

No intentional functional change.

2 years agodrop some local changes in an unused function
jsg [Thu, 27 Jan 2022 12:25:22 +0000 (12:25 +0000)]
drop some local changes in an unused function

2 years agoraise sched_engine lock mtx ipl to IPL_TTY
jsg [Thu, 27 Jan 2022 04:20:01 +0000 (04:20 +0000)]
raise sched_engine lock mtx ipl to IPL_TTY

used with spin_lock_irq() from
resubmit_virtual_request()
execlists_hold()
execlists_unhold()
execlists_capture()
remove_from_engine()
rcu_virtual_context_destroy()
virtual_submission_tasklet()

used with spin_lock_irqsave() from
execlists_submit_request()
execlists_reset_rewind()
execlists_reset_cancel()
virtual_submit_request()
intel_execlists_show_requests()

2 years agoraise mm obj_lock mtx ipl to IPL_TTY
jsg [Thu, 27 Jan 2022 04:17:40 +0000 (04:17 +0000)]
raise mm obj_lock mtx ipl to IPL_TTY

used with spin_lock_irqsave() from
__i915_gem_object_set_pages()
i915_gem_suspend_late()
i915_gem_shrink()
i915_gem_shrinker_oom()
i915_gem_object_make_unshrinkable()
i915_gem_madvise_ioctl()

2 years agouse process name for both thread and process name
jsg [Thu, 27 Jan 2022 02:56:13 +0000 (02:56 +0000)]
use process name for both thread and process name

2 years agoAllow rsync:// URI as file in -f mode. This makes it easier to explore
claudio [Wed, 26 Jan 2022 14:42:39 +0000 (14:42 +0000)]
Allow  URI as file in -f mode. This makes it easier to explore
rpki repositories by following AIA and manifest URIs.
Also stop checking the the loaded file is not part of the auth tree,
it is possible that this file was loaded before as a dependency.
OK tb@

2 years agoAn ACPI device needs to be both present and enabled for it to function.
kettenis [Wed, 26 Jan 2022 14:39:07 +0000 (14:39 +0000)]
An ACPI device needs to be both present and enabled for it to function.
So only attempt to attach hardware that has both bits enabled.  This fixes
an issue where com(4) would attach for a disabled serial port leading to
misdetection of the hardware variant and a subsequent hang when /etc/rc
runs ttyflags -a.

ok anton@, deraadt@

2 years agoChange the repository layout by removing the valid directory. Everything
claudio [Wed, 26 Jan 2022 13:57:56 +0000 (13:57 +0000)]
Change the repository layout by removing the valid directory. Everything
that was in that directory is now in the chachedir root. The rsync and
rrdp directories are now .rsync/ and .rrdp/. The ta/ directory still
remains because TAs are special.
Idea and most of the diff from job@
OK tb@ and benno@

2 years agoshrink uca.ibufsize from UCHCOMIBUFSIZE to wMaxPacketSize of bulk-in pipe
uaa [Wed, 26 Jan 2022 12:05:33 +0000 (12:05 +0000)]
shrink uca.ibufsize from UCHCOMIBUFSIZE to wMaxPacketSize of bulk-in pipe

USB transaction is finished when whole requested data has transferred,
or short packet (the size is less than wMaxPacketSize) has sent.

UCHCOMIBUFSIZE(256) was multiply of wMaxPacketSize(32). When CH340 sends
exact wMaxPacketSize byte packet, this will cause Rx jam problem
due to transaction is not finished.

Now uca.ibufsize is same as wMaxPacketSize to avoid this problem.

ok kevlo@

2 years agowhitespace
tb [Wed, 26 Jan 2022 11:05:41 +0000 (11:05 +0000)]
whitespace

2 years agoMake vmm(4/amd64) tracepoints amd64-only
kn [Wed, 26 Jan 2022 06:31:31 +0000 (06:31 +0000)]
Make vmm(4/amd64) tracepoints amd64-only

One can use them on non-VMM architectures, but they obviously won't hit:

# arch -s ; btrace -l | grep vmm
sparc64
tracepoint:vmm:guest_enter
tracepoint:vmm:guest_exit

Move them under __amd64__ to avoid confusion and safe a few bytes.

OK dv

2 years agoRework initialization of sensors on device connect.
anton [Wed, 26 Jan 2022 06:05:59 +0000 (06:05 +0000)]
Rework initialization of sensors on device connect.

2 years agoimplement might_alloc() using assertwaitok()
jsg [Wed, 26 Jan 2022 04:18:05 +0000 (04:18 +0000)]
implement might_alloc() using assertwaitok()

2 years agoreduce diff to linux ggtt_probe_common()
jsg [Wed, 26 Jan 2022 01:46:12 +0000 (01:46 +0000)]
reduce diff to linux ggtt_probe_common()

2 years agosync
tb [Tue, 25 Jan 2022 21:55:13 +0000 (21:55 +0000)]
sync

2 years agominor bump after api additiom
eric [Tue, 25 Jan 2022 21:53:45 +0000 (21:53 +0000)]
minor bump after api additiom

2 years agoIntroduce a signer interface intented to make TLS privsep simpler
eric [Tue, 25 Jan 2022 21:51:24 +0000 (21:51 +0000)]
Introduce a signer interface intented to make TLS privsep simpler
to implement.

Add a tls_config_set_sign_cb() function that allows to register
a callback for the signing operation on a tls_config. When used,
the context installs fake pivate keys internally, and the callback
receives the hash of the public key.

Add a tls_signer_*() set of functions to manage tls_signer objects.
A tls_signer is an opaque structure on which keys are added.
It is used to compute signatures with private keys identified by
their associated public key hash.

Discussed with and ok jsing@ tb@

2 years agoreduce diff to linux shmem_create_from_object()
jsg [Tue, 25 Jan 2022 21:31:26 +0000 (21:31 +0000)]
reduce diff to linux shmem_create_from_object()

includes linux 988d4ff6e3c2220d13d8dde22a98945b64fd7977
drm/i915: Fix ww locking in shmem_create_from_object

2 years agoreduce diff to linux vm_fault_cpu()
jsg [Tue, 25 Jan 2022 21:19:21 +0000 (21:19 +0000)]
reduce diff to linux vm_fault_cpu()

adds change made in linux 9fa1f4785f2a54286ccb8a850cda5661f0a3aaf9
drm/i915: Add object locking to vm_fault_cpu

2 years agoRewrite paragraph to refer to EVP_CIPHER_CTX_new() and HMAC_CTX_new()
tb [Tue, 25 Jan 2022 18:01:20 +0000 (18:01 +0000)]
Rewrite paragraph to refer to EVP_CIPHER_CTX_new() and HMAC_CTX_new()
to match reality.

spotted by/ok jmc

2 years agoRemove some HMAC_CTX_init() remnants in HMAC(3).
tb [Tue, 25 Jan 2022 17:55:39 +0000 (17:55 +0000)]
Remove some HMAC_CTX_init() remnants in HMAC(3).

spotted by/ok jmc

2 years agoFix another return 0 bug in SSL_shutdown()
tb [Tue, 25 Jan 2022 15:00:09 +0000 (15:00 +0000)]
Fix another return 0 bug in SSL_shutdown()

If tls13_recod_layer_send_pending() returns TLS13_IO_EOF, we will
bubble this up to the caller via tls13_legacy_return_code(), which
translates TLS13_IO_EOF to 0. This can happen if we have pending
post handshake-handshake data and the peer closes the pipe.

Presumably tls13_legacy_shutdown() should be rewritten yet again.

ok jsing

2 years agoAvoid an infinite loop in SSL_shutdown()
tb [Tue, 25 Jan 2022 14:51:54 +0000 (14:51 +0000)]
Avoid an infinite loop in SSL_shutdown()

If the peer closed the write side of the connection and we have not
yet received the close_notify, SSL_shutdown() makes an extra read to
try and read the peer's close_notify from the pipe. In that situation,
we receive EOF. The legacy stack will return -1 while the TLSv1.3
stack will end up returning 0.

Since the documentation is not super explicit about what should be
done if SSL_shutdown() returns 0, some applications will enter an
infinite loop. The code and documentation indicate that SSL_shutdown()
should only be called once more if it returned 0. Newer versions
of the OpenSSL documentation explicitly say that one should call
SSL_read() if SSL_shutdown() returns 0 in order to retrieve the
close_notify. Doing this would also have avoided this infinite loop.

Reported by Carsten Arzig and bluhm with a test case extracted from the
syslogd tests using IO::Socket::SSL, which has such an infinite loop.

ok bluhm jsing

2 years agoUse unguarded loads in stack trace saving
visa [Tue, 25 Jan 2022 07:10:19 +0000 (07:10 +0000)]
Use unguarded loads in stack trace saving

The stack trace saver should see a system state that is not broken.
Therefore use unguarded memory accesses.

However, the unwinder is still haphazard. Terminate immediately if
the program counter or stack pointer look inconsistent.

2 years agoPreserve pcb_onfault in kdbpeek() and kdbpoke()
visa [Tue, 25 Jan 2022 07:08:43 +0000 (07:08 +0000)]
Preserve pcb_onfault in kdbpeek() and kdbpoke()

This avoids misbehaviour if kdbpeek() or kdbpoke() is used in the middle
of a guarded copy operation.

2 years agoCapture a repeated pattern into sysctl_securelevel_int function
gnezdo [Tue, 25 Jan 2022 04:04:40 +0000 (04:04 +0000)]
Capture a repeated pattern into sysctl_securelevel_int function

A few variables in the kernel are only writeable before securelevel is
raised. It makes sense to handle them with less code.

OK sthen@ bluhm@

2 years agoAn af-to pf rule must have an address family naf to use after
bluhm [Mon, 24 Jan 2022 22:49:48 +0000 (22:49 +0000)]
An af-to pf rule must have an address family naf to use after
translation.  Make stricter sanity checks in pf ioctl to avoid later
crashes during packet processing.
Reported-by: syzbot+0ef9190e7d0195496d0d@syzkaller.appspotmail.com
OK sashan@