Commit Graph

47 Commits

Author SHA1 Message Date
christos 4b4138ec28 fix warnings 2021-09-01 06:12:50 +00:00
christos 2557380693 Inetd enhancements by James Browning, Gabe Coffland, Alex Gavin, Solomon Ritzow
Described in:
    https://www.mail-archive.com/tech-userlevel@netbsd.org/msg03114.html
And developed in:
    https://github.com/ritzow/src/pull/1

From their notes:

All new functionality should be explained by the updated manpage.

The manpage has been refactored a bit: A new section "Directives"
has been added and the information about default hostnames and
IPsec directives has been moved there, and the new file include
directive information is also there.

getconfigent has the most major changes. A newline is no longer
read immediately, but is called only by a "goto more" (inside an
if(false) block). This allows multiple definitions or directives
to exist on a single line for anything that doesn't terminate using
a newline. This means a key-values service definition can be followed
by another key-values service definition, a positional definition,
or an ipsec, hostname, or .include directive on the same line.

memset is no longer used explicitly to clear the servtab structure,
a function init_servtab() is used instead, which uses a C struct
initializer.

The servtab se_group field is its own allocation now, and not just
a pointer into the user:group string.

Refactored some stuff out of getconfigent to separate functions
for use by parse_v2.c. These functions in inetd.c are named with
the form parse_*()

parse_v2.c only has code for parsing a key-values service definition
into a provided servtab. It should not have anything that affects
global state other than line and line_number.

Some function prototypes, structures, and #defines have been moved
from inetd.c to inetd.h.

The function config_root replaces config as the function called on
a config file load/reload. The code removed from the end of
config(void) is now called in config_root, so it is not run on each
recursive config call.

setconfig(void) was removed and its code added into config_root
because that is the only place it is called, and redundant checks
for non-null globals were removed because they are always freed by
endconfig. The fseek code was also removed because the config files
are always closed by endconfig.

Rate limiting code was updated to add a per-service per-IP rate
limiting form. Some of that code was refactored out of other places
into functions with names in the form rl_*()

We have not added any of the license or version information to the
new files parse_v2.c, parse_v2.h, and inetd.h and we have not
updated the license or version info for inetd.c.

Security related:

The behavior when reading invalid IPsec strings has changed. Inetd
no longer exits, it quits reading the current config file instead.
Could this impact program security?

We have not checked for memory leaks. Solomon tried to use dmalloc
without success. getconfigent seemed to have a memory leak at each
"goto more". It seems like inetd has never free'd allocated strings
when throwing away erroneous service definitions during parsing
(i.e. when "goto more" is called when parsing fields). OpenBSD's
version calls freeconfig on "goto more"
(c5eae130d6/usr.sbin/inetd/inetd.c (L1049))
but NetBSD only calls it when service definitions are no longer
needed. This has been fixed. freeconfig is called immediately before
any "goto more". There shouldn't be any time when a servtab is in
an invalid state where freeconfig would break.
2021-08-29 09:54:18 +00:00
gson 4b67fc1050 Skip the test when the dtrace_syscall module is not loaded and can't
be autoloaded, as may be the case on arm because securelevel.
2021-07-29 14:58:35 +00:00
gson 1cb69d41f6 Show the stderr from execsnoop so that we can see why it fails on arm. 2021-07-27 15:29:22 +00:00
skrll 24f992ccb4 PR/53417 appears fixed now so remove atf_expect_fail (for Arm). 2021-07-27 11:05:39 +00:00
gson 47974badd1 Only expect failure on ARM 2021-07-25 15:51:32 +00:00
gson 0f3fd1afc4 Remove "pkill -9 execsnoop". It's wrong on so many levels: first of
all, it does not actually kill anything because the process executing
the execsnoop script is called "sh", not "execsnoop".  And even if it
would somehow kill the shell running the execsnoop script, it still
would not kill the dtrace child process.  On the other hand, if there
happened to be an unrelated process actually called "execsnoop", it
would kill that.

The actual killing of the execsnoop sh and dtrace processes happens in
the ATF cleanup stage (as it always has).
2021-07-25 10:21:44 +00:00
gson 00195ad3b0 Increase sleep waiting for execsnoop to start; one second is not sufficient
on a Dell Latitude D400 i386 laptop.
2021-07-25 10:11:32 +00:00
gson f898ef8945 Create temporary files in . rather than /tmp so that they get cleaned up
automatically by atf.
2021-07-24 15:56:05 +00:00
dholland cbee569422 Mark t_execsnoop xfail (PR 53417) 2021-07-18 06:24:58 +00:00
mrg bfab3a83f7 don't run the "offline" or "nointr" tests by default. they exercise
bugs that exist in the current code and leave the target machine in
a broken state, requiring ddb or hard reset.

setting ATF_USR_SBIN_CPUCTL_OFFLINE_ENABLE to any non-empty string
will enable these tests again.
2021-04-12 01:18:13 +00:00
martin b220268543 Fix a few copy + pastos, simplify shell arithmetic 2020-08-14 05:22:25 +00:00
jruoho 0a95079b4a Do not allow disabling interrupts on the primary CPU. Fixes PR kern/45117. 2020-07-13 13:16:07 +00:00
jruoho 50e485342b Sleep even more. 2020-07-11 09:55:26 +00:00
jruoho eaede56dac Skip this test as it may cause a panic. Point to PR kern/55481. 2020-07-11 09:35:22 +00:00
jruoho 28b2e2ce1b Sleep more. 2020-07-06 10:32:18 +00:00
jruoho 8b2d29b6bf Check that DTrace's execsnoop and opensnoop work (cf. PR kern/53417). 2020-06-30 14:30:49 +00:00
jruoho c6ea14b7ca Fix pastos. 2020-06-25 15:43:26 +00:00
martin daa128b211 Add input files 2020-06-24 15:05:45 +00:00
martin 4c5da4561c Fix directories 2020-06-24 14:48:47 +00:00
jruoho 547814cf8b Also install new tests. 2020-06-24 12:31:26 +00:00
jruoho 08daf067e8 Fix references in comments. 2020-06-24 10:07:13 +00:00
jruoho 3f1bde296f Add a few checks for stdethers(8) and stdhosts(8). 2020-06-24 09:47:17 +00:00
jruoho d60b9b731a Add few basic tests for cpuctl(8). These cover PR kern/45117 and PR bin/54220.
Though, the former is not explicitly tested as it hangs the system.
2020-06-24 09:32:41 +00:00
bad 48e354a3ed Get rid of all the -lrumpdev and -lrumpvfs that are no longer needed
after moving rump's mainbus from rumpdev to rumpkern.

Produces the same atf-run results as before.
2019-05-13 17:55:07 +00:00
nakayama e857ec7771 Add test mtree -O with same hash value in directory and leaf. 2017-09-07 04:05:21 +00:00
christos c3359ffa01 PR/51876: Ngie Cooper: kyua 0.11 $TMPDIR fixes 2017-01-14 20:45:16 +00:00
kre e9acd28970 + -lrumpdev 2016-08-10 23:07:57 +00:00
ozaki-r 80d9064ac0 t_tcpdump: skip bridges
tcpdump on a bridge definitely fails, so skip bridges
to make the test robust.

PR 49050
2014-09-20 06:08:07 +00:00
christos 92501fa166 adjust output now that we don't output size info for links and directories
by default.
2013-10-20 17:27:37 +00:00
joerg 94bcefa490 Check for RUMP programs before using them. 2013-02-19 21:08:24 +00:00
christos bd77daa189 ignore directory sizes 2013-02-05 16:49:42 +00:00
christos 05cc565867 Test the netbsd and mtree flavors. 2013-01-02 18:11:44 +00:00
jruoho c7358053ef Add a test case for PR bin/39546. 2012-04-19 18:51:35 +00:00
christos 2e74a3b7d6 simplify 2012-04-15 03:05:57 +00:00
jruoho f03351f948 Add few more NICs. 2012-04-14 15:13:57 +00:00
jruoho 0a7b1257ab Fix RCS string. 2012-04-14 12:43:05 +00:00
jruoho 0953dc8744 Add a test case for PR kern/46328 (tested naively with tcpdump(8)). 2012-04-14 12:21:45 +00:00
christos 14758c77e1 PR/41061 fixed 2012-03-25 16:10:13 +00:00
jruoho 2f989692b9 Add a case for PR bin/41061. 2012-03-19 06:39:22 +00:00
jruoho 6ab4862c83 Verify that bin/25693 is no longer an issue. 2012-03-18 11:50:55 +00:00
jruoho 28604916d4 Deprecate tests/util. 2012-03-17 16:33:10 +00:00
pooka ff21e05c48 avoid temp file per clue-by-four from jmmv 2010-12-31 15:21:49 +00:00
pooka bc1c80f7e8 Substitute a surgical rump_server configuration for rump_allserver
now that it's possible.  With warm fs cache, the startup time of
the former is 0.01s and the latter 0.1s.  With cold caches it's
0.2s vs 2s.
2010-12-30 16:58:07 +00:00
pooka c48a04bffd Fix test to use atf_check. My development machine still had
/usr/bin/atf-check installed ....
2010-12-18 08:34:56 +00:00
haad 84aab3c9ee Hook traceroute test case to build. it was added to lists so unbreak build now. 2010-12-15 10:36:49 +00:00
pooka 26aa758c5c Add simple tests for traceroute. The test bootstraps a three-node
network with one router in the middle and checks traceroute from
one endpoint to another with both UDP and ICMP.

(i guess these test networking at least as much as traceroute
itself, but then again that's not a bad thing)
2010-12-15 00:13:52 +00:00