Commit Graph

1770 Commits

Author SHA1 Message Date
mrg cb93b81028 add support for new GCC 9 warnings that may be too much to fix
right now.  new address-of-packed-member and format-overflow
warnings have new GCC_NO_ADDR_OF_PACKED_MEMBER amd
GCC_NO_FORMAT_OVERFLOW variables to remove these warnings.

apply to a bunch of the tree.  mostly, these are real bugs that
should be fixed, but in many cases, only by removing the 'packed'
attribute from some structure that doesn't really need it.  (i
looked at many different ones, and while perhaps 60-80% were
already properly aligned, it wasn't clear to me that the uses
were always coming from sane data vs network alignment, so it
doesn't seem safe to remove packed without careful research for
each affect struct.)  clang already warned (and was not erroring)
for many of these cases, but gcc picked up dozens more.
2020-09-06 07:20:26 +00:00
maxv 4a2e4dc388 nvmm: update copyright headers 2020-09-05 07:22:25 +00:00
martin f834934d77 Skip threxec test pointing at PR 55338, this kills some test beds. 2020-08-29 05:46:34 +00:00
christos 7865465b60 PR/55612: Martin Husemann: libarchive tests pollute /tmp w/o cleanup
Set $TMPDIR to where we are.
2020-08-28 18:46:05 +00:00
gson 9d42296eb9 Only expect the fmod test case to fail when using qemu's TCG CPU emulation,
and not under hardware virtualization such as qemu -accel nvmm.
2020-08-25 13:39:16 +00:00
riastradh c9aa4f445f Fix getrandom() tests.
Use sigaction() without SA_RESTART -- signal() implies SA_RESTART so
we never got the EINTR.

While here, reduce the timeout to something more reasonable so we
don't waste 20min of testbed time if anything goes wrong and the
one-second alarm doesn't fire.
2020-08-25 01:37:38 +00:00
gson 59b669221c Expect a failure to trap unaligned acesses only when running under
qemu's TCG CPU emulation, not when running under hardware virtualization
such as qemu -accel nvmm.
2020-08-24 06:55:16 +00:00
riastradh bbfb23c92a Split getrandom tests into several cases to find out which ones hang. 2020-08-23 17:50:19 +00:00
gson bd4d304f2b Expect failure only when running under qemu's TCG CPU emulation, not
when running under hardware virtualization such as qemu -accel nvmm.
2020-08-23 11:04:58 +00:00
gson 3b030f477c Provide separate functions to check for running under qemu in general
and for running under qemu's built-in TCG CPU emulation (as opposed to
hardware virtualization via NVMM or KVM).
2020-08-23 11:00:18 +00:00
riastradh bdad8b2721 New system call getrandom() compatible with Linux and others.
Three ways to call:

getrandom(p, n, 0)              Blocks at boot until full entropy.
                                Returns up to n bytes at p; guarantees
                                up to 256 bytes even if interrupted
                                after blocking.  getrandom(0,0,0)
                                serves as an entropy barrier: return
                                only after system has full entropy.

getrandom(p, n, GRND_INSECURE)  Never blocks.  Guarantees up to 256
                                bytes even if interrupted.  Equivalent
                                to /dev/urandom.  Safe only after
                                successful getrandom(...,0),
                                getrandom(...,GRND_RANDOM), or read
                                from /dev/random.

getrandom(p, n, GRND_RANDOM)    May block at any time.  Returns up to n
                                bytes at p, but no guarantees about how
                                many -- may return as short as 1 byte.
                                Equivalent to /dev/random.  Legacy.
                                Provided only for source compatibility
                                with Linux.

Can also use flags|GRND_NONBLOCK to fail with EWOULDBLOCK/EAGAIN
without producing any output instead of blocking.

- The combination GRND_INSECURE|GRND_NONBLOCK is the same as
  GRND_INSECURE, since GRND_INSECURE never blocks anyway.

- The combinations GRND_INSECURE|GRND_RANDOM and
  GRND_INSECURE|GRND_RANDOM|GRND_NONBLOCK are nonsensical and fail
  with EINVAL.

As proposed on tech-userlevel, tech-crypto, tech-security, and
tech-kern, and subsequently adopted by core (minus the getentropy part
of the proposal, because other operating systems and participants in
the discussion couldn't come to an agreement about getentropy and
blocking semantics):

https://mail-index.netbsd.org/tech-userlevel/2020/05/02/msg012333.html
2020-08-14 00:53:15 +00:00
maxv d3713544b3 Compile USER_LDT by default, but, put it behind a privileged sysctl that
defaults to disabled. To enable:

	# sysctl -w machdep.user_ldt=1
2020-07-19 14:31:31 +00:00
kamil 07e8492e26 Add ppoll() a compatibility wrapper around pollts(2)
Submitted by Apurva Nandan.
2020-07-17 15:34:16 +00:00
maxv 66af4cddad more 2020-07-03 16:07:52 +00:00
jruoho 04c087f823 Verify that PR lib/55041 is no longer an issue. 2020-07-03 03:13:10 +00:00
jruoho 55abcd082f Add basic checks for a64l(3), l64a(3), and l64a_r(3). 2020-07-01 07:16:37 +00:00
jruoho 7fed543511 Add basic tests for the rest of the mktemp(3) family of functions, including
a case for PR lib/55441.
2020-07-01 05:37:25 +00:00
jruoho 2ba250a115 After a comedy of errors, move t_mbtowc to its final resting place. 2020-06-30 16:09:40 +00:00
maya f728d212f0 Avoid copyright issues and name the listed author as the copyright holder.
In a private email, Miloslav had agreed that if they had written the
test, then it can be licensed bsd-2-clause. I am going to assume this
is true as the file names Miloslav as the author.

This test was likely sent to tcsh (not netbsd) that had changed bug
report systems since.
2020-06-29 20:53:40 +00:00
jruoho db34f12f88 Use -Wl,--no-fatal-warnings for the mktemp(3) test. 2020-06-29 14:22:11 +00:00
jruoho a4f7315844 Add the default TNF copyright (2005), cf. PR misc/55419. 2020-06-27 10:19:43 +00:00
jruoho 21c7d294a2 Start moving the remaining tests from src/regress to src/tests. 2020-06-27 10:14:10 +00:00
jruoho f60c53b495 Move the test for mktemp(3) to the right place. 2020-06-27 09:45:57 +00:00
jruoho 55908713e4 Reference PRs consistently. 2020-06-26 07:50:11 +00:00
jruoho bf613d3342 Reference PRs consistently. 2020-06-25 11:12:03 +00:00
thorpej 492187ea09 Fix pasto; use {,U}LLONG{MIN,MAX} correctly in the {u,}llong{min,max}
range checks.

PR lib/55414
2020-06-24 14:28:10 +00:00
rin f340ec0453 Fix core_dump_procinfo tests for powerpc, for which child process was
stalled indefinitely in trap instruction even after PT_CONTINUE.

For powerpc, program counter is not automatically incremented by trap
instruction. We cannot increment PC in the trap handler, which breaks
applications depending on this behavior, e.g., GDB.

Therefore, we need to pass (PC + 4) instead of (void *)1 (== PC) to
PT_CONTINUE when child process traps itself.
2020-06-24 04:47:10 +00:00
rin c3c8ab8893 Work around QEMU bug #1668041 differently, by which floating-point
division by zero is not correctly trapped for i386 and amd64:

https://bugs.launchpad.net/qemu/+bug/1668041

Make trigger_fpe() cause integer division by zero for x86, and
floating-point one for other architectures. Also, assertions for
si_code in *_crash_fpe tests are commented out for now. They
should be cleaned up after the bug is fixed.

Now, *_crash_fpe tests are working also on powerpc.

Suggested by kamil.
2020-06-22 12:21:02 +00:00
rin 27ca840a21 Turn trigger_fpe() back to integer division by zero for a while
until QEMU bug #1668041 is fixed:

https://bugs.launchpad.net/qemu/+bug/1668041

by which floating-point division by zero is not trapped correctly
both on amd64 and i386.

Skip *_crash_fpe tests on powerpc, where integer division by zero
is never trapped.
2020-06-22 02:51:06 +00:00
lukem a11399dd2d fix build of h_thread_local_dtor.cpp 2020-06-21 07:06:05 +00:00
lukem a41884d4ca fix build of t_cabsl from t_cabsl.cxx
t_cabsl source is in t_cabsl.cxx not t_cabsl.cc - the latter
is what bsd.tests.mk defaults to.

This only broke after my commit of share/mk/bsd.dep.mk rev 1.85
but I don't know why it didn't cause a problem previously.
2020-06-21 06:58:16 +00:00
rin 669f5e8178 Fix false positive for mvscanw tests on big endian machines.
When conversion specifier is not a derivative form of "%s", retrieve
input as 32bit integer, and then convert to string literal. Then we
can avoid interpretation from ASCII code to integer, which is
apparently byte-order depended.
2020-06-20 07:50:16 +00:00
rin 4562851ebb Skip sigbus_adraln for powerpc.
SIGBUS for unaligned accesses is not mandatory for powerpc;
most processors (not all, e.g., 403) can deal with that.
2020-06-20 07:30:09 +00:00
rin 81e0508055 Fix build for vax; Compile t_ptrace_sigchld.c with -D__TEST_FENV. 2020-06-17 22:07:21 +00:00
rin f68301ec40 Let trigger_fpe() cause floating-point divide by zero exception, instead of
integer one, which is not trapped for powerpc and aarch64.

Note that it is checked in lib/libc/gen/t_siginfo whether integer divide by
zero is interpreted as SIGFPE or not.

Now, all *_crash_fpe tests pass for powerpc, and nothing changes for amd64
at least.
2020-06-17 08:42:16 +00:00
rin 2d089d6a31 Regardless of __HAVE_FENV, include <fenv.h>, which itself defines __HAVE_FENV. 2020-06-17 08:23:18 +00:00
sevan 5996c744ca Improve sentence 2020-06-16 09:47:11 +00:00
martin ac717ccabf PR kern/55272: skip this test on uniprocessor machines, it is too dangerous
and can kill the host kernel if a userland watchdog is running
2020-06-16 07:59:07 +00:00
christos 1f33802f79 language sensitivity 2020-06-15 13:57:45 +00:00
martin b7244a59d8 Do not destroy mutices that failed to init - fixes a run with
PTHREAD_DIAGASSERT set to "a". Pointed out by joerg.
2020-06-11 11:40:54 +00:00
ad a1d54d8ee2 Adjust cond_timedwait_race to take account of spurious wakeups (which are
completely legit).
2020-06-10 21:46:50 +00:00
kamil db4bf4da47 Add fork/vfork/posix_spawn tests for processes within pgrp
New tests:
 - fork_setpgid
 - vfork_setpgid
 - posix_spawn_setpgid
 - unrelated_tracer_fork_setpgid
 - unrelated_tracer_vfork_setpgid
 - unrelated_tracer_posix_spawn_setpgid

These tests trigger a kernel assert for pg_jobc going negative.

The tests are temporarily skipped.
2020-06-09 00:28:57 +00:00
thorpej 9a0cd196e4 Ensure copy_data_create_copy() is tolerant of creating empty data objects. 2020-06-08 21:31:17 +00:00
fox bf982b61a2 tests/lib/libarchive: Suppress -Werror=stringop-truncation error
This logic correctly uses strncpy(3) to fully initialize a fixed-width field, and also ensures
NUL-termination on the next line as other users of the field expect.

Add -Werror=stringop-truncation to prevent build failure, when run with MKSANITIZER=yes.

Error was reported when build.sh was run with MKSANITIZER=yes flag.

Reviewed by: kamil@
2020-06-07 23:20:52 +00:00
thorpej 9bc38ca6a6 Don't use deprecated proplib APIs (in the old "basic" test case). 2020-06-06 21:45:07 +00:00
thorpej a792b8435e Improvements to the problib(3) API:
==> Provide a much more complete set of setters and getters for different
    value types in the prop_array_util(3) and prop_dictionary_util(3)
    functions.

==> Overhaul the prop_data(3), prop_number(3), and prop_string(3) APIs
    to be easier to use and less awkwardly named,  Deprecate the old
    awkward names, and produce link-time warnings when they are referenced.

==> Deprecate mutable prop_data(3) and prop_string(3) objects.  The old
    APIs that support them still exist, but will now produce link-time
    warnings when used.

==> When the new prop_string(3) API is used, strings are internally
    de-duplicated as a memory footprint optimization.

==> Provide a rich set of bounds-checked gettter functions in and a
    corresponding set of convenience setters in the prop_number(3) API.

==> Add a new prop_bool_value(3) function that is equivalent to
    prop_bool_true(3), but aligned with the new "value" routines in
    prop_data(3), prop_string(3), and prop_number(3).
2020-06-06 21:25:59 +00:00
thorpej 9dd0cf5370 Add a test case to ensure that _lwp_create() fails with the
expected error code when a bad new-lwp-id pointer is passed.
2020-06-06 18:11:21 +00:00
martin 305e2e0fef Skip this test on machines where it would cause serious swapping. 2020-06-03 18:07:26 +00:00
kamil f222e3cc8d Avoid redefining _REENTRANT under sanitizers
Switch away from -Wno-macro-redefined which was Clang specific.
2020-06-01 01:03:21 +00:00
kamil 2affbc81a5 Ignore interception of SIGCHLD signals in the debugger
Set SIGPASS for SIGCHLD for the traced child in the following tests:
 - unrelated_tracer_fork*
 - unrelated_tracer_vfork*
 - unrelated_tracer_posix_spawn*

There is a race that SIGCHLD might be blocked during forking and dropped.

PR/55241 by Andreas Gustafsson
2020-05-16 23:10:26 +00:00