Commit Graph

144474 Commits

Author SHA1 Message Date
maxv
65e39aee46 Reorder the functions, and constify setstate. No functional change. 2019-02-23 08:19:16 +00:00
mlelstv
8e117ced4e Reserve major number for spi driver 2019-02-23 07:33:20 +00:00
kamil
0fe7e51662 Add KCOV - kernel code coverage tracing device
The KCOV driver implements collection of code coverage inside the kernel.
It can be enabled on a per process basis from userland, allowing the kernel
program counter to be collected during syscalls triggered by the same
process.

The device is oriented towards kernel fuzzers, in particular syzkaller.

Currently the only supported coverage type is -fsanitize-coverage=trace-pc.

The KCOV driver was initially developed in Linux. A driver based on the
same concept was then implemented in FreeBSD and OpenBSD.

Documentation is borrowed from OpenBSD and ATF tests from FreeBSD.

This patch has been prepared by Siddharth Muralee, improved by <maxv>
and polished by myself before importing into the mainline tree.

All ATF tests pass.
2019-02-23 03:10:05 +00:00
macallan
9a79811e23 some register bits are defined differently by SunOS's sxreg.h and the SPAM
manual, upon investigation the hardware appears to agree with the SunOS header,
so adapt accordingly
2019-02-22 23:01:25 +00:00
maxv
b4b0af39d9 Fix omission: if we receive a guest trap on CR0, and if the original
instruction would have resulted in Long Mode being enabled, we need to
manually enable Long Mode ourselves. We were already doing that correctly
in setstate, but not in the CR0 trap handler.

Problem initially reported by Aymeric Vincent; ArchLinux wouldn't boot,
now it does and works correctly.

While here, add CR0_ET in the CR0 mask, for the associated shadow to
be taken into account. Normally this shadow bit shouldn't be necessary,
but for now I keep it regardless.
2019-02-22 12:24:34 +00:00
msaitoh
2330b84d98 Fix a bug that if_link_state_change(ifp, LINK_STATE_DOWN) isn't called unless
link goes up at least one time. Without this change, never linkup-ed media
keeps LINK_STATE_UNKNOWN instead of LINK_STATE_DOWN.
2019-02-22 06:49:15 +00:00
christos
ae4f322282 PR/53998: Joel Bertrand: Return ENOSPC when SEM_NSEMS_MAX is exceeded
instead of -1.
2019-02-21 21:49:23 +00:00
christos
0abcbcb46c add a lint(1) comment to nothing. 2019-02-21 21:34:05 +00:00
msaitoh
79244d2c8e Revision 2..5 == RTL8211B...F 2019-02-21 15:41:56 +00:00
maxv
cb8f467cc0 Remove wrong KASSERT in EPT, and reorder the code to reduce duplication. 2019-02-21 14:31:54 +00:00
maxv
01d6ce2a3a Reorder the detection in vmx_ident(), to fix panic on old CPUs. We must
read MSR_IA32_VMX_EPT_VPID_CAP _after_ ensuring EPT is there, because if
it's not, the rdmsr faults.
2019-02-21 13:25:44 +00:00
maxv
fa98071a47 Another locking issue in NVMM: the {svm,vmx}_tlb_flush functions take VCPU
mutexes which can sleep, but their context does not allow it.

Rewrite the TLB handling code to fix that. It becomes a bit complex. In
short, we use a per-VM generation number, which we increase on each TLB
flush, before sending a broadcast IPI to everybody. The IPIs cause a
#VMEXIT of each VCPU, and each VCPU Loop will synchronize the per-VM gen
with a per-VCPU copy, and apply the flushes as neededi lazily.

The behavior differs between AMD and Intel; in short, on Intel we don't
flush the hTLB (EPT cache) if a context switch of a VCPU occurs, so now,
we need to maintain a kcpuset to know which VCPU's hTLBs are active on
which hCPU. This creates some redundancy on Intel, ie there are cases
where we flush the hTLB several times unnecessarily; but hTLB flushes are
very rare, so there is no real performance regression.

The thing is lock-less and non-blocking, so it solves our problem.
2019-02-21 12:17:52 +00:00
maxv
9f7d8f06c3 Clarify the gTLB code a little. 2019-02-21 11:58:04 +00:00
hannken
42e8a0834e Fix bad assertion: vfs_suspend(dead_rootmount) may happen and
must return EOPNOTSUPP.
2019-02-21 08:52:53 +00:00
mrg
fccaa949ae include libkern.h or strings.h. should fix i386 build issues. 2019-02-21 08:25:00 +00:00
knakahara
1da2d3b232 Fix panic when wm(4) is reattached. ok by msaitoh@n.o.
This panic occured after kern_rndq.c:r1.90.
2019-02-21 08:10:22 +00:00
mrg
543c86fd13 fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)
2019-02-21 05:02:20 +00:00
mrg
39e3203eaa for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles.  there
     are at least 3 different ones changed here.
2019-02-21 03:37:18 +00:00
christos
b3b9361cff handle O_NOSIGPIPE too. 2019-02-20 19:42:14 +00:00
macallan
7ead432177 moar match string 2019-02-20 18:19:46 +00:00
msaitoh
46a6566ee5 - Add support for BCM5762 ASIC devices.
- Add BCM5762, BCM5725, BCM5727, BCM57764, BCM57767 and BCM57787.
2019-02-20 17:00:20 +00:00
msaitoh
403b39d97a Add BCM5702FE, another BCM5704S and SysKonnect SK-9Mxx support. 2019-02-20 15:56:51 +00:00
hannken
e28265c95c - Make the fstrans mount info part of the per-lwp state and replace
most accesses to the mount with fstrans mount info.

- Add "fmi_gone" to be true after unmount and add a counter of
  outstanding mount infos so fstrans_clear_lwp_info() only runs
  if there may be something to do.

- Move lookup of base mounts into per-lwp state.

- Keep a list of valid mounts for DIAGNOSTIC checks.
2019-02-20 10:09:45 +00:00
hannken
583a153e11 Move fstrans_unmount() to vfs_rele(), just before it would free the mount.
Don't take a mount reference for fstrans as it gets notified about the release.

Defer the final free of the mount to fstrans_mount_dtor() when fstrans
has released all references to this mount.  Prevents the mount's memory
to be reused as a new mount before fstrans released all references.

Address PR kern/53928 modules/t_builtin:disable test case randomly fails.
2019-02-20 10:08:37 +00:00
hannken
f421b3668b Attach "mnt_transinfo" to "dead_rootmount" so every mount has a
valid "mnt_transinfo" and remove now unneeded flag IMNT_HAS_TRANS.

Run fstrans_start()/fstrans_done() on dead_rootmount if FSTRANS_DEAD_ENABLED.
Should become the default for DIAGNOSTIC in the future.
2019-02-20 10:07:27 +00:00
hannken
a041391e45 Assign vnode to dead_rootmount before vcache_dealloc() releases it.
Now v_mount is never NULL.
2019-02-20 10:06:33 +00:00
hannken
2df7877a09 Set "mnt_lower" before the first file system operation on the new file system. 2019-02-20 10:05:59 +00:00
hannken
3c4b857dd5 Bracket do_sys_renameat() and nfsrv_rename() with fstrans.
The v_mount field for vnodes on the same file system as "from"
is now stable for referenced vnodes.

VFS_RENAMELOCK no longer may use lock from an unreferenced and
freed "struct mount".
2019-02-20 10:05:20 +00:00
hannken
8d939a9270 Fix vnode locking, must lock for VOP_OPEN() and VOP_UNLOCK() when done. 2019-02-20 10:04:28 +00:00
hannken
836873044c Remove superfluous VOP_UNLOCK(), vnode will be unlocked from spec_reclaim(). 2019-02-20 10:03:55 +00:00
hannken
b783399854 Make FSS_ERROR a flag to prevent bogus fscow_disestablish() after error. 2019-02-20 10:03:25 +00:00
hannken
936247f806 Fix vnode locking for opendisk(), must lock for VOP_OPEN(). 2019-02-20 10:02:51 +00:00
pgoyette
4d21548422 compat70_ocreds_valid is not a pointer to a boolean, it is the boolean
itself which controls whether or not we recognize the OCRED options.

Should fix the panic identified in PR kern/53991 (awaiting confirmation
from submitter).
2019-02-20 09:59:39 +00:00
msaitoh
c666e7f586 Simplify PCI device table. No functional change. 2019-02-20 08:03:58 +00:00
msaitoh
8ab6db13a3 Regen. 2019-02-20 07:47:34 +00:00
msaitoh
389a3a7d24 Add SK-NET SK-9Mxx Gigabit Ethernet. 2019-02-20 07:47:11 +00:00
mrg
2ca163b231 use KASSERTMSG() in netbsd32_ptr32i(). 2019-02-20 06:04:28 +00:00
rin
184dcf3f8a WARNS=3 for compat_netbsd32_* in order to appease sign-compare warnings
for mips64, where NETBSD32_POINTER_TYPE is signed.
2019-02-20 05:11:30 +00:00
msaitoh
340e8542ab Add BCM5717's another device ID support. 2019-02-20 04:49:08 +00:00
msaitoh
3da8db6fff Regen. 2019-02-20 03:57:28 +00:00
msaitoh
25c6288c9f Add some Broadcom Ethernet devices from {Open,Free}BSD. 2019-02-20 03:57:03 +00:00
pgoyette
2d6aca9e32 Another WARNS=3 module 2019-02-20 01:20:16 +00:00
pgoyette
0347dde6b5 Another module that needs WARNS=3 to allow signed-vs-unsigned compares 2019-02-20 00:55:03 +00:00
msaitoh
6c3f577b44 Modify PHY tree in comment. 2019-02-19 07:59:17 +00:00
msaitoh
1efa1b3edc Match 82580(I340) and I350. 2019-02-19 07:49:58 +00:00
mlelstv
1c2c54d450 Don't allow MNT_UNION on the root, there is no covered filesystem.
Fixes PR 53850
2019-02-19 06:55:28 +00:00
msaitoh
81ef376cbf - Match Intel I21[01]. These chips' model number is wrongly set to 0
(== 88E1000 with model number 0). It seems the PHY function is almost the
  same as 88E1512. When we add 88E1512 related change to makphy.c, I21[01]
  should be take into account.
- KNF.
2019-02-19 05:47:08 +00:00
msaitoh
779af22758 Fix duplicated LEVEL1_LXT1000_OLD entry. I suspect one of them is
LEVEL1_LXT1000.
2019-02-19 02:51:02 +00:00
mrg
faeb5b8616 convert 'extern long intrnames' to 'extern char intrnames[MAX_INAME_LENGTH]'.
also, assert that MAX_INAME_LENGTH is not larger than eintrnames - intrnames.

fixes gcc 7's object size checker checks.  tested by martin@.
2019-02-19 00:34:50 +00:00
christos
970c63d326 revert the upsteam portion of previous; we don't want to patch upstream
fallthrough/breaks.
2019-02-19 00:30:16 +00:00