Commit Graph

426 Commits

Author SHA1 Message Date
Kristof Provost
6e0bca03bd pf tests: Basic synproxy test
A very basic syncproxy test: set up a connection via a synproxy rule.
This triggeres the panic fixed in r336273.
2018-07-14 21:32:32 +00:00
John Baldwin
a9c91abd3b Export a breakpoint() function to userland for arm and arm64.
Enable ptrace() tests using breakpoint() on these architectures.

Reviewed by:	andrew
Differential Revision:	https://reviews.freebsd.org/D15191
2018-07-06 23:49:17 +00:00
Alan Somers
b1b5f04d5b audit(4): add tests for procctl(2)
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D16086
2018-07-01 16:05:50 +00:00
Alan Somers
af045bbfd7 audit(4): add tests for several more administrative syscalls
Includes ntp_adjtime, auditctl, acct, auditon, and clock_settime.  Includes
quotactl, mount, nmount, swapon, and swapoff in failure mode only.  Success
tests for those syscalls will follow.  Also includes reboot(2) in failure
mode only.  That one can't be tested in success mode.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15898
2018-06-29 04:52:27 +00:00
Alan Somers
18ba95c24a audit(4): add tests for setsid, wait4, wait6, and kill
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D16035
2018-06-29 04:46:15 +00:00
Alan Somers
5641c23fa7 audit(4): fix Coverity issues
Fix several incorrect buffer size arguments and a file descriptor leak.

Submitted by:	aniketp
Reported by:	Coverity
CID:		1393489 1393501 1393509 1393510 1393514 1393515 1393516
CID:		1393517 1393518 1393519
MFC after:	2 weeks
X-MFC-With:	335284
X-MFC-With:	335318
X-MFC-With:	335320
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D16000
2018-06-27 15:28:09 +00:00
Alan Somers
c907f24ead audit(4): add tests for the process-control audit class
Tested syscalls include rfork(2), chdir(2), fchdir(2), chroot(2),
getresuid(2), getresgid(2), setpriority(2), setgroups(2), setpgrp(2),
setrlimit(2), setlogin(2), mlock(2), munlock(2), minherit(2), rtprio(2),
profil(2), ktrace(2), ptrace(2), fork(2), umask(2), setuid(2), setgid(2),
seteuid(2), and setegid(2).  The last six are only tested in the success
case, either because they're infalliable or a failure is difficult to cause
on-demand.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15966
2018-06-26 20:26:57 +00:00
Alan Somers
3d3d017834 audit(4): add tests for pipe, posix_openpt, shm_open, and shm_unlink
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15963
2018-06-26 19:26:07 +00:00
Alan Somers
4aabb64af9 audit(4): add tests for Sys V semaphore operations
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15897
2018-06-22 02:56:03 +00:00
Alan Somers
b92435cc82 audit(4): add tests for sendmsg, recvmsg, shutdown, and sendfile
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15895
2018-06-19 17:41:46 +00:00
Alan Somers
d1fb351c68 audit(4): add tests for utimes(2) and friends, mprotect, and undelete
Includes utimes(2), futimes(2), lutimes(2), futimesat(2), mprotect(2), and
undelete(2).  undelete, for now, is tested only in failure mode.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15893
2018-06-19 16:55:39 +00:00
Alan Somers
4003d93835 audit(4): add tests for ioctl(2)
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15872
2018-06-19 01:32:33 +00:00
Alan Somers
ff150bea29 audit(4): Add tests for {get/set}auid, {get/set}audit, {get/set}audit_addr
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15871
2018-06-18 15:37:43 +00:00
Alan Somers
943f585c5a audit(4): add tests for send, recv, sendto, and recvfrom
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15869
2018-06-18 15:27:31 +00:00
Alan Somers
844fc5ebf1 audit(4): add tests for extattr_set_file and friends
Includes extattr_{set_file, _set_fd, _set_link, _delete_file, _delete_fd,
_delete_link}

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15867
2018-06-18 15:07:10 +00:00
Alan Somers
4107f2c44c Fix 32-bit build after 335307
This was correct in the final version on Phabricator, but somehow I screwed
up applying the patch locally.

Reported by:	linimon
Pointy-hat-to:	asomers
MFC after:	2 weeks
X-MFC-With:	335307
2018-06-18 04:12:58 +00:00
Alan Somers
8f2433eb44 audit(4): add tests for Sys V shared memory syscalls
includes shmget, shmat, shmdt, and shmctl

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15860
2018-06-17 21:29:35 +00:00
Alan Somers
b84a044b4c audit(4): add tests for connect, connectat, and accept
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15853
2018-06-17 17:43:55 +00:00
Alan Somers
49f526501d audit(4): Add tests for a few syscalls in the ad class
The ad audit class is for administrative commands.  This commit adds test
for settimeofday, adjtime, and getfh.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15861
2018-06-17 16:24:46 +00:00
Alan Somers
7d951cc29a audit(4): add tests for extattr_get_file(2) and friends
This commit includes extattr_{get_file, get_fd, get_link, list_file,
list_fd, list_link}.  It does not include any syscalls that modify, set, or
delete extended attributes, as those are in a different audit class.

Submitted by:	aniketpt
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15859
2018-06-17 15:22:27 +00:00
Alan Somers
68e520fea4 audit(4): add tests for chflags and friends
chflags, fchflags, and lchflags (but not chflagsat) are included.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15854
2018-06-17 03:10:25 +00:00
Alan Somers
2c347e631e audit(4): add tests for pathconf(2) and friends
pathconf, lpathconf, and fpathconf are included

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15842
2018-06-16 18:29:24 +00:00
Alan Somers
d7d1ecc071 audit(4): add tests for POSIX message queues
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15848
2018-06-16 18:22:35 +00:00
Alan Somers
5c9a473888 audit(4): add tests for chown(2) and friends
Includes chown, fchown, lchown, and fchownat

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15825
2018-06-16 15:38:59 +00:00
Alan Somers
babaf5cb1c audit(4): add tests for bind(2), bindat(2), and listen(2)
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15843
2018-06-16 15:25:08 +00:00
Alan Somers
ad2afa8c8b audit(4): Add a few tests for network-related syscalls
Add tests for socket(2), socketpair(2), and setsockopt(2)

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15803
2018-06-15 16:41:28 +00:00
Alan Somers
52e29fd0cd audit(4): improve formatting in tests/sys/audit/open.c
[skip ci]

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15797
2018-06-15 15:36:10 +00:00
Alan Somers
2884521370 audit(4): add tests for access(2), chmod(2), and friends
access(2), eaccess(2), faccessat(2), chmod(2), fchmod(2), lchmod(2), and
fchmodat(2).

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15805
Differential Revision:	https://reviews.freebsd.org/D15808
2018-06-15 15:32:02 +00:00
Alan Somers
a56867b8c5 audit(4): add tests for fhopen, fhstat, and fhstatfs
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15798
2018-06-14 15:04:49 +00:00
Alan Somers
5597d2a341 audit(4): fix typo from r335136
Typo in Makefile accidentally disabled some older tests

MFC after:	2 weeks
X-MFC-With:	335136
2018-06-14 14:53:01 +00:00
Alan Somers
6d203d2dd7 audit(4): add tests for flock, fcntl, and fsync
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15795
2018-06-14 13:42:58 +00:00
Alan Somers
ae19b2ef9b audit(4): add tests for statfs(2), fstatfs(2), and getfsstat(2)
Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15750
2018-06-14 02:30:43 +00:00
Alan Somers
b13a70d5a4 audit(4): Fix file descriptor leaks in ATF tests
Submitted by:	aniketp
Reported by:	Coverity
CID:		1393343 1393346 1392695 1392781 1391709 1392078 1392413
CID:		1392014 1392521 1393344 1393345 1393347 1393348 1393349
CID:		1393354 1393355 1393356 1393357 1393358 1393360 1393362
CID:		1393368 1393369 1393370 1393371 1393372 1393373 1393376
CID:		1393380 1393384 1393387 1393388 1393389
MFC after:	2 weeks
Sponsored by:	Google, Inc (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15782
2018-06-13 17:01:57 +00:00
Alan Somers
f86d65170b audit(4): add tests for stat(2) and friends
This revision adds auditability tests for stat, lstat, fstat, and fstatat,
all from the fa audit class.  More tests from that audit class will follow.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15709
2018-06-10 21:36:29 +00:00
Kristof Provost
d850143efd pf tests: Basic route-to tests
Very basic route-to tests. These tests attempt to provoke PR 228782 for IPv4
and IPv6. A test failure will panic the machine.
2018-06-09 14:21:07 +00:00
Alan Somers
c41bbc0acb audit(4): add tests for open(2) and openat(2)
These syscalls are atypical, because each one corresponds to several
different audit events, and they each pass several different audit class
filters.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15657
2018-06-05 20:13:24 +00:00
Alan Somers
01e77fa0bf audit(4): add tests for the cl audit class
The only syscalls in this class are close, closefrom, munmap, and revoke.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15650
2018-06-03 23:36:29 +00:00
Alan Somers
a19dca2dfd audit(4): add tests for the fd audit class
The only syscalls in this class are rmdir, unlink, unlinkat, rename, and
renameat.  Also, set is_exclusive for all audit(4) tests, because they can
start and stop auditd.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15647
2018-06-01 21:24:10 +00:00
Alan Somers
26f5ecb775 audit(4): Add tests for the fw class of syscalls.
truncate and ftruncate are the only syscalls in this class, apart from
certain variations of open and openat, which will be handled in a different
file.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15640
2018-06-01 16:23:47 +00:00
Alan Somers
8ec6562b6d audit(4): Add tests for the fr class of syscalls
readlink and readlinkat are the only syscalls in this class.  open and
openat are as well, but they'll be handled in a different file.  Also, tidy
up the copyright headers of recently added files in this area.

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc. (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15636
2018-06-01 01:37:07 +00:00
Alan Somers
e5569cb61e Revert r334362
Reconnect tests/sys/audit now that the GCC issue is fixed by 334388

MFC after:	2 weeks
X-MFC-With:	334362, 334360, 334388
2018-05-30 19:58:36 +00:00
Ed Maste
16b88f72f7 Temporarily disconnect audit tests
Audit tests added in r334360 broke the build on a number of archs.
Remove the subdir from the top level tests/sys/Makefile until they're
fixed.
2018-05-30 00:36:58 +00:00
Alan Somers
f7f4e0f7a8 Add initial set of tests for audit(4)
This change includes the framework for testing the auditability of various
syscalls, and includes changes for the first 12.  The tests will start
auditd(8) if needed, though they'll be much faster if it's already running.
The syscalls tested in this commit include mkdir(2), mkdirat(2), mknod(2),
mknodat(2), mkfifo(2), mkfifoat(2), link(2), linkat(2), symlink(2),
symlinkat(2), rename(2), and renameat(2).

Submitted by:	aniketp
MFC after:	2 weeks
Sponsored by:	Google, Inc (GSoC 2018)
Differential Revision:	https://reviews.freebsd.org/D15286
2018-05-29 23:08:33 +00:00
John Baldwin
ca75fa17ee Export a breakpoint() function to userland for riscv.
As a result, enable tests using breakpoint() on riscv.

Reviewed by:	br
Differential Revision:	https://reviews.freebsd.org/D15191
2018-05-16 16:56:35 +00:00
Ed Maste
ee9c968c85 Strip trailing / from TESTSDIR
Otherwise makefs gets upset:
makefs: ./usr/tests/sys/cddl/zfs/tests/exec/: empty leaf element

Sponsored by:	The FreeBSD Foundation
2018-05-11 16:11:24 +00:00
Ed Maste
2216c6933c Disable connectat/bindat with AT_FDCWD in capmode
Previously it was possible to connect a socket (which had the
CAP_CONNECT right) by calling "connectat(AT_FDCWD, ...)" even in
capabilties mode.  This combination should be treated the same as a call
to connect (i.e. forbidden in capabilities mode).  Similarly for bindat.

Disable connectat/bindat with AT_FDCWD in capabilities mode, fix up the
documentation and add tests.

PR:		222632
Submitted by:	Jan Kokemüller <jan.kokemueller@gmail.com>
Reviewed by:	Domagoj Stolfa
MFC after:	1 week
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D15221
2018-04-30 17:31:06 +00:00
Konstantin Belousov
1187fc2dc6 Remove redundant pipe from pdeathsig.c test.
A pipe was was left over from a development version of pdeathsig.c and
is not needed.

Process C waits for a signal that'll be generated when process B
exists. Process B waits for process D to send it a byte via pipe_db
before it exits. Process D sends the byte after it has started
ptrace()ing process C. The point of the test is to show that process C
receives the signal because process B exited, even though C has been
reparented to process D. The pipe pipe_cd isn't doing anything useful
(though in an earlier version of the patch it did). Clean that up by
removing the useless pipe.

Submitted by:	Thomas Munro
MFC after:	6 days
Differential revision:	https://reviews.freebsd.org/D15214
2018-04-27 16:34:28 +00:00
John Baldwin
e71d9c1f33 Shorten some recently-added lines that are an extra indent over 80 columns. 2018-04-24 23:22:45 +00:00
John Baldwin
643ce7de72 Add two tests for TRAP_* signal codes for SIGTRAP.
- ptrace__breakpoint_siginfo tests that a SIGTRAP for a software breakpoint
  in userland triggers a SIGTRAP with a signal code of TRAP_BRKPT.
- ptrace__step_siginfo tests that a SIGTRAP reported for a step after
  stepping via PT_STEP or PT_SETSTEP has a signal code of TRAP_TRACE.
2018-04-24 05:30:05 +00:00
John Baldwin
bd061c3998 Expose breakpoint() to userland from <machine/cpufunc.h> on MIPS.
Enable ptrace() tests using breakpoint on MIPS as well.

Tested on:	mips64
MFC after:	1 month
2018-04-24 05:26:28 +00:00