270660 Commits

Author SHA1 Message Date
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
kamil
2b5fbe86ad Remove compile-time asserts checking whether intptr_t and void* are compat
The checks were requested by core@ as a prerequisite for kevent::udata type
switch from intptr_t to void*.
2019-10-03 22:29:17 +00:00
kamil
5bab8befbf Define LW_DBGSUSPEND in sys/lwp.h
This flag specifies the suspended by debugger property, as used by
PT_SUSPEND in ptrace(2).
2019-10-03 22:26:43 +00:00
kamil
9425a92945 Switch kevent udata from intptr_t void*
Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.
2019-10-03 22:16:52 +00:00
tnn
00bf802c59 annotate __dead 2019-10-03 20:29:19 +00:00
pgoyette
423739174a Since we now have a compat_90 module, the compat_80 module should depend
on it.
2019-10-03 19:56:16 +00:00
tnn
f5cd05759f also add mcx(4) to ALL 2019-10-03 19:01:13 +00:00
tnn
dd6c3e21f8 add mcx(4) to GENERIC
Tested on dual-port ConnectX-4 with 25 Gbit/s AOC
2019-10-03 18:57:38 +00:00
tnn
fa1e872217 change bus_space_map to _x86_memio_map
Resolves bus space reservation conflict between MI and MD code.
Discussion:
http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html
2019-10-03 18:53:08 +00:00
christos
5c84fc8d45 provide a default error function instead of trying to cast exit(3). 2019-10-03 18:12:44 +00:00
christos
d97b323d0b Cast function pointers that take different arguments through void * 2019-10-03 18:02:05 +00:00