Commit Graph

271486 Commits

Author SHA1 Message Date
maxv 8a98cb54cb Mark several kASan functions with __nothing, to avoid annoying #ifdefs.
Same as kCSan and kMSan.
2019-11-14 17:09:22 +00:00
maxv 59b172a87d Don't include "opt_kcsan.h" since there's already <sys/csan.h> included. 2019-11-14 16:56:13 +00:00
maxv 8965522558 Don't include "opt_kasan.h" when there's already <sys/asan.h> included. 2019-11-14 16:48:51 +00:00
maxv 7483976de6 Note kMSan. 2019-11-14 16:27:26 +00:00
maxv 10c5b02320 Add support for Kernel Memory Sanitizer (kMSan). It detects uninitialized
memory used by the kernel at run time, and just like kASan and kCSan, it
is an excellent feature. It has already detected 38 uninitialized variables
in the kernel during my testing, which I have since discreetly fixed.

We use two shadows:
 - "shad", to track uninitialized memory with a bit granularity (1:1).
   Each bit set to 1 in the shad corresponds to one uninitialized bit of
   real kernel memory.
 - "orig", to track the origin of the memory with a 4-byte granularity
   (1:1). Each uint32_t cell in the orig indicates the origin of the
   associated uint32_t of real kernel memory.

The memory consumption of these shadows is consequent, so at least 4GB of
RAM is recommended to run kMSan.

The compiler inserts calls to specific __msan_* functions on each memory
access, to manage both the shad and the orig and detect uninitialized
memory accesses that change the execution flow (like an "if" on an
uninitialized variable).

We mark as uninit several types of memory buffers (stack, pools, kmem,
malloc, uvm_km), and check each buffer passed to copyout, copyoutstr,
bwrite, if_transmit_lock and DMA operations, to detect uninitialized memory
that leaves the system. This allows us to detect kernel info leaks in a way
that is more efficient and also more user-friendly than KLEAK.

Contrary to kASan, kMSan requires comprehensive coverage, ie we cannot
tolerate having one non-instrumented function, because this could cause
false positives. kMSan cannot instrument ASM functions, so I converted
most of them to __asm__ inlines, which kMSan is able to instrument. Those
that remain receive special treatment.

Contrary to kASan again, kMSan uses a TLS, so we must context-switch this
TLS during interrupts. We use different contexts depending on the interrupt
level.

The orig tracks precisely the origin of a buffer. We use a special encoding
for the orig values, and pack together in each uint32_t cell of the orig:
 - a code designating the type of memory (Stack, Pool, etc), and
 - a compressed pointer, which points either (1) to a string containing
   the name of the variable associated with the cell, or (2) to an area
   in the kernel .text section which we resolve to a symbol name + offset.

This encoding allows us not to consume extra memory for associating
information with each cell, and produces a precise output, that can tell
for example the name of an uninitialized variable on the stack, the
function in which it was pushed on the stack, and the function where we
accessed this uninitialized variable.

kMSan is available with LLVM, but not with GCC.

The code is organized in a way that is similar to kASan and kCSan, so it
means that other architectures than amd64 can be supported.
2019-11-14 16:23:52 +00:00
martin b76c9f8f6f Make tar extraction flags depend on our usage of pax-as-tar or bsdtar. 2019-11-14 13:58:22 +00:00
martin cced830f6a For gcc < 9 disable stringop-overflow warnings - they are broken. 2019-11-14 13:16:35 +00:00
mrg a782ceec24 duplicate a some of Makefile.gnuhost.
should fix PR#53561.
2019-11-14 09:27:08 +00:00
msaitoh 98fe4013b6 Revert previous. Sorry. 2019-11-14 09:15:12 +00:00
msaitoh ac2cbdda1a Add D-Link DGE-530T C1 and TP-Link TG-3468 v2. 2019-11-14 09:11:35 +00:00
msaitoh 6a2066383c Regen. 2019-11-14 09:11:05 +00:00
msaitoh 433440a185 Add D-Link DGE-530T C1 and TP-Link TG-3468 v2. 2019-11-14 09:10:41 +00:00
msaitoh 0261fff81e - Use auto-negotiation when forcing 1000BASE-T.
- Add XXX comment for strange pause setting code. I suspect this is wrong.
- On my environments, 1000BASE-T half duplex doesn't work, so we might remove
  IFM_1000T_HDX from this device in future.
2019-11-14 09:06:21 +00:00
msaitoh 45485586e6 STGE_PhyCtrl is not PHY register but MAC register, so use ukphy_status()
for IP1000A device.
2019-11-14 09:00:23 +00:00
msaitoh e3b7337f95 KNF. No functional change. 2019-11-14 08:52:34 +00:00
hauke 61935312a7 The 16C1054 and 16C1058 serial multi-port controllers need a clock
multiplier of 8, just like the 16C1050 controller.

Verified with an ExSys EX-41388.

ryo@ checked back with the hardware his original commit was based on,
and confirmed the change.

XXX Pull-up to netbsd-{7,8,9}
2019-11-14 08:49:48 +00:00
tkusumi 50e304a6be autofs: Whitespace fix 2019-11-14 08:45:24 +00:00
hkenken 0ac14ebd3f Fixed bug. 2019-11-14 06:00:16 +00:00
msaitoh 5e1508fc9e Fix comment. 2019-11-14 04:14:30 +00:00
knakahara d00f6f3b19 Reduce load for IKE negotiations when the system has many IPv6 addresses.
e.g. the system has many vlan(4), gif(4) or ipsecif(4) with link local address.
2019-11-14 03:17:08 +00:00
uki dab314a7bd Fix uncorrect package name in xdebug mi 2019-11-14 02:27:18 +00:00
joerg 8a61152dc6 Mark old LLVM instance as dead. 2019-11-13 22:34:11 +00:00
joerg 3cdbfa93d9 Restore pax-as-tar. 2019-11-13 22:32:16 +00:00
joerg e8e92eea69 Mark old LLVM instance as dead. 2019-11-13 22:19:09 +00:00
joerg d053cf4338 Remove old LLVM build system. 2019-11-13 22:03:31 +00:00
martin be173c6428 Drop MBR and cloning support on crunched install media. 2019-11-13 18:58:09 +00:00
martin 485d530922 Make cloning support optional, so we can save some space on very small
install media.
2019-11-13 18:57:26 +00:00
tsutsui 95d09e50d8 Make zaurus kernels use symbol tables loaded by the bootloader.
Now COPY_SYMTAB is no longer necessary and it saves ~500kbytes of
GENERIC, so re-enable options DDB (i.e. revert GENERIC rev 1.85).

Also fix zbsdmod.o (a kernel loader for Zaurus Linux) to load symbols
at a proper address as the MI sys/lib/libsa/loadfile_elf32.c does.

No particular comment on port-zaurus@:
 https://mail-index.netbsd.org/port-zaurus/2019/11/11/msg000086.html

Note zbsdmod.c (derived from OpenBSD/zaurus) assumed that the loaded
kernels had "esym" variable at the top of its data section and
implicitly overwrote it with the address of loaded symbol tables.
OpenBSD/zaurus kernels used the esym value written by the zbsdmod.o
to initialize ksyms(4) on startup, but we will avoid such implicit
MD interface between the bootloader and kernels (though we don't
bother to add a symbol address value into bootinfo but just assume
symbols are loaded at end[] of a loaded kernel, as per the MI
libsa loadfile() implementation).

Worth to pullup to both netbsd-8 and netbsd-9.
2019-11-13 17:59:56 +00:00
tsutsui 05d948a2d3 Fix another attach failure of zaudio(4) WM8731 on Zaurus SL-C7x0/860.
When kernels were configured for both CPU_XSCALE_PXA270 and
CPU_XSCALE_PXA250, the OST freq value was not set until tc_init(9)
then all delay(9) during configure(9) returned immediately.
While here, use proper macro with description for readability.

Should be pulled up to netbsd-8 and netbsd-9.
(though zaudio(4) won't work on netbsd-8)
2019-11-13 17:52:12 +00:00
tsutsui bc98febd83 Fix attach failure of zaudio(4) WM8731 (C7x0/860) and WM8750 (C1000/3x00).
The new MI iic(4) layer requires an explicit quirk info of PROBE_STRATEGY
via device properties.  Fixes PR kern/54658.

Should be pulled up to netbsd-9.
2019-11-13 17:48:03 +00:00
pgoyette 84fd172ef5 Clean-up unnecessary inclusions of opt_coredump.h 2019-11-13 16:11:27 +00:00
pgoyette 86069f283e Return success if no coredump module is loaded/hooked. 2019-11-13 15:48:36 +00:00
maxv d0dbdfd3b6 Rename:
PP_ATTRS_M -> PP_ATTRS_D
	PP_ATTRS_U -> PP_ATTRS_A
For consistency.
2019-11-13 12:55:10 +00:00
roy a40a006166 Note import of dhcpcd-8.1.2 2019-11-13 10:52:40 +00:00
roy 8372335280 Sync 2019-11-13 10:50:22 +00:00
roy de0c8b824b Import dhcpcd-8.1.2 with the following changes:
* hooks: STOPPED is now run on timeout and exit
 * BSD: Use IP_REVCIF rather than IN_PKTINFO
 * DHCP: When rebinding, ensure we have a DHCP ARP state
 * RA: Sort routers when reachability changes
 * RA: Apply hoplimit, reachable and retrans timer values to kernel
 * RA: Warn if advertised MTU > interface MTU
 * dhcpcd: Report SSID connection to when we gain carrier
 * DHCP: Fix corruption of address flags when renewing
2019-11-13 10:49:19 +00:00
maxv 29441e93f4 Use x86_patch_window_{open,close}. This also fixes a bug: the CR0/PSL
reloads were inverted.
2019-11-13 10:13:41 +00:00
nakayama 4ebf749c20 Revert workarounds for clang.
In-tree clang can now handle the "r" asm constraint for 64-bit values properly.
2019-11-13 10:06:38 +00:00
martin c2a6468f90 Mention LLVM fallout 2019-11-13 09:59:02 +00:00
maxv 27e09b45b8 Switch to the new PTE naming. 2019-11-13 09:47:37 +00:00
hkenken 3783461dd0 Add support "phy-reset-post-delay". 2019-11-13 07:56:10 +00:00
isaki 8799519c62 Add some audio drivers in SEE ALSO. 2019-11-13 07:52:25 +00:00
hikaru 8c80fd2599 Disable MSI-X before writing the MSI-X table.
That fixes MSI-X interrupt lost on VMware ESXi 6.7 PCI passthrough devices.

ok knakahara@
2019-11-13 02:54:59 +00:00
ozaki-r a8d6848953 Get rid of unnecessary NULL checks for rt_ifa and ifa_ifp
They are always non-NULL nowadays.
2019-11-13 02:51:22 +00:00
mrg d96b7a130a put the ucode not found message under #ifdef DEBUG. use printf()
instead of aprint_error().

there's an error returned to userland and displayed by cpuctl.
2019-11-13 01:31:47 +00:00
kre a4e7b926c7 Appease gcc. Init "terminator".
It is plainly obvious that the init value cannot be used (the
var was never used uninit'd - could not be) but gcc apparently cannot
work that out.   Revert this if we ever get a compiler with a brain.
2019-11-13 00:19:46 +00:00
christos cfe16cc4b6 remove debugging. 2019-11-12 23:54:34 +00:00
christos 341414cc0c new tmux 2019-11-12 21:03:49 +00:00
christos 29e2eaddc1 new files and bump version 2019-11-12 21:02:46 +00:00
christos 0a274e8662 merge conflicts 2019-11-12 21:02:28 +00:00