270570 Commits

Author SHA1 Message Date
maxv
f6959bf733 Switch to the new PTE naming:
PG_PVLIST -> PTE_PVLIST
	PG_W      -> PTE_WIRED
	PG_FRAME  -> PTE_FRAME

No functional change.
2019-10-05 07:19:49 +00:00
ryoon
dfe601d86e Fix a pasto, uhdiev, bump date 2019-10-05 06:28:50 +00:00
mlelstv
9291400c34 Bail when dkdriver hasn't been initialized. This can happen when
attachment failed or when it hasn't finished yet.
2019-10-05 05:28:44 +00:00
mrg
2d65b962bb add missing break.
(this code is fun.  it has switch inside switch, and both switches
have two cases, one with an identifier and one with a magic number.)
2019-10-05 01:35:26 +00:00
mrg
5ac81857a1 add missing break. 2019-10-05 01:30:28 +00:00
kamil
fa6363e636 Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX
This logic (found in Linux) avoids undefined behavior.

Reported-by: syzbot+8af00519a8688d9903ca@syzkaller.appspotmail.com
2019-10-04 23:20:22 +00:00
brad
2ab41a9a50 For ZFS on NetBSD there are a number of functions called
zfs_netbsd_{create,mknod,link,etc..} that call functions called
zfs_{create,mknod,link,etc..}.  These later functions may return a
error code along with a *vpp that is NULL.  This situation was not
handled by the zfs_netbsd_* functions and would result in a panic in a
number of cases.  The simplest to trigger it was filling up a dataset
or pool resulting in a over quota condition.  An attempt to create
another file, or directory at that point would panic.
2019-10-04 23:06:19 +00:00
kamil
6c69d9fad1 Avoid left shift changing the signedness flag
Reviewed by <mrg>

Reported-by: syzbot+25ac03024cedf27f3368@syzkaller.appspotmail.com
2019-10-04 22:48:45 +00:00
gutteridge
4b075bd22c panic.9: add xrefs to printf(3) and printf(9)
printf(3) fmt strings are referenced in the body, and there might as
well be a cross-reference to other kernel message output functions.
2019-10-04 21:55:00 +00:00
mrg
ea2cbdfdaf add a size_t len to get_iso9660_volname() so it can properly do
bounds checking.

ok martin@
2019-10-04 21:36:02 +00:00
mrg
a164d00c0b convert most sprintf() to snprintf(). 2019-10-04 21:33:57 +00:00
mrg
03c86659de fix a bug gcc 8 picked up: use ~LOCK_NB to look for LOCK_UN,
like the rest of the code does.

from uwe@.
2019-10-04 16:27:00 +00:00
uwe
5e58365557 Undo the confusion. Use separate synopsis lines for -c command with
single argument (sh -c) and command [args ...] forms.
2019-10-04 16:14:05 +00:00
uwe
371c573fa8 The command is not optional. 2019-10-04 15:30:16 +00:00
maxv
6c0e984be8 Misc reordering, to clarify and reduce the diff against amd64. 2019-10-04 15:28:00 +00:00
maya
9e7633eff2 Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction 2019-10-04 15:25:30 +00:00
kamil
ffd5d3e30b Avoid signed integer overflow in ts2timo() for ts->tv_nsec
The condition would be rechecked later again after subtracting start time
and most invalid inputs rejected. In corner cases the current code can
accept certain invalid inputs that will pass checks later and behave like
valid ones (due to signed integer overflow).

Reported-by: syzbot+3a4a07b62558bbbd3baa@syzkaller.appspotmail.com
2019-10-04 14:17:07 +00:00
maya
6b43361992 We might've switched modes, re-init the move cost table again if necessary.
Fixes unlikely segfault on VAX.
2019-10-04 12:46:43 +00:00
mrg
24da319951 remove an always false check and its' "This can never happen?" comment. 2019-10-04 12:34:40 +00:00
mrg
b1be2775ea add missing break. upstream already has it in 5.1.2. 2019-10-04 12:29:05 +00:00
mrg
acf5f8d2ce use memmove() not memcpy() for overlapping regions. 2019-10-04 12:24:32 +00:00
mrg
35c06cd861 replace memcpy() with src bounds overflow with single char write. 2019-10-04 12:24:12 +00:00
mrg
027eb8b5fe add missing break.
surely it is not intended to treat viatech devices with
non VT82C686A's device id as maybe cyrix pci bridges.
2019-10-04 12:23:37 +00:00
maxv
3649cd099c Switch to the new PTE naming. 2019-10-04 12:17:05 +00:00
maxv
2c00ff1b07 Fix definition for MWAIT. It should be bit 11, not 12; 12 is the armed
version.
2019-10-04 12:15:21 +00:00
mrg
8c38a0de66 workaround a GCC 8 warning:
- code that will be unreachable on platforms with
  sizeof(double) != sizeof(unsigned long) triggered an valid out
  of bounds warning.  avoid the error by using sizeof ul.
- also assert that the sizes are the same if entering here.

both from kamil@.
2019-10-04 12:12:47 +00:00
maxv
8f90fd32bc Add definitions for RDPRU, MCOMMIT, GMET and VTE. 2019-10-04 12:11:38 +00:00
christos
7593c5ae24 undo previous, requested by uwe 2019-10-04 12:08:33 +00:00
uwe
612f4075e0 Tweak formatting. 2019-10-04 11:49:48 +00:00
maxv
d275542dfd Rename fpu_eagerswitch to fpu_switch, and add fpu_xstate_reload to
simplify.
2019-10-04 11:47:07 +00:00
mrg
0576183ec8 revert previous; i meant to test first and if you read the comment
immediately above, you can see it is done safely and on purpose.
2019-10-04 11:43:07 +00:00
mrg
f97b85d675 use destination buffer size not source buffer size for strncpy len. 2019-10-04 11:40:43 +00:00
mrg
0af6a5291a use memmove() instead of strncpy() for overlapping strings.
ensure nul termination.
2019-10-04 11:39:44 +00:00
mrg
80df6cf66d adjust fallthru comment. 2019-10-04 11:12:16 +00:00
mrg
628b66af12 turn off various warnings for various things:
- file has looks bogus maybe-uninitialized
- llvm triggers an attribute violation:
  ScheduleDAGInstrs.cpp:1430:14: error: declaration of
    'llvm::raw_ostream& llvm::operator<<(llvm::raw_ostream&, const llvm::ILPValue&)'
    with attribute 'noinline' follows inline declaration [-Werror=attributes]
- ntp and pkg_install have obvious restrict violations, should be
  fixed but i'm avoiding patching upstream code in this pass
- tftp has an array bounds that doesn't seem real issue
- sysinst's partman.c has major problem with passing the same
  string as source and dest in snprintf, as a way to strcat
  with formatting which trip restrict violations.  non trivial
  to fix so for now the warning is elided.
- Xext's XEVI.c has similar issue as partman.c

everyone and GCC 8 gets these warnings turned off for now:

	-Wno-format-truncation
	-Wno-stringop-overflow
	-Wno-stringop-truncation
	-Wno-cast-function-type

as they trip a large amount of code.  most of them should be
investigated, but the few i looked at were not finding actually
real bugs, vs instances of poor coding, so skipping for now.
2019-10-04 09:47:27 +00:00
mrg
f59299f723 give a catch() a variable. gcc 8 is picky:
atf-check.cpp:221:23: error: catching polymorphic type 'class std::runtime_error' by value [-Werror=catch-value=]
2019-10-04 09:19:18 +00:00
mrg
d6b33fe60a avoid access uninitialised memory, found by gcc8, patch by agc@. 2019-10-04 09:16:38 +00:00
mrg
a83f6c1317 msg:
avoid passing the same pointer in multiple arguments for restrict
marked arguments:
- sigaction() wants separate in/out
- use memmove() not memcpy() for overlapping regions (this may fix
  a real bug in nvi -- but it seems unlikely)
- select() wants separate read/write/except
- sigprocmask() wants separate set/oset
2019-10-04 09:01:59 +00:00
mrg
924b11844c copy libc's swab.c into dd as dd_swab(), and remove the restrict.
our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it.  oh well.
2019-10-04 08:57:37 +00:00
mrg
5e850be408 - update README.gcc8 to include current status
- netbsd/arm64 uses 64 byte malloc alignment
- make lsan compile on sparc*, mips*, ppc and arm64 again
- add missing sparc, alpha and i386 abi compat for struct __sanitizer_addrinfo
- avoid linux includes on arm64
- avoid multiply defined __ubsan_handle_cfi_bad_type when UBSAN_CAN_USE_CXXABI
  isn't defined, and, undefine it
- bad_array_length.cc and bad_array_new.cc lose special build rules
- regen arm64 mknative
2019-10-04 08:51:32 +00:00
hkenken
d1b8ea6d7e Remove FDT_INTR_MPSAFE flag. 2019-10-04 06:49:40 +00:00
maxv
36beaf9ddd Add DMA instrumentation in KASAN. We note the original buffer and length in
the map, and check the buffer on each bus_dmamap_sync. This allows us to
find DMA buffer overflows and UAFs, which couldn't be found before because
the device accesses to memory are outside of KASAN's control.
2019-10-04 06:27:42 +00:00
msaitoh
62266216d2 Make clog static. Found by lgtm bot. 2019-10-04 05:48:11 +00:00
christos
7519806b07 use __func__ (c99, c++11) instead of __FUNCTION__ 2019-10-04 01:57:53 +00:00
christos
26a6044aad change 0x% -> %x 2019-10-04 01:53:58 +00:00
christos
c8863f455b deduplicate the conversion function from statvfs -> statfs12 2019-10-04 01:28:02 +00:00
jmcneill
c92c41ebc4 Increase voltage for frequencies above 1GHz 2019-10-04 00:04:28 +00:00
christos
573d865676 Ignore strncpy(foo, bar, sizeof(foo)) for the wtmp fields where we don't
want NUL termination. We can't use pragma's because the old gcc complains
about the new warnings it does not understand.
2019-10-04 00:03:56 +00:00
kamil
96755fb8d4 Add two KASSERTS in the ptrace(2) kernel code
Verify that we will never return empty ptrace_state for CHILD/LWP event.
2019-10-03 23:11:11 +00:00
kamil
a35a4fe3b8 Separate flag for suspended by _lwp_suspend and suspended by a debugger
Once a thread was stopped with ptrace(2), userland process must not
be able to unstop it deliberately or by an accident.

This was a Windows-style behavior that makes threading tracing fragile.
2019-10-03 22:48:44 +00:00