Page MenuHomeFreeBSD

audit(4): Syscalls dealing with {mounted/unmounted} file system statistics

Authored by aniketp on Jun 10 2018, 10:50 PM.



The following change introduces 3 system calls dealing with retrieving file system
statistics and list of mounted filesystems. The system calls are categorized as audit
events within file-attribute-access audit class

List of system calls:

  • statfs(2)
  • fstatfs(2)
  • getfsstat(2)
Test Plan

Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

aniketp created this revision.Jun 10 2018, 10:50 PM
asomers requested changes to this revision.Jun 11 2018, 12:06 AM

Build fails.

$ make && sudo make install
(cd /usr/home/somers/freebsd/base/head/tests/sys/audit &&  DEPENDFILE=.depend.file-attribute-access  NO_SUBDIR=1 make -f /usr/home/somers/freebsd/base/head/tests/sys/audit/Makefile _RECURSING_PROGS=t  PROG=file-attribute-access )
rm -f .depend.file-attribute-access
echo file-attribute-access.full: /usr/lib/libc.a /usr/lib/libprivateatf-c.a >> .depend.file-attribute-access
cc  -O2 -pipe   -g -MD  -MF.depend.file-attribute-access.file-attribute-access.o -MTfile-attribute-access.o -std=gnu99 -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments  -c /usr/home/somers/freebsd/base/head/tests/sys/audit/file-attribute-access.c -o file-attribute-access.o
/usr/home/somers/freebsd/base/head/tests/sys/audit/file-attribute-access.c:294:19: error: 
      use of undeclared identifier 'regex'
        check_audit(fds, regex, pipefd);
1 error generated.                                                              
*** Error code 1

make[1]: stopped in /usr/home/somers/freebsd/base/head/tests/sys/audit
*** Error code 1

make: stopped in /usr/home/somers/freebsd/base/head/tests/sys/audit
This revision now requires changes to proceed.Jun 11 2018, 12:06 AM
aniketp updated this revision to Diff 43575.Jun 11 2018, 12:09 AM

Replace regex with extregex

Looks like there are also some file descriptors to close here.

@asomers I'll rebase this file after D15782 is committed. Since both revisions change the file: file-attribute-access.

aniketp updated this revision to Diff 43727.Jun 13 2018, 10:57 PM

Close file descriptor for statfs(2) and fstatfs(2) success case

It no longer compiles. I think those headers were important.

aniketp updated this revision to Diff 43728.Jun 13 2018, 11:12 PM

Include missing headers and struct statfs declaration

asomers accepted this revision.Jun 14 2018, 1:22 AM
This revision is now accepted and ready to land.Jun 14 2018, 1:22 AM
This revision was automatically updated to reflect the committed changes.