Commit Graph

275890 Commits

Author SHA1 Message Date
jdolecek
a6db9077db remove the In-System design note, related code is about to be dropped and
it doesn't make sense to have a note about things we don't support
2020-04-13 09:15:54 +00:00
wiz
6618bd8ba0 Remove superfluous whitespace & macros. 2020-04-13 08:59:14 +00:00
wiz
5f0ae7a9b4 Fix date. Remove Xr to non-existent modem(4). Serial comma. Use more macros. 2020-04-13 08:46:39 +00:00
wiz
0e961a0fbe Bump date for previous 2020-04-13 08:45:11 +00:00
skrll
d2599c324c Trailing whitespace 2020-04-13 08:05:22 +00:00
maxv
babb6cb124 constify 2020-04-13 08:05:02 +00:00
maxv
ca0e57e059 Add KASAN instrumentation on on-stack VLAs, same as amd64. 2020-04-13 07:32:36 +00:00
skrll
fe8087d6bb Oops, forgot the empty macro version of UVMHIST_CALLARGS 2020-04-13 07:11:08 +00:00
maxv
72d0b9e79b Add KASAN-DMA support on aarch64, same as amd64. Discussed with skrll@. 2020-04-13 07:09:50 +00:00
maxv
802484fb54 Note PAC and BTI. 2020-04-13 06:24:52 +00:00
maxv
c555b23ca7 Meant to do a store here, not a load. Ie we want to replace the initial
weak key by the stronger one we just generated.

Rototilled this place too many times.
2020-04-13 06:02:03 +00:00
maxv
2ddb9fdee7 Add support for Branch Target Identification (BTI).
On the executable pages that have the GP (Guarded Page) bit, the semantic
of the "br" and "blr" instructions is changed: the CPU expects the first
instruction of the jump/call target to be "bti", and faults if it isn't.

We add the GP bit on the kernel .text pages (and incidentally the .rodata
pages, but we don't care). The compiler adds a "bti c" instruction at the
beginning of each C function. We modify the ENTRY() macros to manually add
"bti c" in the asm functions.

cpuswitch.S needs a specific change: with "br x27" the CPU expects "bti j",
which is bad because the functions begin with "bti c"; switch to "br x16",
for the CPU to accept "bti c".

BTI helps defend against JOP/COP. Tested on Qemu.
2020-04-13 05:40:25 +00:00
chs
328da78dac slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit()
and pool_prime() (and their pool_cache_* counterparts):

 - the pool_set*wat() APIs are supposed to specify thresholds for the count of
   free items in the pool before pool pages are automatically allocated or freed
   during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime()
   are supposed to specify minimum and maximum numbers of total items
   in the pool (both free and allocated).  these were somewhat conflated
   in the existing code, so separate them as they were intended.

 - change pool_prime() to take an absolute number of items to preallocate
   rather than an increment over whatever was done before, and wait for
   any memory allocations to succeed.  since pool_prime() can no longer fail
   after this, change its return value to void and adjust all callers.

 - pool_setlowat() is documented as not immediately attempting to allocate
   any memory, but it was changed some time ago to immediately try to allocate
   up to the lowat level, so just fix the manpage to describe the current
   behaviour.

 - add a pool_cache_prime() to complete the API set.
2020-04-13 00:27:16 +00:00
christos
97cf9247a5 make sure that 0 length files get their extattrs cleaned up on deletion
(there was an optimization to not call truncate if size == 0).
2020-04-12 23:52:20 +00:00
christos
44988dfe00 put back the MODULAR attributes accidentally removed. 2020-04-12 22:06:17 +00:00
jdolecek
edaf68a84d convert to bus_dma(9)
simplify and fix error handling in xbd_handler(), expect backend
to not use the grant once request is finished, and avoid leaking
bounce buffer when the request using it happens to end with error

in xbd_diskstart() only do the RING_PUSH_REQUESTS_AND_CHECK_NOTIFY()
when actually the request was pushed successfully
2020-04-12 20:17:36 +00:00
christos
576580f188 Oops missed one more NULL -> NOCRED 2020-04-12 19:56:14 +00:00
jdolecek
dc571659e3 add KASSERT() for unaligned case to make sure it indeed happens only
for requests via physio
2020-04-12 18:14:09 +00:00
leot
b3e8ee064c Hack removed in src/external/bsd/nvi/usr.bin/nvi/Makefile,-r1.21
It is no longer needed, per PR bin/54656.
2020-04-12 17:49:00 +00:00
martin
43c6dc4bfb Remove no longer needed workaround for PR/54656. 2020-04-12 17:28:57 +00:00
tsutsui
e68b02666c Fix typo. 2020-04-12 17:13:29 +00:00
jdolecek
928ca612c6 fix wapbl_discard() to actually discard the queued bufs properly - need
to set BC_INVAL for them, and also need to explicitly remove them
from the BQ_LOCKED queue

fixes DIAGNOSTIC panic when force unmounting unresponsive disk device
PR kern/51178 by Michael van Elst
2020-04-12 17:02:52 +00:00
christos
3df74130fb delete debugging printf. 2020-04-12 15:55:53 +00:00
skrll
e4535b97c1 Use UVMHIST_CALLARGS 2020-04-12 15:36:18 +00:00
jdolecek
f34e84b48d move IFNET_UNLOCK() immediatelly after xennet_stop() call in detach,
doesn't need to be held for the disestablish
2020-04-12 13:57:07 +00:00
jdolecek
50cec821c5 fix locking against myself panic in xennet_stop() on 'ifconfig xennet0 down'
xennet_stop() is called with IFNET already held
2020-04-12 13:55:06 +00:00
christos
cbdaa54f3d change ' \t' to '\t' 2020-04-12 13:37:12 +00:00
christos
26abce9608 Change STD[:random-whitespace:]RUMP to STD\tRUMP 2020-04-12 13:30:16 +00:00
christos
edebee1e1b Pass NOCRED instead of NULL for credentials. These routines are supposed
to be accessing system ACL's on behalf of the kernel. This code appears
to be copied from FreeBSD, but there it works because in FreeBSD NOCRED
is 0, ours is -1. I guess nobody has used system extended attributes on
NetBSD yet :-)
2020-04-12 13:12:42 +00:00
roy
6530896d01 nd6: RTM_MISS reports RTA_AUTHOR once more
Just moves the logic to send RTM_MISS after the ICMP6 report as we
rely on that function to extract the requesting address.

Fixes PR kern/55164.
2020-04-12 12:13:52 +00:00
jdolecek
cc83ef657f fix race between wapbl_discard() and wapbl_biodone() on forced
unmount on shutdown with slow I/O device

wapbl_discard() needs to hold both wl_mtx and bufcache_lock while
manipulating wl_entries - the rw lock is not enough, because
wapbl_biodone() only takes wl_mtx while removing the finished entry
from list

wapbl_biodone() must take bufcache_lock before reading we->we_wapbl,
so it's blocked until wapbl_discard() finishes, and takes !wl path
appropriately

this is supposed to fix panic on shutdown:
[ 67549.6304123] forcefully unmounting / (/dev/wd0a)...
...
[ 67549.7272030] panic: mutex_vector_enter,510: uninitialized lock (lock=0xffffa722a4f4f5b0, from=ffffffff80a884fa)
...
[ 67549.7272030] wapbl_biodone() at netbsd:wapbl_biodone+0x4d
[ 67549.7272030] biointr() at netbsd:biointr+0x7d
[ 67549.7272030] softint_dispatch() at netbsd:softint_dispatch+0x12c
[ 67549.7272030] Xsoftintr() at netbsd:Xsoftintr+0x4f
2020-04-12 08:51:41 +00:00
maxv
6d94ff13c3 Add support for Pointer Authentication (PAC).
We use the "pac-ret" option, to sign the return instruction pointer on
function entry, and authenticate it on function exit. This acts as a
mitigation against ROP.

The authentication uses a per-lwp (secret) I-A key stored in the 128bit
APIAKey register and part of the lwp context. During lwp creation, the
kernel generates a random key, and during context switches, it installs
the key of the target lwp on the CPU.

Userland cannot read the APIAKey register directly. However, it can sign
its pointers with it, because the register is architecturally shared
between userland and the kernel. Although part of the CPU design, it is
a bit of an undesired behavior, because it allows to forge valid kernel
pointers from userland. To avoid that, we don't share the key with
userland, and rather switch it in EL0<->EL1 transitions. This means that
when userland executes, a different key is loaded in APIAKey than the one
the kernel uses. For now the userland key is a fixed 128bit zero value.

The DDB stack unwinder is changed to strip the authentication code from
the pointers in lr.

Two problems are known:

 * Currently the idlelwps' keys are not really secret. This is because
   the RNG is not yet available when we spawn these lwps. Not overly
   important, but would be nice to fix with UEFI RNG.
 * The key switching in EL0<->EL1 transitions is not the most optimized
   code on the planet. Instead of checking aarch64_pac_enabled, it would
   be better to hot-patch the code at boot time, but there currently is
   no hot-patch support on aarch64.

Tested on Qemu.
2020-04-12 07:49:58 +00:00
jdolecek
432235c8f9 further tweaks for USB_PRODUCT_MICROSOFT_24GHZ_XCVR80 from PR kern/55161
remove case for USB_PRODUCT_MICROSOFT_24GHZ_XCVR70, likely needs similar
tweaks and can't really be added untested
2020-04-12 07:41:11 +00:00
maxv
0c76280ca7 Don't inline cprng_strong{32,64}(), so they can be called from asm. 2020-04-12 07:16:09 +00:00
mrg
978f119b92 base INSTALL kernel upon GENERIC with many "no ...". 2020-04-12 06:05:34 +00:00
simonb
cddaf0cb47 Add NetBSD CVS tag. 2020-04-12 02:04:12 +00:00
htodd
ee948d74b4 Remove ufs_wapbl.c from Makefile. 2020-04-12 01:39:57 +00:00
riastradh
f6b4b12115 Reject overly large widths, from mlelstv.
We are returning an ACPI_INTEGER (= uint64_t), so it doesn't make
sense to handle more than 64 bits.

Apparently there are some ACPIs out there that ask for unreasonably
large widths here.  Just reject those requests, rather than writing
past the caller's stack buffer.

Previously we attempted to fix this by copying byte by byte as large
as the caller asked, in order to avoid the undefined behaviour of
shifting past the size of ACPI_INTEGER, but that just turned a shift
(which might have been harmless on real machines) into a stack buffer
overflow (!).

ok msaitoh
2020-04-12 01:12:03 +00:00
simonb
f5b458adeb Regen. 2020-04-12 01:11:56 +00:00
riastradh
b30a235b91 KNF 2020-04-12 01:11:52 +00:00
riastradh
bb9c42c5fc Revert acpi_ec.c 1.76.
We will do this another way, and separate KNF fixes from the critical
functional change.

ok msaitoh
2020-04-12 01:11:43 +00:00
riastradh
0aae29f3a4 Revert acpi_ec.c 1.77.
We will do this another way.

ok msaitoh
2020-04-12 01:11:23 +00:00
simonb
a91470c59b Add uxrcom driver for Exar XR21V141x USB serial adapters. Based in part
on the OpenBSD single-port XR21V1410 uxrcom driver, but adds support
for multi-port chipsets and uses the common umodem framework instead of
being a standalone driver.

Thanks to skrll@ for much USB clue and mrg@ for financing the
development of this driver.
2020-04-12 01:10:53 +00:00
christos
57004306d0 remove removed file 2020-04-12 00:04:45 +00:00
christos
1712f82d5c We can only use the SHA3 assembly routines if we have VSX 2020-04-11 22:41:06 +00:00
christos
fea87f652c fix tyop 2020-04-11 20:48:53 +00:00
christos
2d9fc2191e Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).
2020-04-11 20:28:28 +00:00
jdolecek
e9acb25cbb revert previous - physio arranges for tranfer directly to user-provided
buffers, which are generally not DEV_BSIZE-aligned
2020-04-11 17:52:01 +00:00
jdolecek
09a46b6e04 remove noncompilable WAPBL_DEBUG_INODES
PR kern/49554 by Thomas Klausner
2020-04-11 17:43:54 +00:00
jdolecek
171fa94db7 adjust to work with updated dkwedge_bsdlabel.c - provide geteblk() and
brelse() which just allocate/free the memory
2020-04-11 17:21:16 +00:00