Commit Graph

3342 Commits

Author SHA1 Message Date
joerg
e5678be828 Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
2017-07-11 15:21:31 +00:00
joerg
8f5d6573ba Reference correct binary in error messages. 2017-07-10 21:43:33 +00:00
christos
f5fb881beb add another missing munmap (Kamil) 2017-07-09 22:18:43 +00:00
christos
2a9ed5d125 add munmap
#define for const.
2017-07-09 22:13:48 +00:00
christos
1ddb98e77f check for EFAULT on reads and writes to memory with not permission. 2017-07-09 22:04:04 +00:00
joerg
d88dcd0fdc Fix ISO C compliance: strtol of "0xX" should give the largest valid
numeric prefix, which is 0.
2017-07-06 21:08:44 +00:00
ozaki-r
9f04f77dde Add test cases for updating SA/SP
The tests require newly-added udpate command of setkey.
2017-07-05 01:25:03 +00:00
nat
27ecfe9c27 As pad devices are now created on demand - pad has to be open for a
corresponding mixer to be available.
2017-07-03 09:08:35 +00:00
ozaki-r
b95a267001 Add test cases for IPComp 2017-07-03 06:01:16 +00:00
joerg
5f391f4ae2 Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.
2017-07-02 16:41:32 +00:00
ozaki-r
3cd9889005 Check if ARP/NDP entries are purged when a related route is deleted 2017-06-30 07:57:12 +00:00
ozaki-r
3f42983046 Enable to remove multiple ARP/NDP entries for one destination
The kernel can have multiple ARP/NDP entries which have an indentical
destination on different interfaces. This is normal and can be
reproduce easily by ping -I or ping6 -S. We should be able to remove
such entries.

arp -d <ip> and ndp -d <ip> are changed to fetch all ARP/NDP entries
and remove matched entries. So we can remove multiple entries
described above. This fetch all and selective removal behavior is
the same as arp <ip> and ndp <ip>; they also do fetch all entries
and show only matched entries.

Related to PR 51179
2017-06-28 08:17:50 +00:00
ozaki-r
da803ed70d Restore ARP/NDP entries to route show and netstat -r
Requested by dyoung@ some time ago
2017-06-28 04:14:53 +00:00
ozaki-r
fcbd6bf4fa Drop RTF_LLINFO flag (now it's RTF_LLDATA) from local routes
They don't have llinfo anymore. And also the change fixes unexpected
behavior of ARP proxy.
2017-06-28 04:10:47 +00:00
ozaki-r
d15c5ed0e5 Fix wrong comment 2017-06-27 04:56:13 +00:00
ozaki-r
7eee4dba21 Check existence of ARP/NDP entries
Checking ARP/NDP entries is valid rather than checking routes.
2017-06-27 04:52:45 +00:00
ozaki-r
59bb97369e Drop RTF_UP from a routing message of a deleted ARP/NDP entry 2017-06-26 06:59:56 +00:00
ozaki-r
057fd82362 Improve backward compatibility of (fake) routing messages on adding an ARP/NDP entry
A message originally included only DST and GATEWAY. Restore it.
2017-06-26 03:16:28 +00:00
ozaki-r
60f1157fbd Fix usage of routing messages on arp -d and ndp -d
It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
2017-06-26 03:13:40 +00:00
kre
8b5ee9a5ac Give this test a promotion! This was the test that enabled the sh's
STACKSTRNUL() bug to eventually be found.   Not any of the test cases
directly - the shell running the tests (the same /bin/sh) managed to
build one of the f_variable_syntax sub-tests incorrectly, and that was
enough to eventually allow the bug to be located and squashed.

Like all good promotions, this one comes with increased work, and no extra pay.
2017-06-24 11:09:42 +00:00
kre
82288f99fc NFC: Added some comments (about other comments)
We currently parse var expansions like "${x-"a b c"}" incorrectly
according to POSIX (and ancient tradition) though in a way that is
generally unexpcted (there are 2 quoted strings there, according
to the standard, "${x-" and "}" and 'a b c' is unquoted.)  This has
never been fixed in our sh, as like in many other shells, it is just
a little unbelievable, most people expect that inside the {} is a
whole new ballpark, and everything starts again, and it does in cases
like "${x%"a b c"}" (the newer matching operators.)  There have been
comments in this test explaining how the test is actually testing for
incorrect behaviour for a while now.

But I have since learned of POSIX bug #221 (2010), the resolution of which is
to make the problem case unspecified.  This will not actually become part
of posix until the next major version (POSIX 8) whenever that appears (still
years away I expect) - but at least we now can feel happier about the
way our code works and not worry quite so much about testing that incorrect
code keeps working incorrectly....
2017-06-24 11:06:17 +00:00
gson
557e6caeb6 Reduce the number of iterations in the bsize_torture test from 65535
to 1000 to make the ATF test suite as a whole take less time.  Before
the change, this single test case could take more than two hours to
run on a qemu emulated ARM.
2017-06-24 10:25:23 +00:00
ozaki-r
f86487ba70 Test implicit removals of ARP/NDP entries
One test case reproudces PR 51179.
2017-06-22 10:06:33 +00:00
ozaki-r
3659ef5665 Purge all related L2 caches on removing a route
The change addresses situations similar to PR 51179.
2017-06-22 09:56:48 +00:00
ozaki-r
68c930f9c3 Fix typo 2017-06-22 09:05:02 +00:00
ozaki-r
dc9233b94b Don't create a permanent L2 cache entry on adding an address to an interface
It was created to copy FreeBSD, however actually the cache isn't
necessary. Remove it to simplify the code and reduce the cost to
maintain it (e.g., keep a consistency with a corresponding local
route).
2017-06-21 09:05:31 +00:00
ozaki-r
04ce7456cf Set net.inet.arp.keep only if it's required 2017-06-21 03:10:42 +00:00
ozaki-r
72ce3b3ae5 Add missing declarations for cleanup 2017-06-19 10:57:37 +00:00
ozaki-r
6bf9d9c9db Add test cases of TCP/IPsec on an IPv4-mapped IPv6 address
It reproduces the same panic reported in PR kern/52304
(but not sure that its cause is also same).
2017-06-19 10:05:04 +00:00
ozaki-r
9b188107de Do netstat -a for an appropriate protocol 2017-06-19 09:20:29 +00:00
kre
d9c02a764f Add a new test to verify correct operation when a command substitution
produces output with a very large number of consecutive embegged \n
characters.

This test is currently expected to fail (as of commit date) but is not
marked as atf_expect_fail as the shell should be fixed to avoid the
problem quite soon.   Until then almost anything might happen to the
sh that runs this test (from just plain wrong results, to core dumps,
even possibly the right results, though that's unlikely).

Whie doing this, get rid of the duplicate implementation of the
nested_cmdsubs_in_heredoc test (which was achieving nothing).  I know
how I managed to do that, but on advice of counsel, I ...   (it was
just a harmless waste of a tiny amount of CPU time "compiling" the test,
just like writing "x=0;" on consecutive lines....)
2017-06-16 07:37:41 +00:00
kre
a238581652 Fix a really stupid typo/thinko that was preventing many of the
redirect syntax sub-tests from being attempted.
2017-06-16 07:30:32 +00:00
ozaki-r
e40a78484b Test routing messages emitted on operations of ARP/NDP entries 2017-06-16 04:41:02 +00:00
christos
97ebf3e411 constify more to avoid gcc stupidity. 2017-06-14 21:43:02 +00:00
ozaki-r
388744f33f Enable DEBUG for babylon5 2017-06-14 02:33:37 +00:00
ozaki-r
1c8c9db525 Add test cases for vlan(4)
From s-yamaguchi@IIJ
2017-06-14 02:32:29 +00:00
martin
a3b64c360a Avoid variable lenght buffers to help the stack protector (hopefully no
functional change)
2017-06-13 08:16:16 +00:00
kre
e045f926b6 Add two new sub-tests to the c_line_wrapping test case.
These should detect if the errors that caused MAKDEV to fail and
pkgsrc/pkgtools/cwrappers to fail to build (problem detected in
libnbcompat/configure) ever return.

Also fixed one of the other sub-tests so that it actually does what
it should - no idea how this one has been passing, it did not for me
when I was checking the new ones (but perhaps in the interim I have
fixed something else in sh, the problem was in the area I have been
playing, and I originally debugged the new tests using a newer version
of /bin/sh than has yet been committed.)
2017-06-09 23:49:58 +00:00
bouyer
bc73b88a51 Test bind()ing to a non-existent interface. 2017-06-09 08:23:45 +00:00
knakahara
1c9c125617 add tests of ioctl for /dev/crypto 2017-06-09 06:09:01 +00:00
perseant
8b7adb7bf9 Change t_sprintf to an expected failure, since we don't respect the empty
thousands separator of the C/POSIX locale (PR standards/52282).
2017-06-07 22:59:42 +00:00
kre
9817a5b1e5 Paranoia: add a new test case testing that $(( )) results get split
by IFS just the same as any other expansion (split when they should be,
and not when they shouldn't).

Good thing I did ... this discovered a regression in the new expand
code (from an hour or three ago) where quoted arith expansions are
being split, and shouldn't be.  (on the other hand, when they should
be split, they are being split correctly, so that's good...)

No need to worry too much about this, in real life (as opposed to
torture tests) no-one ever puts digits in IFS, and a $(( )) expansion
only ever contains digits, so in practice, splitting never happens,
whether because it is quoted, or just becaue there is nothing to split.

The FreeBSD shell does it correctly (they do word splitting using a
totally different mechanism than we do) - I will find where I missed
testing for quoted expansions later tonight.  Until that happens,
expect a test failure from t_fsplit:split_arith

While here add more comments in the other test casess (one had a comment
already) that our shell parses incorrectly (this is a parsing problem,
not an expansion problem, and the bug has existed forever .. and is
shared by bash).

That is, in an expression like "${var:-word}" the whole thing (including
word) is quoted by the double quotes, and in "${var:-"word"}" the
expansion is quoted, but 'word' is not, the 2nd " (the one before 'w')
ends the opening quote, and the third (before }) turns quoting on
again (it is required that there be an even number of unquoted quotes inside
a ${} expression, so things like "${var:-"word} are simply invalid.)
Another way of saying this, is that if the { is quoted (for which the
only way is using " to get to this kind of expansion at all) the }
must also be quoted (" quoted).  There is no quote nesting here.

This also means that in "${var:-'word'}" the single quotes are just
characters, they are quoted by the "" that surround them, just as in
"a 'string' containing quotes", but "${var:-"'word'"}} is valid and
contains a single quoted word.

Note that this is different than the patetrn-match/trim expansions
( ${var%pattern} etc) where any surrounding quotes do not affect the
pattern, and all forms of quoting can be used in it - but it always
parses as a pattern, and is never subject to filename expansion, so
a '*' in it that is to mean "match any string" does not need special
quoting to avoid it expanding to file names, regardless of whether
the ${var%*} is quoted or not, but a * that is to be matched as a
character literally does need to be quoted.

I will probably file a PR about this bug sometime, but as it is
very old, and doesn't every seem to bother anyone (and is shared by
bash) there isn't any big hurry to open yet another verry messy can
of excrement to fix it...

This does mean that the FreeBSD shell "fails" some of our tests.
(The test is wrong, their shell is correct.)
2017-06-03 15:15:49 +00:00
kre
a12c6cfae6 Complete the special request by quoting chapter & verse from POSIX
as to why ${011} is ${11} and not ${9} (that is, why we interpret it
that way, the "why could it not be the other way?" is just "because
that is not how it was ever implemented".
2017-06-03 14:45:59 +00:00
kre
25950655c8 By special request, add a check that ${011} is ${11} not ${9} (etc) and
that ${08} is not an error.
2017-06-03 11:23:01 +00:00
kre
3806d6f4e4 Add some extra sub-tests checking splitting of ${#var} - just for my
piece of mind (to verify I was not breaking anything here.)

Also added some commentary better explaining why one of the tests of splitting
quoted variable expansions is almost certainly incorrect (both the tests,
and what sh does) ... though bash does the same as us, so all is not lost!
2017-06-03 10:27:05 +00:00
kre
f0acc68ec6 Add a new test case "nested_arith" (that is, things like $(( 1 + $(( 2 )) ))
which will currently fail (some of the sub-tests, but this one stops on
first failure, so the test simply fails.)  This will be corrected later today.
2017-06-02 01:50:48 +00:00
kre
3782bd48c9 Add 3 new subtests to the shell_params test case. These test currently
broken behaviour (so for now, 3 of 15 subtests will fail).   This will
be corrected later today.
2017-06-02 01:48:13 +00:00
kre
06627d31e7 One more weird test of parsing (and correctly understanding) words
whose meaning is defined entirely by context.

For those who read commit messages, and want a (small) challenge,
work out where (and what) to insert as punctuation/operator chars
in the following to produce 3 ines of output, and what those will be:

	for in in in do in do case in in in echo do do echo in esac done

(There are no comments, quotes of any kind, or any kind of sub-shell,
including cmd substitutions)  With correct non alpha-numeric chars added,
it works.
2017-06-02 01:45:06 +00:00
kre
bdbf3d66ba Guard against EVN being set, and possibly referencing an unset
variable, when we are running tests with sh -u
2017-06-02 01:38:44 +00:00
ozaki-r
56383415f1 Add IPSEC_KEY_DEBUG
Enable the debugging feature of IPsec key (sysctl net.key.debug)
on rump kernels if the ATF test is run with IPSEC_KEY_DEBUG=true.
2017-06-02 01:18:51 +00:00
perseant
d4f6523beb Add tests for btowc(3)/wctob(3) and enable compilation of the test for
digittoint(3).

The digittoint(3) test is skipped since we don't provide that function yet.

One of the test cases for btowc(3) is also skipped, since it tests conversion
to Unicode---whereas our wchar_t representation is locale-dependent.
2017-06-01 15:45:02 +00:00
ozaki-r
946f090610 Test TCP communications over IPsec transport mode with ESP or AH
This tests SP caches of PCB.
2017-06-01 03:56:47 +00:00
ozaki-r
8504d69233 Remove a unused local variable 2017-06-01 03:51:47 +00:00
martin
b40441be27 In the -m32 test, additionally test profiled binaries. 2017-05-31 11:08:35 +00:00
perseant
ce11903f24 Add test cases for sprintf/sscanf/strto{d,l} and the is* and isw* ctype functions, for single-byte encodings 2017-05-30 23:44:02 +00:00
perseant
4f17535a14 Add simple test case for toupper/tolower 2017-05-30 02:11:03 +00:00
kre
6768e34b73 Add a new test case wrap_strip based upon strip (ie: cut&paste.. to start)
but with \ newline line continuations inserted at strange places.

For the shell as it is today, since strip passes, wrap_strip should
automaticallty pass as well (and does), as the \ newline combination
is simply removed, producing identical input to that of strip.

However, for accurate line counting ($LINENO: coming soon) newlines (no
matter the context) cannot simply "go away" - we have to know where they
occur(ed) (perhaps long after the text was read)  so we know what line
number we are actually processing.   This new test case is (perhaps just
part) of future-proofing that the modified code does not break anything.
2017-05-29 22:27:47 +00:00
christos
1e8894c3ea undo previous; we don't have any archs where socklen_t != uint32_t. 2017-05-28 14:53:13 +00:00
christos
35f2dad6cc fix format. 2017-05-28 14:49:00 +00:00
kre
a5e8ad6bb0 Needs %zu fix for sizeof as well. 2017-05-28 13:55:07 +00:00
martin
bb62327044 Fix size_t format strings 2017-05-28 09:35:01 +00:00
bouyer
6e4cb2b9ab merge the bouyer-socketcan branch to HEAD.
CAN stands for Controller Area Network, a broadcast network used
in automation and automotive fields. For example, the NMEA2000 standard
developped for marine devices uses a CAN network as the link layer.

This is an implementation of the linux socketcan API:
https://www.kernel.org/doc/Documentation/networking/can.txt
you can also see can(4).

This adds a new socket family (AF_CAN) and protocol (PF_CAN),
as well as the canconfig(8) utility, used to set timing parameter of
CAN hardware. Also inclued is a driver for the CAN controller
found in the allwinner A20 SoC (I tested it with an Olimex lime2 board,
connected with PIC18-based CAN devices).

There is also the canloop(4) pseudo-device, which allows to use
the socketcan API without CAN hardware.

At this time the CANFD part of the linux socketcan API is not implemented.
Error frames are not implemented either. But I could get the cansend and
canreceive utilities from the canutils package to build and run with minimal
changes. tcpudmp(8) can also be used to record frames, which can be
decoded with etherreal.
2017-05-27 21:02:54 +00:00
kre
ff906b151f Skip the test of non-posix behaviour if we are deliberately trying
to be posix compatible (POSIXLY_CORRECT is set).
2017-05-27 13:11:50 +00:00
perseant
4e3374a73f Add simple expect-fail test case for strcoll(3) 2017-05-26 01:24:19 +00:00
ozaki-r
b8bb1e4f6c Change the default value of DEBUG of stable tests to false 2017-05-26 01:14:38 +00:00
perseant
80f1b646c3 Add a member to the test data structure that indicates whether the given
encoding is state-dependent, and test the results of wctomb(NULL, '\0') and
mbtowc(NULL, NULL, 0) against this instead of against each other.
2017-05-25 18:28:54 +00:00
christos
f54caa8bd5 give it more time. 2017-05-24 15:29:51 +00:00
ozaki-r
1104a9e5a4 Enable DEBUG to know what is happening on anita/sparc 2017-05-24 09:34:48 +00:00
christos
505231416e Add the error in syscall failure. 2017-05-23 16:01:46 +00:00
christos
535d7bd162 not allowed to map RWX anymore. 2017-05-23 15:56:55 +00:00
christos
c415a8906b Handle dk disks and print errors. 2017-05-23 13:04:29 +00:00
christos
268abfe922 there is no more UsePrivilegeSeparation 2017-05-22 21:22:30 +00:00
riastradh
ef315f7931 Remove MKCRYPTO option.
Originally, MKCRYPTO was introduced because the United States
classified cryptography as a munition and restricted its export.  The
export controls were substantially relaxed fifteen years ago, and are
essentially irrelevant for software with published source code.

In the intervening time, nobody bothered to remove the option after
its motivation -- the US export restriction -- was eliminated.  I'm
not aware of any other operating system that has a similar option; I
expect it is mainly out of apathy for churn that we still have it.
Today, cryptography is an essential part of modern computing -- you
can't use the internet responsibly without cryptography.

The position of the TNF board of directors is that TNF makes no
representation that MKCRYPTO=no satisfies any country's cryptography
regulations.

My personal position is that the availability of cryptography is a
basic human right; that any local laws restricting it to a privileged
few are fundamentally immoral; and that it is wrong for developers to
spend effort crippling cryptography to work around such laws.

As proposed on tech-crypto, tech-security, and tech-userlevel to no
objections:

https://mail-index.netbsd.org/tech-crypto/2017/05/06/msg000719.html
https://mail-index.netbsd.org/tech-security/2017/05/06/msg000928.html
https://mail-index.netbsd.org/tech-userlevel/2017/05/06/msg010547.html

P.S.  Reviewing all the uses of MKCRYPTO in src revealed a lot of
*bad* crypto that was conditional on it, e.g. DES in telnet...  That
should probably be removed too, but on the grounds that it is bad,
not on the grounds that it is (nominally) crypto.
2017-05-21 15:28:36 +00:00
riastradh
09956316a6 Remove MKCRYPTO_RC5. Unconditionally include RC5 in libcrypto.so.
This option existed only because RC5 is covered by patents that, twenty
years ago, we had reason to suspect the patent holder, RSA, Inc., might
litigate.  The two US patents in question are 5,724,428 and 5,835,600.

According to the USPTO Patent Term Calculator web site at
<https://www.uspto.gov/patent/laws-and-regulations/patent-term-calculator#heading-5>
(retrieved 2017-05-21), patents filed after 1995-06-07 expire twenty
years after the filing date.

number          filing date
5,724,428       1995-11-01
5,835,600       1997-04-21

Thus, these patents appear to be expired.

As proposed on tech-crypto and tech-security:

https://mail-index.netbsd.org/tech-crypto/2017/05/05/msg000718.html
https://mail-index.netbsd.org/tech-security/2017/05/05/msg000927.html
2017-05-21 14:20:44 +00:00
kre
79115595d5 Add a test of sh syntax & parsing (first attempt anyway.) 2017-05-20 16:35:55 +00:00
ozaki-r
0871e3e188 Enable debug logging of kernels such as ARP and ND if $DEUBG=true 2017-05-19 02:56:58 +00:00
ozaki-r
43af182f5e Don't check the existence of SA entries eagerly
They can be expired at that point if their lifetime is very short.
This may fix unexpected failures of tests running on anita.
2017-05-18 14:43:42 +00:00
martin
4fcb013cbf Add (currently failing) test cases for profiled programs. 2017-05-18 10:29:47 +00:00
ozaki-r
28c6f0e797 Test CARP handover on setups without having IPs on carpdev (shmif)
Note that tests for IPv6 don't pass yet; nd6 needs to handle CARP
correctly like arp does.
2017-05-18 06:34:48 +00:00
ozaki-r
9c1d2498f1 Reduce duplicated codes (DRY) 2017-05-18 06:33:49 +00:00
ozaki-r
beade07f61 Add test cases of TCP communications with IPsec enabled
The test cases transfer data over TCP by using nc with IPsec just enabled
(no SA/SP is configured) and confirm the commit "Fix diagnostic assertion
failure in ipsec_init_policy" really fixes the issue.
2017-05-17 06:30:15 +00:00
kre
22a6d2dd08 More test sub-cases for the dollar_hash ( ${#...} ) test.
Upi really (really!) don't want to know!

Also, add a comment (in another section) and avoid giving messages
to atf_fail that include newlines - AFT really doesn't like that.
Instead, convert the \n's to ;'s so at least the content is retained.
2017-05-15 19:53:40 +00:00
ozaki-r
fe20eadb23 Add test cases for SA lifetime 2017-05-15 09:58:22 +00:00
ozaki-r
12efcd61a3 Fix typo 2017-05-15 09:56:47 +00:00
kre
c70ddc9b88 Add a test for opening files with exec "when" in posix mode (close-on-exec
should not get set.)  While here, remove the (unused) runhelper() function.
2017-05-14 17:28:46 +00:00
kre
a30f469fdd Add a test case for the various ways that ${xxx} expansions, which
contain a # character, can get parsed (which amounts to 86 extra checks,
any Australian can tell you why I decided to stop there and not add one
more...)
2017-05-14 11:28:49 +00:00
kamil
d1be05c0a9 Add new ATF C++ tests in usr.bin/c++: t_static_destructor
These tests are cloned from t_cxxruntime and check proper order of destructor
calls. They must be reported in reverse order of constructor completion.

Added tests:
 - static_destructor
 - static_destructor_pic
 - static_destructor_pie
 - static_destructor32

This test file replaces src/regress/usr.bin/c++/static_destructor.
2017-05-14 02:02:25 +00:00
kamil
179f19cf82 Use more C++ sugar in t_cxxruntime (ATF test) 2017-05-14 01:13:44 +00:00
kamil
9fab767d88 Add new ATF C++ tests in usr.bin/c++
These tests are cloned from t_hello and use c++ runtime basic functions.

Added tests:
 - hello
 - hello_pic
 - hello_pie
 - hello32
2017-05-14 01:03:21 +00:00
kamil
b971227c60 Add new c++ ATF tests in usr.bin/c++: t_hello
This is a copy of t_hello from usr.bin/cc.

Added tests:
 - hello
 - hello_pic
 - hello_pie
 - hello32

These tests do not use c++ runtime library functions.

Protect these tests with MKCXX.
2017-05-14 00:07:07 +00:00
kamil
4dde76f99d Correct hellp_pic ATF test in usr.bin/cc
Drop "-dPIC", this is misspelled "-DPIC" option for libtool.
Enhance code example to be more pedantic.
2017-05-13 23:51:39 +00:00
ozaki-r
e106de3177 Dedup some routines 2017-05-12 02:34:45 +00:00
ozaki-r
cb7a3799fb Test tunnel mode with IPv4 over IPv6 and IPv6 over IPv4 2017-05-10 09:08:25 +00:00
ozaki-r
f70653090a Disable DAD rather than waiting its completion every time 2017-05-10 09:00:29 +00:00
ozaki-r
27f51fa5d6 Dedup some routines 2017-05-10 08:59:40 +00:00
ozaki-r
0eb085d9dc Introduce check_sa_entries to remove lots of duplicated codes 2017-05-10 04:46:13 +00:00
ozaki-r
63d8d68bc2 Test flushing SAD/SPD entries 2017-05-09 04:25:28 +00:00
joerg
4f77b889d0 Extend the mmap(2) interface to allow requesting protections for later
use with mprotect(2), but without enabling them immediately.

Extend the mremap(2) interface to allow duplicating mappings, i.e.
create a second range of virtual addresses references the same physical
pages. Duplicated mappings can have different effective protections.

Adjust PAX mprotect logic to disallow effective protections of W&X, but
allow one mapping W and another X protections. This obsoletes using
temporary files for purposes like JIT.

Adjust PAX logic for mmap(2) and mprotect(2) to fail if W&X is requested
and not silently drop the X protection.

Improve test cases to ensure correct operation of the changed
interfaces.
2017-05-06 21:34:51 +00:00
kamil
d4cc32a150 Improve style of PT_SETSTEP and PT_CLEARSTEP tests in t_ptrace_wait*
No functional change.

Sponsored by <The NetBSD Foundation>
2017-05-03 19:46:54 +00:00
pgoyette
45d3394e0e Fix detection of expected results. The rump kernel code apparently
includes source-code line numbers in the messages, so rather than
hard-coding them in the test, just use a reg-ex to match the text.

Fixes PR bin/52207
2017-05-03 12:09:41 +00:00
kamil
a9391cc9b5 Fix typo in ATF test t_strtoi.c
No functional change.
2017-04-28 19:01:01 +00:00
ozaki-r
1926b285fc Test transport mode as well as tunnel mode 2017-04-27 10:17:12 +00:00
ozaki-r
15fbe23193 Prefer rijndael-cbc 2017-04-27 08:06:59 +00:00
ozaki-r
3c135203c7 Add test cases for L2TP/IPsec 2017-04-27 06:53:44 +00:00
ozaki-r
9b089297f0 Add test cases for gif/IPsec 2017-04-27 06:52:45 +00:00
ozaki-r
881bdf498c Add minimum sets of algorithms for testing 2017-04-27 06:50:42 +00:00
christos
d30a2b5f27 - add range tests
- be more descriptive about errors
2017-04-26 14:52:57 +00:00
kre
dfcb546256 If we are using the pad audio device, there must be a process with
the corresponding pad device open, or we get EIO from audio accesses

Explained and fix provided by Nathanial Sloss <nat@n.o>

Note: if we are testing and using real audio hardware, the open
of /dev/pad0 is irrelevant (but harmless, so we don't attempt to
check) and what's more it doesn't matter if it succeeds or fails.

If we're testing under qemu (or any other situation where the only
audio "hardware" is pad) then the open will work, and there should be
no more EIO.

If there is no audio hardware of any kind on the system being tested,
the attempt top open /dev/mixer should fail, and the test will be
skipped.
2017-04-20 00:17:11 +00:00
knakahara
e7af88294b add opencrypto atf for CRYPTO_3DES_CBC and CRYPTO_AES_CBC(=CRYPTO_RIJNDAEL128_CBC). 2017-04-17 03:59:37 +00:00
riastradh
894367af71 Stress rump hyperentropy a little harder. 2017-04-16 18:24:23 +00:00
kamil
b505cb2592 ATF test attach2/t_ptrace_wait* is unstable
Mark it broken with:

PR kern/52168 attach2:t_ptrace_wait* is unsable

In order to get reliable failure, abort this test at the end (if we get
there).
2017-04-16 13:09:40 +00:00
kamil
8cd63a3b3a Mark signal3/t_ptrace_wait* with timeout on sparc 32-bit
PR kern/52167 signal3/t_ptrace_wait* timeouts on sparc 32-bit

This test is also marked as failure on other platforms:

PR kern/51918 ptrace tracee can prevent tracer to get its signals by masking

Both issues are valid on sparc 32-bit, but the timeout one wins.
2017-04-16 12:50:59 +00:00
kamil
a0fde0b9f7 Mark syscallemu1/t_ptrace_wait* broken on 32-bit sparc
PR kern/52166
2017-04-16 12:32:03 +00:00
kamil
b1bdad9a86 Restore atf_tc_expect_fail in signal4 of t_ptrace_wait*
Accidentally there was removed a PR, it was never fixed.

PR 51918 "ptrace tracee can prevent tracer to get its signals by masking"
2017-04-16 12:03:25 +00:00
ozaki-r
ef3b2c8cef Revert "Mark tests of tunnel/AH/IPv6 as expected failure (PR kern/52161)"
The issue was fixed by christos@
2017-04-16 10:34:49 +00:00
ozaki-r
47978ed2ef Mark tests of tunnel/AH/IPv6 as expected failure (PR kern/52161) 2017-04-14 03:35:40 +00:00
ozaki-r
0b5da45aff Add tests for ipsec
- Check if setkey correctly handles algorithms for AH/ESP
- Check IPsec of transport mode with AH/ESP over IPv4/IPv6
- Check IPsec of tunnel mode with AH/ESP over IPv4/IPv6
2017-04-14 02:56:48 +00:00
riastradh
460f0e63ea Gotta mark crashes on signal separately from failures... 2017-04-14 01:30:38 +00:00
kamil
12cbcbd04f Add new macro PTRACE_BREAKPOINT_ASM in <sys/ptrace.h> MD part
This macro ships with a MD-specific assembly instruction triggering
a software breakpoint.

Missing instruction for powerpc targets.

This code is used in ATF tests (lib/libc/sys/t_ptrace_wait).

Original patch by Nick Hudson, thanks!
2017-04-12 18:17:59 +00:00
riastradh
de4f8ca0e4 Mark expected failures as such.
Not exactly sure how the PRs correspond -- please fix if this is wrong!
2017-04-12 15:12:55 +00:00
kamil
3864b78528 fork1 and siginfo5 no longer fails on !x86 platforms in t_ptrace_wait*
The PTRACE_FORK operation has been fixed. Patch committed by <martin>

PR kern/52117
2017-04-10 16:45:57 +00:00
kamil
05ffc73c35 Add new ptrace(2) API: PT_SETSTEP & PT_CLEARSTEP
These operations allow to mark thread as a single-stepping one.

This allows to i.a.:
 - single step and emit a signal (PT_SETSTEP & PT_CONTINUE)
 - single step and trace syscall entry and exit (PT_SETSTEP & PT_SYSCALL)

The former is useful for debuggers like GDB or LLDB. The latter can be used
to singlestep a usermode kernel. These examples don't limit use-cases of
this interface.

Define PT_*STEP only for platforms defining PT_STEP.

Add new ATF tests setstep[1234].

These ptrace(2) operations first appeared in FreeBSD.

Sponsored by <The NetBSD Foundation>
2017-04-08 00:25:49 +00:00
kamil
97a670fdb7 Remove tests/kernel/t_ptrace* from the tree
ptrace(2) tests have been moved to tests/lib/libc/sys

Sponsored by <The NetBSD Foundation>
2017-04-03 05:06:28 +00:00
kamil
24e714f435 Import ptrace(2) tests into appropriate directory tests/lib/libc/sys/
This is the correct directory documented in tests/README for such tests.

Discussed with <martin>

Sponsored by <The NetBSD Foundation>
2017-04-02 21:44:00 +00:00
kamil
cc4260326d Remove kernel/arch/{amd64,i386,x86} tests
These files were merged with kernel/t_ptrace_wait*

This removes MD test files.

Sponsored by <The NetBSD Foundation>
2017-04-02 01:49:51 +00:00
kamil
8021fa5d7a Merge kernel/t_ptrace_wait with kernel/arch/amd64/t_ptrace_wait
This aims to remove MD-specific tests files for ptrace(2).

Prefix i386 and amd64 tests with unique strings "i386_" and "x86_64_".
This removes conflicts with generic tests.

Sponsored by <The NetBSD Foundation>
2017-04-02 01:14:35 +00:00
kamil
558f1d1e36 Merge kernel/t_ptrace_wait with kernel/arch/i386/t_ptrace_wait
This aims to remove MD-specific tests files for ptrace(2).

Sponsored by <The NetBSD Foundation>
2017-04-02 00:40:12 +00:00
kamil
c2be869a55 Merge kernel/t_ptrace_wait with kernel/arch/x86/t_ptrace_wait
This aims to remove MD-specific tests files for ptrace(2).

Sponsored by <The NetBSD Foundation>
2017-04-02 00:29:07 +00:00
kamil
e884bc2dfc Correct another string about securelevel in t_ptrace
Change:
    Test must be run with securelevel >= 1

To:
    Test must be run with securelevel >= 0

In attach_pid1_securelevel.

Sponsored by <The NetBSD Foundation>
2017-04-02 00:06:09 +00:00
kamil
bce52e0028 Deduplicate code in step* tests in t_ptrace_wait*
No functional change.

Sponsored by <The NetBSD Foundation>
2017-04-02 00:03:40 +00:00
kamil
5ab466b502 Correct securelevel in attach_pid1_securelevel
Assert that a debugger cannot attach to PID 1 with securelevel >= 0
(as root) instead of >= 1.

Sponsored by <The NetBSD Foundation>
2017-04-01 23:51:27 +00:00
kamil
c0d49dc8aa Try to fix Clang/LLVM build
Initialize a local variable.
2017-04-01 23:28:02 +00:00
kamil
d412f5ec32 Refactor dbregs_dr*_dont_inherit_execve ATF tests for x86/
Eliminate duplicated code.

Sponsored by <The NetBSD Foundation>
2017-04-01 23:25:08 +00:00
martin
75bf572ad0 Make the mutex6 test (which fails every know and then, but too rarely
to actually debug it) print some debug info when failing.
2017-04-01 17:19:40 +00:00
ozaki-r
eb849f3e8d Add test cases for ping options 2017-03-31 06:41:40 +00:00
kamil
0a45c98ca6 Remove deuplicated code in dbregs_dr[01234]_dont_inherit_lwp
Currently remove tests for dbregs_dr[67]_dont_inherit_lwp.

Sponsored by <The NetBSD Foundation>
2017-03-30 20:24:35 +00:00
kamil
04aac12dac Eliminate code duplication in the x86 dbregs_dr[0123]_trap_variable* tests
This is work in progress to remove no longer needed code overhead shared
between tests.

Sponsored by <The NetBSD Foundation>
2017-03-30 02:17:38 +00:00
kamil
f0df2ef69f Deduplicate shared code in dbregs_preserve_dr[0123]{,_yield,_continued}
Move common function code into shared subroutine.

While there remove checks for defined(HAVE_DBREGS). All x86 ports offer
debug register accessors.

Sponsored by <The NetBSD Foundation>
2017-03-29 23:50:09 +00:00
kamil
a730799971 Explain expected behavior for PTRACE_FORK events in t_ptrace_wait*
PR kern/52117 ptrace(2) PTRACE_FORK fails on some platforms

Add message similar to:
    We expect two SIGTRAP events, for child 22199 (TRAP_CHLD,
    pe_report_event=PTRACE_FORK, state.pe_other_pid=child2) and for child2
    (TRAP_CHLD, pe_report_event=PTRACE_FORK, state.pe_other_pid=child)

This should make the expected behavior more clear.

Sponsored by <The NetBSD Foundation>
2017-03-28 13:16:30 +00:00
kamil
203a7bc419 Mark PT_STEP tests in t_ptrace_wait* as broken on ARM
There is a definition of PT_STEP for userland, but no implementation
in the kernel.

PR kern/52119 PT_STEP not supported on arm 32-bit

Sponsored by <The NetBSD Foundation>
2017-03-28 12:39:07 +00:00
kamil
5f3e805bbe Set timeout expected in resume1 (t_ptrace_wait*)
Mark timeout for this test 5 sec. It sometimes works sometimes does not.

Add a local sleep(3) at the end to get consisten report about timeouting
always.

PR kern/51995

Sponsored by <The NetBSD Foundation>
2017-03-28 03:19:20 +00:00
kamil
b97ce90e99 Mark fork1 and siginfo5 as broken on sparc, sparc64, evbarm and alpha
PR kern/52117 ptrace(2) PTRACE_FORK fails on some platforms

These tests work on amd64, i386 and xen.

They are part of t_ptrace_wait*.

Sponsored by <The NetBSD Foundation>
2017-03-28 03:03:15 +00:00
kamil
501e6bc911 Optimize signal6 in t_ptrace_wait
Reduce timeout to 5 seconds. This tests timeouts and this change saves
time.

PR kern/51918

Sponsored by <The NetBSD Foundation>
2017-03-28 01:40:39 +00:00
ozaki-r
16ca3747e1 Use the utility functions for rump_server 2017-03-28 01:27:46 +00:00
kamil
c6dfd176d2 Mark signal6 as failing due to timeout not regular failure
This test is marked as PR kern/51918.

Timeout has been reported on i386, amd64, alpha, sparc, sparc64, evbarm.
xen.

Sponsored by <The NetBSD Foundation>
2017-03-28 01:00:33 +00:00
maya
daa855846a Add failing test cases for PRs kern/2423, kern/3645, kern/4597 2017-03-26 18:26:05 +00:00
skrll
8ff4d6477a kern/52012 kern/52018 kern/52019 were all fixed by christos 2017-03-25 10:07:55 +00:00
pgoyette
b57579c759 Rather than ghecking system global state to see if mprotect might be
enabled, use the newly-committed sysctl proc.curproc.paxflags variable
2017-03-25 01:39:20 +00:00
martin
426774e5a3 Do not toggle global security.pax.mprotect state in an attempt to
activate it for the current process. It does not work and tests should
not change global system state anyway.
Instead: skip the test is pax.mprotect is not globally enabled. We could
use a better check for this (querying the current processes pax flags),
but unfortunately we don't have one.
2017-03-24 08:18:27 +00:00
ozaki-r
33479c318b Fix typo 2017-03-24 04:06:19 +00:00