The following changes introduce a new test-program file-close , which introduces tests for the
following 4 system calls in both success and failure mode:
- munmap
- close
- closefrom
- revoke
Note: These are the only system calls in "cl" audit class
Differential D15650
Add tests for 4 syscalls in "file-close" audit class aniketp on Jun 1 2018, 10:43 PM. Authored by Tags None Referenced Files
Subscribers
Details
The following changes introduce a new test-program file-close , which introduces tests for the
Note: These are the only system calls in "cl" audit class Execute make && make install from test/sys/audit.
Diff Detail
Event TimelineComment Actions Allocate enough size to ptyname and replace hardcoded size for
Comment Actions Use posix_openpt(2) and ptsname(3) instead of openpty(3) Comment Actions The build fails on 32-bit architectures. Looks like a classic printf format specifier failure. /home/asomers/freebsd/base/head/tests/sys/audit/file-close.c:115:50: error: format specifies type 'unsigned long' but the argument has type 'ino_t' (aka 'unsigned long long') [-Werror,-Wformat] sizeof(extregex), "close.*%lu.*return,succes", statbuff.st_ino); ~~~ ^~~~~~~~~~~~~~~ %llu 1 error generated. Comment Actions Would it be fine to check the presence of PID in the audit regex instead of "Inode number"? I tried testing this using -m32 as a "CFLAG" but instead got a loader error: /usr/bin/ld: cannot find -lprivateatf-c Comment Actions Close. The usual approach in situations like this is to cast the variable to an intmax_t and print it with %jd.
That's because you haven't built the 32-bit ATF libraries. The easiest way to do it is to build an entire i386 world. From /usr/src, do ARCH=i386 TARGET_ARCH=i386 make -jwhatever buildworld. You can even build for other architectures, like sparc64 or riscv. Comment Actions Update the typecasting of statbuff.st_ino to intmax_t and format specfier as %jd to support all architectures. |