openbsd
3 years agoRename some MD structs by giving them an architecture-neutral name in
kettenis [Mon, 17 May 2021 17:25:13 +0000 (17:25 +0000)]
Rename some MD structs by giving them an architecture-neutral name in
preparation for sharing PCIe host bridge drivers between arm64 and riscv64.

ok mpi@, mlarkin@, patrick@

3 years agoIncrease the default buffer space using on PF_UNIX sockets to 8k.
claudio [Mon, 17 May 2021 17:06:51 +0000 (17:06 +0000)]
Increase the default buffer space using on PF_UNIX sockets to 8k.
Additionally make the values tuneable via sysctl.
OK deraadt@ mvs@

3 years agocopy riscv support from regress/sys/kern/stackpivot/pivot.h
deraadt [Mon, 17 May 2021 15:31:13 +0000 (15:31 +0000)]
copy riscv support from regress/sys/kern/stackpivot/pivot.h

3 years agoadd riscv support
deraadt [Mon, 17 May 2021 15:28:24 +0000 (15:28 +0000)]
add riscv support

3 years agodelete useless blank lines
deraadt [Mon, 17 May 2021 15:06:09 +0000 (15:06 +0000)]
delete useless blank lines

3 years agoLink fenv.S test program statically to avoid calling the dynamic
bluhm [Mon, 17 May 2021 13:54:42 +0000 (13:54 +0000)]
Link fenv.S test program statically to avoid calling the dynamic
linker.

3 years agoSkip sosplice loop test if Perl packages are not installed.
bluhm [Mon, 17 May 2021 13:13:27 +0000 (13:13 +0000)]
Skip sosplice loop test if Perl packages are not installed.

3 years agoReshuffle if conditions to check for error first after the fstat() calls.
claudio [Mon, 17 May 2021 12:15:48 +0000 (12:15 +0000)]
Reshuffle if conditions to check for error first after the fstat() calls.
OK benno@

3 years agoDo not leak blk.blks in error condition.
claudio [Mon, 17 May 2021 12:11:05 +0000 (12:11 +0000)]
Do not leak blk.blks in error condition.
Noticed by and OK benno@

3 years agoAdjust exit codes in the main program to follow the ones from rsync.
claudio [Mon, 17 May 2021 12:04:38 +0000 (12:04 +0000)]
Adjust exit codes in the main program to follow the ones from 
OK benno@

3 years agoError out on memory failures in fargs_cmdline() and addargs() in both
claudio [Mon, 17 May 2021 12:02:58 +0000 (12:02 +0000)]
Error out on memory failures in fargs_cmdline() and addargs() in both
cases it was impossible to start the remote rsync anyway. Also now
fargs_cmdline() can no longer fail. Add missing err(ERR_IPC, "pldege")
for the cases in socket.c
OK benno@

3 years agoFix mbuf leaks after reception error in re_rxeof().
visa [Mon, 17 May 2021 11:59:53 +0000 (11:59 +0000)]
Fix mbuf leaks after reception error in re_rxeof().

Also, increment the error counter when an unexpected fragment is seen.

OK claudio@

3 years agoIf pledge() or unveil() fails error out with ERR_IPC. Also error out in
claudio [Mon, 17 May 2021 11:59:09 +0000 (11:59 +0000)]
If pledge() or unveil() fails error out with ERR_IPC. Also error out in
the receiver when intial setup fails because of filesystem errors (unable
to open or create the base directory) or on memory failures.
OK benno@

3 years agoIntroduce some error exit codes which are in sync with the ones from
claudio [Mon, 17 May 2021 11:54:14 +0000 (11:54 +0000)]
Introduce some error exit codes which are in sync with the ones from
proper rsync. This should help to make the tool behave more like the
real thing.
OK benno@

3 years agoSync code with the original from mkdir(1).
claudio [Mon, 17 May 2021 11:52:10 +0000 (11:52 +0000)]
Sync code with the original from mkdir(1).
OK benno@

3 years agoThe openat() then fstat() pattern only works if one is sure the file being
claudio [Mon, 17 May 2021 11:49:01 +0000 (11:49 +0000)]
The openat() then fstat() pattern only works if one is sure the file being
opened is a regular file. In other cases this may block in openat() (since
the O_NONBLOCK flag removed). Switch to fstatat() and then openat() to
protect from involuntary side-effects (like opening a device node) and
possible hangs.
OK benno@

3 years agoput unused 802.11 fragmentation support code under #ifdef notyet
stsp [Mon, 17 May 2021 11:44:22 +0000 (11:44 +0000)]
put unused 802.11 fragmentation support code under #ifdef notyet

3 years agofix breakage of -W forwaring introduced in 1.554; reported by
djm [Mon, 17 May 2021 11:43:16 +0000 (11:43 +0000)]
fix breakage of -W forwaring introduced in 1.554; reported by
naddy@ and sthen@, ok sthen@

3 years agoLimit the number of concurrent RTR connects to 32.
claudio [Mon, 17 May 2021 10:47:07 +0000 (10:47 +0000)]
Limit the number of concurrent RTR connects to 32.
If the limit is hit the request will be dropped and the rtr process will
retry the connect after the retry timeout. Hopefully by then the number of
connections is down again.
OK deraadt@ benno@

3 years agoStop setting IPV6_MINMTU in ip6_send() which is used by the ICMP code.
claudio [Mon, 17 May 2021 10:09:53 +0000 (10:09 +0000)]
Stop setting IPV6_MINMTU in ip6_send() which is used by the ICMP code.
Because of this large ping packets where fragmented even if the MTU did
not indicate the need for it. This causes some trouble when system do
not expect to receive a fragmented answer from a system. One such case
is the automated link test from google routers before allowing to establish
a BGP peering session with them. In general PMTU problems should be an
issue from the past and if not it may be better to also break on ping
packets and not only for UDP and TCP. ICMP ping is normaly the first
tool in the admins toolbox to figure out network issues.
OK phessler@ florian@ bluhm@

3 years agoDo not try to chunk encode an empty http body coming from an fcgi
florian [Mon, 17 May 2021 09:26:52 +0000 (09:26 +0000)]
Do not try to chunk encode an empty http body coming from an fcgi
upstream.

Found the hard way by Chris Narkiewicz who tracked failing uploads in
the nextcloud mobile app down to httpd(8) trying to chunk encode a
"204 No Content" resonse.

Testing by Steve Williams
Testing & OK stsp

3 years agoAvoid calling ibuf_add() with NULL and zero length.
tobhe [Mon, 17 May 2021 08:14:37 +0000 (08:14 +0000)]
Avoid calling ibuf_add() with NULL and zero length.

ok patrick@

3 years agoPrevent frame injection via forged 802.11n A-MSDUs.
stsp [Mon, 17 May 2021 08:02:20 +0000 (08:02 +0000)]
Prevent frame injection via forged 802.11n A-MSDUs.

This mitigates an attack where a single 802.11 frame is interpreted as an
A-MSDU because of a forged AMSDU-present bit in the 802.11 QoS frame header.
See https://papers.mathyvanhoef.com/usenix2021.pdf section 3.2.

MAC address validation is added as an additional measure to prevent hostap
clients from sending A-MSDU subframes with a spoofed source address.

An earlier version of this patch was reviewed by Mathy Vanhoef, who spotted
a bug in my original attempt at preventing spoofed addresses.

ok mpi@

3 years agoRegenerate moduli.
dtucker [Mon, 17 May 2021 07:22:45 +0000 (07:22 +0000)]
Regenerate moduli.

3 years agodrm/radeon: fix copy of uninitialized variable back to userspace
jsg [Mon, 17 May 2021 02:18:07 +0000 (02:18 +0000)]
drm/radeon: fix copy of uninitialized variable back to userspace

From Colin Ian King
8dbc2ccac5a65c5b57e3070e36a3dc97c7970d96 in mainline linux

3 years agoreturn early if work is cancelled before being scheduled
jsg [Mon, 17 May 2021 00:17:26 +0000 (00:17 +0000)]
return early if work is cancelled before being scheduled

cheloha@ noticed that task_del(9) was being called with a NULL taskq
from inteldrm(4), which was not noticed as the function returns early
from testing a flag in the task.  This situation occurs when work is
cancelled before it is scheduled.

ok kettenis@ cheloha@

3 years agoImplement the layout specification "a" (left justify with 1em indentation)
schwarze [Sun, 16 May 2021 23:16:22 +0000 (23:16 +0000)]
Implement the layout specification "a" (left justify with 1em indentation)
in HTML output mode; before this patch, the indentation was missing.
Terminal output already supported the "a" specifier since 2010.
Issue reported and patch tested by Oliver dot Corff at email dot de.

3 years agoMake all unicode Private Use areas SWIDTH1
afresh1 [Sun, 16 May 2021 22:48:05 +0000 (22:48 +0000)]
Make all unicode Private Use areas SWIDTH1

Noticed by naddy@ due to a commit in nano.

There's no current mechanism to allow people who put codepoints in
these private use areas to specify their width, we can however guess
that people who put things there are most likely adding SWIDTH1
glyphs and making that the default will be most likely to do what
they want.  In addition, that's apparently what other systems do
already.

Much feedback and OK schwarze@

3 years agoUpdate en_US.UTF-8.src to Unicode 13.0
afresh1 [Sun, 16 May 2021 22:38:31 +0000 (22:38 +0000)]
Update en_US.UTF-8.src to Unicode 13.0

This is what ships with the perl 5.32.1

OK schwarze@

3 years agotest font modifiers in the layout; related to tbl_html.c rev. 1.29
schwarze [Sun, 16 May 2021 22:23:57 +0000 (22:23 +0000)]
test font modifiers in the layout; related to tbl_html.c rev. 1.29

3 years agoimplement the tbl(7) layout modifiers "b" (bold) and "i" (italic)
schwarze [Sun, 16 May 2021 18:08:37 +0000 (18:08 +0000)]
implement the tbl(7) layout modifiers "b" (bold) and "i" (italic)
in HTML output mode, similar to tbl_term.c, function tbl_word();
issue reported by Oliver dot Corff at email dot de

3 years agoDrop PTE check in pmap_fault_fixup(). Since pmap_enter() doesn't
kettenis [Sun, 16 May 2021 17:41:30 +0000 (17:41 +0000)]
Drop PTE check in pmap_fault_fixup().  Since pmap_enter() doesn't
add PTE's for pages that haven't been accessed yet, the check would
skip the fixup on such pages and force us to go through uvm_fault()
just for the sake of MOD/REF bit emulation.  Since we already check
the PTE descriptor, dropping the check should be safe.  Doing so
gives us a nice 10% performance gain when building a kernel.

ok patrick@, drahn@

3 years agoCorrect problem in riscv64 dtors execution load the function pointer
drahn [Sun, 16 May 2021 16:00:50 +0000 (16:00 +0000)]
Correct problem in riscv64 dtors execution load the function pointer
correctly and do not overwrite it in csu.
allows most ld.so regressions to pass
confirmed by jsg@, ok kettenis

3 years agoAbsorb SSL_AEAD_CTX into struct tls12_record_protection.
jsing [Sun, 16 May 2021 15:49:01 +0000 (15:49 +0000)]
Absorb SSL_AEAD_CTX into struct tls12_record_protection.

The information contained in SSL_AEAD_CTX really belongs in the
tls12_record_protection struct. Absorb SSL_AEAD_CTX, using more appropriate
types in the process.

ok tb@

3 years agoZero the tls12_record_protection struct instead of individual fields.
jsing [Sun, 16 May 2021 15:21:10 +0000 (15:21 +0000)]
Zero the tls12_record_protection struct instead of individual fields.

In tls12_record_protection_clear(), rather than zeroing or NULLing
individual fields once a pointer has been freed, zero the entire struct once
the pointers have been dealt with.

ok tb@

3 years agopanic does not require a \n at the end. When one is provided, it looks wrong.
deraadt [Sun, 16 May 2021 15:12:37 +0000 (15:12 +0000)]
panic does not require a \n at the end.  When one is provided, it looks wrong.

3 years agohint that the panicstr should not contain \n, by saying one is printed.
deraadt [Sun, 16 May 2021 15:11:08 +0000 (15:11 +0000)]
hint that the panicstr should not contain \n, by saying one is printed.

3 years agopanic does not require a \n at the end. When one is provided, it looks wrong.
deraadt [Sun, 16 May 2021 15:10:19 +0000 (15:10 +0000)]
panic does not require a \n at the end.  When one is provided, it looks wrong.

3 years agoAvoid including tls13_internal.h in tls13_record.h.
jsing [Sun, 16 May 2021 14:20:29 +0000 (14:20 +0000)]
Avoid including tls13_internal.h in tls13_record.h.

While the implementation needs tls13_internal.h, consumers of
tls13_record.h should not.

3 years agoAvoid pulling ssl_locl.h into self-contained code.
jsing [Sun, 16 May 2021 14:19:04 +0000 (14:19 +0000)]
Avoid pulling ssl_locl.h into self-contained code.

3 years agoMake local header inclusion consistent.
jsing [Sun, 16 May 2021 14:10:43 +0000 (14:10 +0000)]
Make local header inclusion consistent.

Consistently include local headers in the same location, using the same
grouping/sorting across all files.

3 years agoMove DTLS structs/definitions/prototypes to dtls_locl.h.
jsing [Sun, 16 May 2021 13:56:30 +0000 (13:56 +0000)]
Move DTLS structs/definitions/prototypes to dtls_locl.h.

Now that the DTLS structs are opaque, add a dtls_locl.h header and move
internal-only structs from dtls1.h, along with prototypes from ssl_locl.h.
Only pull this header in where DTLS code actually exists.

ok inoguchi@ tb@

3 years agoAdd a missing space.
jsing [Sun, 16 May 2021 13:39:07 +0000 (13:39 +0000)]
Add a missing space.

3 years agoIn route detach we delete `rop_timeout' while `rop' is still linked to
mvs [Sun, 16 May 2021 13:09:39 +0000 (13:09 +0000)]
In route detach we delete `rop_timeout' while `rop' is still linked to
`rtp_list' so it could be re-added by concurrent thread. Also
timeout_del(9) doesn't wait timeout proc to be finished and
timeout_del_barrier(9) should be used for that.

So use timeout_del_barrier(9) instead of timeout_del(9) and moved it
just after refcnt_finalize(9). This fixes potential use-after-free
issue in route_detach().

ok mpi@

3 years agoFix formatting of multi-line license comment per style(9).
jsing [Sun, 16 May 2021 10:58:27 +0000 (10:58 +0000)]
Fix formatting of multi-line license comment per style(9).

3 years agoAvoid pulling ssl_sigalgs.h in via ssl_locl.h.
jsing [Sun, 16 May 2021 10:55:17 +0000 (10:55 +0000)]
Avoid pulling ssl_sigalgs.h in via ssl_locl.h.

Forward declare struct sigalg in ssl_locl.h and avoid including
ssl_sigalgs.h. Explicitly include ssl_sigalgs.h where it is needed.

3 years agoremove unneeded includes
jsg [Sun, 16 May 2021 10:40:24 +0000 (10:40 +0000)]
remove unneeded includes

3 years agoremove unneeded includes
jsg [Sun, 16 May 2021 10:39:22 +0000 (10:39 +0000)]
remove unneeded includes

3 years agoSync memreg_add() implementation with arm64 and powerpc64.
kettenis [Sun, 16 May 2021 10:38:53 +0000 (10:38 +0000)]
Sync memreg_add() implementation with arm64 and powerpc64.

3 years agoCapabilities are only supported on a session when both sides announce
claudio [Sun, 16 May 2021 09:09:11 +0000 (09:09 +0000)]
Capabilities are only supported on a session when both sides announce
that capability. Change capa_neg_calc() to check always both the
ann(ounce) and peer capa struct to figure out what was negotiated.
This change affects route refersh and graceful restart (where before
setting the capability in the config to 'no' would not fully disable
the feature).
Also ignore and warn about unexpected route refresh messages.
OK benno@

3 years agocorrect prototype of acpi gpio intr_establish functions
jsg [Sun, 16 May 2021 08:50:59 +0000 (08:50 +0000)]
correct prototype of acpi gpio intr_establish functions

ok kettenis@

3 years agoRemove unnecessary includes from the bytestring APIs.
jsing [Sun, 16 May 2021 08:32:49 +0000 (08:32 +0000)]
Remove unnecessary includes from the bytestring APIs.

The bytestring APIs are self contained, hence including openssl headers
here is unnecessary.

3 years agoExplicitly include <openssl/opensslconf.h> in files using OPENSSL_NO_*
jsing [Sun, 16 May 2021 08:24:21 +0000 (08:24 +0000)]
Explicitly include <openssl/opensslconf.h> in files using OPENSSL_NO_*

Where a file references to OPENSSL_NO_* conditions, ensure that we
explicitly include <openssl/opensslconf.h> before any references, rather
than relying on another header to pull this in.

3 years agomention apmd(8) in afterboot(8)
paco [Sun, 16 May 2021 06:46:57 +0000 (06:46 +0000)]
mention apmd(8) in afterboot(8)

input and ok jmc@

3 years agob_saveaddr has a type of void * use NULL not 0
jsg [Sun, 16 May 2021 06:20:28 +0000 (06:20 +0000)]
b_saveaddr has a type of void * use NULL not 0

3 years agoansi
jsg [Sun, 16 May 2021 04:51:00 +0000 (04:51 +0000)]
ansi

3 years agoderegister
jsg [Sun, 16 May 2021 04:45:58 +0000 (04:45 +0000)]
deregister

3 years agoansi
jsg [Sun, 16 May 2021 04:34:47 +0000 (04:34 +0000)]
ansi

3 years agoremove prototype for cpu_adjust_tsc_freq()
jsg [Sun, 16 May 2021 04:33:05 +0000 (04:33 +0000)]
remove prototype for cpu_adjust_tsc_freq()
a matching function was never committed

3 years agoansi
jsg [Sun, 16 May 2021 03:39:27 +0000 (03:39 +0000)]
ansi

3 years agoansi
jsg [Sun, 16 May 2021 03:30:33 +0000 (03:30 +0000)]
ansi

3 years agoansi
jsg [Sun, 16 May 2021 03:29:35 +0000 (03:29 +0000)]
ansi

3 years agoadd riscv asm for these two security-feature checking regress tests
deraadt [Sun, 16 May 2021 03:23:48 +0000 (03:23 +0000)]
add riscv asm for these two security-feature checking regress tests
with drahn

3 years agoremove unused pre efiboot targets
jsg [Sun, 16 May 2021 02:01:33 +0000 (02:01 +0000)]
remove unused pre efiboot targets

3 years agoNuke some Capt. Obvious and soon to be obsolete comments in
krw [Sat, 15 May 2021 22:06:43 +0000 (22:06 +0000)]
Nuke some Capt. Obvious and soon to be obsolete comments in
GPT_write().

Add local variables prigh and prigp, mirroring altgh and altp, to
GPT_write(), eliminating some magic numbers to make clear the
relationship between the various primary and alternative GPT lba
fields.

No intentional functional change.

3 years agoAdd back -mno-relax for now. Retain the -target option but put it on
kettenis [Sat, 15 May 2021 20:51:12 +0000 (20:51 +0000)]
Add back -mno-relax for now.  Retain the -target option but put it on
a line of its own to improve diffability with other architectures.

ok drahn@

3 years agoin kdata_abort, error must be initialized to 0 (like arm64)
deraadt [Sat, 15 May 2021 20:20:35 +0000 (20:20 +0000)]
in kdata_abort, error must be initialized to 0 (like arm64)
spotted by drahn

3 years agoIn all the copyin family functions, must compare end-address against
deraadt [Sat, 15 May 2021 20:14:05 +0000 (20:14 +0000)]
In all the copyin family functions, must compare end-address against
VM_MAXUSER_ADDRESS with bgtu, signed comparison is incorrect.  Now passes
regress/sys/copy
ok drahn kettenis

3 years agoReorganize kernel & user fault handling into seperate functions like on
deraadt [Sat, 15 May 2021 20:12:24 +0000 (20:12 +0000)]
Reorganize kernel & user fault handling into seperate functions like on
other architectures.  During refactoring, found missing calls to important
functions and incorrect parameter passing...
ok kettenis drahn

3 years agocopyinout.S is not used
deraadt [Sat, 15 May 2021 20:05:05 +0000 (20:05 +0000)]
copyinout.S is not used

3 years agoKeep internal representation of DOSPTYP_EFI partition sizes correct.
krw [Sat, 15 May 2021 19:44:15 +0000 (19:44 +0000)]
Keep internal representation of DOSPTYP_EFI partition sizes correct.
Translate to/from UINT32_MAX as required when translating between
on-disk MBR format and internal format.

No intentional functional change.

3 years agoWhen looking for the last layout row used, we need to look at the layout
schwarze [Sat, 15 May 2021 17:16:38 +0000 (17:16 +0000)]
When looking for the last layout row used, we need to look at the layout
row used for the previous data line containing data, not at the previous
data line outright, which might be a horizontal ruler.  If it is, do not
restart from the first layout row but still proceed to the next data row,
which may have been just read from T&.

Bug originally reported by Oliver dot Corff at email dot de
on groff at gnu dot org:
https://lists.gnu.org/archive/html/groff/2021-03/msg00003.html
and forwarded to me by bentley@.

Patch OK'ed by bentley@ back in April.

3 years agoAdd missing MBR_protective_mbr() check when writing edited GPT.
krw [Sat, 15 May 2021 15:59:15 +0000 (15:59 +0000)]
Add missing MBR_protective_mbr() check when writing edited GPT.

No intentional functional change.

3 years agoShuffle USER_print_disk() code into a more rational, clearer
krw [Sat, 15 May 2021 15:20:17 +0000 (15:20 +0000)]
Shuffle USER_print_disk() code into a more rational, clearer
structure.

No intentional functional change.

3 years agoRemove outdated comment. We got all httpd headers from the fcgi server
florian [Sat, 15 May 2021 15:08:31 +0000 (15:08 +0000)]
Remove outdated comment. We got all httpd headers from the fcgi server
at this point.

3 years agoRemove OUTPUT_FORMAT and OUTPUT_ARCH from linker script. These are
kettenis [Sat, 15 May 2021 14:20:11 +0000 (14:20 +0000)]
Remove OUTPUT_FORMAT and OUTPUT_ARCH from linker script.  These are
no-ops for ld.lld.

ok deraadt@

3 years agopmap_fault_fixup() does not need "int user"
deraadt [Sat, 15 May 2021 14:05:35 +0000 (14:05 +0000)]
pmap_fault_fixup() does not need "int user"
ok kettenis

3 years agoimprove comment regarding child_return() clearing errno-indicating flag
deraadt [Sat, 15 May 2021 13:56:56 +0000 (13:56 +0000)]
improve comment regarding child_return() clearing errno-indicating flag

3 years agoAdd pledge for ftpd's user processes.
jan [Sat, 15 May 2021 13:37:43 +0000 (13:37 +0000)]
Add pledge for ftpd's user processes.

OK tobhe@

3 years agoUse intr_enable()/int_disable()/intr_restore() instead of
kettenis [Sat, 15 May 2021 11:30:27 +0000 (11:30 +0000)]
Use intr_enable()/int_disable()/intr_restore() instead of
enable_interrupts()/disable_interrupts()/restore_interrupts() and remove
the latter interfaces.

While there move a few malloc(9) and free(9) calls to run with interrupts
enabled.

ok patrick@

3 years agoFix IPsec NAT-T to work with pipex(4). Introduce a new packet tag
yasuoka [Sat, 15 May 2021 08:07:20 +0000 (08:07 +0000)]
Fix IPsec NAT-T to work with pipex(4).  Introduce a new packet tag
PACKET_TAG_IPSEC_FLOWINFO to specify the IPsec flow.

ok mvs

3 years agoLoad the fault handler into the correct register.
drahn [Sat, 15 May 2021 00:04:32 +0000 (00:04 +0000)]
Load the fault handler into the correct register.
Having the onfault dance in a macro makes this almost unreadable.
Initial failure found by deraadt, cause finally found.

3 years agoShuffle GPT_read() code into a nice switch{}, eliminating
krw [Sat, 15 May 2021 00:01:21 +0000 (00:01 +0000)]
Shuffle GPT_read() code into a nice switch{}, eliminating
unnecesary read of primary GPT when only the secondary GPT
is requested.

No intentional functional change.

3 years agoWhitespace tweaks and a couple of stray u_int* in gpt_chk_mbr().
krw [Fri, 14 May 2021 21:11:15 +0000 (21:11 +0000)]
Whitespace tweaks and a couple of stray u_int* in gpt_chk_mbr().

No intentional functional change.

3 years agowhitespace/KNF
tb [Fri, 14 May 2021 18:03:42 +0000 (18:03 +0000)]
whitespace/KNF

3 years agoamd64: specialreg.h: add MSR_TSC_ADJUST
cheloha [Fri, 14 May 2021 16:44:38 +0000 (16:44 +0000)]
amd64: specialreg.h: add MSR_TSC_ADJUST

Where available, the IA32_TSC_ADJUST MSR may be used to make race-free
relative adjustments to a logical CPU's TSC.  The value in the
register is interpreted as a signed 64-bit offset and added to the
"real" value of the TSC whenever the TSC MSR is read.  That is:

RDTSC = REAL_TSC + TSC_ADJUST

and:

RDMSR TSC = REAL_TSC + TSC_ADJUST

For example, if REAL_TSC=1 and TSC_ADJUST=1, then RDTSC would yield 2.
Or if REAL_TSC=10 and TSC_ADJUST=-5, then RDTSC would yield 5.

Writing TSC_ADJUST does not change the "real" underlying value of the
TSC.  Said another way setting TSC_ADJUST to zero will always undo any
prior adjustment.  This property may be useful in fixing desynchronized
TSCs.  In particular, buggy firmware may erroneously desynchronize a
normally synchronized TSC.  If this happens, in theory we can do:

wrmsr(MSR_TSC_ADJUST, 0);

and fix any desynchronization during boot/resume with no fuss.

ok mlarkin@

3 years agoTweak the two copies of gpt_chk_mbr() to return the index of the MBR
krw [Fri, 14 May 2021 15:31:01 +0000 (15:31 +0000)]
Tweak the two copies of gpt_chk_mbr() to return the index of the MBR
0xEE (DOSPTYP_EFI) partition, or -1 no usable such partition is found.

Adopt a consistent idiom to capture the index for future use.

Clean up the gpt_chk_mbr() logic to make it clearer what constraints
are being applied when looking for the DOSTYP_EFI partition.

No intentional functional change.

3 years agoProperly refer to ioctl(2)
kn [Fri, 14 May 2021 13:10:20 +0000 (13:10 +0000)]
Properly refer to ioctl(2)

From Caspar Schutijser, thanks.

3 years agoImprove libcrypto obj_xref.h generator
inoguchi [Fri, 14 May 2021 10:50:55 +0000 (10:50 +0000)]
Improve libcrypto obj_xref.h generator

Modify objxref.pl to output $OpenBSD$ header and
__BEGIN_HIDDEN_DECLS / __END_HIDDEN_DECLS .

ok and comment from tb@

3 years agoremove comment describing GENERIC
jsg [Fri, 14 May 2021 08:10:39 +0000 (08:10 +0000)]
remove comment describing GENERIC

3 years agoadd dwge(4) to RAMDISK as well
jsg [Fri, 14 May 2021 06:55:19 +0000 (06:55 +0000)]
add dwge(4) to RAMDISK as well

3 years agoremove uneeded includes
jsg [Fri, 14 May 2021 06:48:52 +0000 (06:48 +0000)]
remove uneeded includes

3 years agomove some files to match other archs
jsg [Fri, 14 May 2021 05:21:00 +0000 (05:21 +0000)]
move some files to match other archs

ok deraadt@ drahn@

3 years agofix previous: test saved no_shell_flag, not the one that just got
djm [Fri, 14 May 2021 05:20:32 +0000 (05:20 +0000)]
fix previous: test saved no_shell_flag, not the one that just got
clobbered

3 years agoRiscv64 sets. Initial attempt.
drahn [Fri, 14 May 2021 03:49:18 +0000 (03:49 +0000)]
Riscv64 sets. Initial attempt.

3 years agoFix ssh started with ControlPersist incorrectly executing a shell
djm [Fri, 14 May 2021 03:09:48 +0000 (03:09 +0000)]
Fix ssh started with ControlPersist incorrectly executing a shell
when the -N (no shell) option was specified. bz3290 reported by
Richard Schwab; patch from markus@ ok me

3 years agoEnable riscv64 native kernel builds.
drahn [Fri, 14 May 2021 03:01:24 +0000 (03:01 +0000)]
Enable riscv64 native kernel builds.
remove extra targets

3 years agoOn riscv64, dynamically linked clang binary fails with:
drahn [Fri, 14 May 2021 02:29:00 +0000 (02:29 +0000)]
On riscv64, dynamically linked clang binary fails with:
libc++abi: Pure virtual function called!

By statically linking clang (and *-tblgen) this problem is worked around
at least for now.

3 years agoFix bootloader name and riscv64 doesn't have bsd.mp yet.
drahn [Fri, 14 May 2021 02:21:34 +0000 (02:21 +0000)]
Fix bootloader name and riscv64 doesn't have bsd.mp yet.

3 years agoAdjust ramdisk generation for self hosting, remove cross bits.
drahn [Fri, 14 May 2021 01:18:52 +0000 (01:18 +0000)]
Adjust ramdisk generation for self hosting, remove cross bits.